blob: 6cae32952d0691ac5b2e1f7132ce9a1644bbf2c3 [file] [log] [blame]
Nicolas Capens0bac2852016-05-07 06:09:58 -04001// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// main.cpp: DLL entry point and management of thread-local data.
16
17#include "main.h"
18
19#include "libEGL.hpp"
20#include "Context.hpp"
21#include "Surface.h"
22
23#include "resource.h"
24#include "Common/Thread.hpp"
25#include "Common/SharedLibrary.hpp"
26#include "common/debug.h"
27
28#include <EGL/eglext.h>
29
30static sw::Thread::LocalStorageKey currentTLS = TLS_OUT_OF_INDEXES;
31
32#if !defined(_MSC_VER)
33#define CONSTRUCTOR __attribute__((constructor))
34#define DESTRUCTOR __attribute__((destructor))
35#else
36#define CONSTRUCTOR
37#define DESTRUCTOR
38#endif
39
40static void eglAttachThread()
41{
42 TRACE("()");
43
44 egl::Current *current = new egl::Current;
45
46 if(current)
47 {
48 sw::Thread::setLocalStorage(currentTLS, current);
49
50 current->error = EGL_SUCCESS;
51 current->API = EGL_OPENGL_ES_API;
52 current->display = EGL_NO_DISPLAY;
53 current->context = nullptr;
54 current->drawSurface = nullptr;
55 current->readSurface = nullptr;
56 }
57}
58
59static void eglDetachThread()
60{
61 TRACE("()");
62
63 egl::Current *current = (egl::Current*)sw::Thread::getLocalStorage(currentTLS);
64
65 if(current)
66 {
67 delete current;
68 }
69}
70
71CONSTRUCTOR static void eglAttachProcess()
72{
73 TRACE("()");
74
75 #if !defined(ANGLE_DISABLE_TRACE) && defined(TRACE_OUTPUT_FILE)
76 FILE *debug = fopen(TRACE_OUTPUT_FILE, "rt");
77
78 if(debug)
79 {
80 fclose(debug);
81 debug = fopen(TRACE_OUTPUT_FILE, "wt"); // Erase
82 fclose(debug);
83 }
84 #endif
85
86 currentTLS = sw::Thread::allocateLocalStorageKey();
87
88 if(currentTLS == TLS_OUT_OF_INDEXES)
89 {
90 return;
91 }
92
93 eglAttachThread();
94}
95
96DESTRUCTOR static void eglDetachProcess()
97{
98 TRACE("()");
99
100 eglDetachThread();
101 sw::Thread::freeLocalStorageKey(currentTLS);
102}
103
104#if defined(_WIN32)
105static INT_PTR CALLBACK DebuggerWaitDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
106{
107 RECT rect;
108
109 switch(uMsg)
110 {
111 case WM_INITDIALOG:
112 GetWindowRect(GetDesktopWindow(), &rect);
113 SetWindowPos(hwnd, HWND_TOP, rect.right / 2, rect.bottom / 2, 0, 0, SWP_NOSIZE);
114 SetTimer(hwnd, 1, 100, NULL);
115 return TRUE;
116 case WM_COMMAND:
117 if(LOWORD(wParam) == IDCANCEL)
118 {
119 EndDialog(hwnd, 0);
120 }
121 break;
122 case WM_TIMER:
123 if(IsDebuggerPresent())
124 {
125 EndDialog(hwnd, 0);
126 }
127 }
128
129 return FALSE;
130}
131
132static void WaitForDebugger(HINSTANCE instance)
133{
134 if(!IsDebuggerPresent())
135 {
136 HRSRC dialog = FindResource(instance, MAKEINTRESOURCE(IDD_DIALOG1), RT_DIALOG);
137 DLGTEMPLATE *dialogTemplate = (DLGTEMPLATE*)LoadResource(instance, dialog);
138 DialogBoxIndirect(instance, dialogTemplate, NULL, DebuggerWaitDialogProc);
139 }
140}
141
142extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
143{
144 switch(reason)
145 {
146 case DLL_PROCESS_ATTACH:
147 #ifndef NDEBUG
148 WaitForDebugger(instance);
149 #endif
150 eglAttachProcess();
151 break;
152 case DLL_THREAD_ATTACH:
153 eglAttachThread();
154 break;
155 case DLL_THREAD_DETACH:
156 eglDetachThread();
157 break;
158 case DLL_PROCESS_DETACH:
159 eglDetachProcess();
160 break;
161 default:
162 break;
163 }
164
165 return TRUE;
166}
167#endif
168
169namespace egl
170{
171static Current *eglGetCurrent(void)
172{
173 Current *current = (Current*)sw::Thread::getLocalStorage(currentTLS);
174
175 if(!current)
176 {
177 eglAttachThread();
178 }
179
180 return (Current*)sw::Thread::getLocalStorage(currentTLS);
181}
182
183void setCurrentError(EGLint error)
184{
185 Current *current = eglGetCurrent();
186
187 current->error = error;
188}
189
190EGLint getCurrentError()
191{
192 Current *current = eglGetCurrent();
193
194 return current->error;
195}
196
197void setCurrentAPI(EGLenum API)
198{
199 Current *current = eglGetCurrent();
200
201 current->API = API;
202}
203
204EGLenum getCurrentAPI()
205{
206 Current *current = eglGetCurrent();
207
208 return current->API;
209}
210
211void setCurrentDisplay(EGLDisplay dpy)
212{
213 Current *current = eglGetCurrent();
214
215 current->display = dpy;
216}
217
218EGLDisplay getCurrentDisplay()
219{
220 Current *current = eglGetCurrent();
221
222 return current->display;
223}
224
225void setCurrentContext(egl::Context *ctx)
226{
227 Current *current = eglGetCurrent();
228
229 if(ctx)
230 {
231 ctx->addRef();
232 }
233
234 if(current->context)
235 {
236 current->context->release();
237 }
238
239 current->context = ctx;
240}
241
242egl::Context *getCurrentContext()
243{
244 Current *current = eglGetCurrent();
245
246 return current->context;
247}
248
249void setCurrentDrawSurface(egl::Surface *surface)
250{
251 Current *current = eglGetCurrent();
252
253 if(surface)
254 {
255 surface->addRef();
256 }
257
258 if(current->drawSurface)
259 {
260 current->drawSurface->release();
261 }
262
263 current->drawSurface = surface;
264}
265
266egl::Surface *getCurrentDrawSurface()
267{
268 Current *current = eglGetCurrent();
269
270 return current->drawSurface;
271}
272
273void setCurrentReadSurface(egl::Surface *surface)
274{
275 Current *current = eglGetCurrent();
276
277 if(surface)
278 {
279 surface->addRef();
280 }
281
282 if(current->readSurface)
283 {
284 current->readSurface->release();
285 }
286
287 current->readSurface = surface;
288}
289
290egl::Surface *getCurrentReadSurface()
291{
292 Current *current = eglGetCurrent();
293
294 return current->readSurface;
295}
296
297void error(EGLint errorCode)
298{
299 egl::setCurrentError(errorCode);
300
301 if(errorCode != EGL_SUCCESS)
302 {
303 switch(errorCode)
304 {
305 case EGL_NOT_INITIALIZED: TRACE("\t! Error generated: not initialized\n"); break;
306 case EGL_BAD_ACCESS: TRACE("\t! Error generated: bad access\n"); break;
307 case EGL_BAD_ALLOC: TRACE("\t! Error generated: bad alloc\n"); break;
308 case EGL_BAD_ATTRIBUTE: TRACE("\t! Error generated: bad attribute\n"); break;
309 case EGL_BAD_CONFIG: TRACE("\t! Error generated: bad config\n"); break;
310 case EGL_BAD_CONTEXT: TRACE("\t! Error generated: bad context\n"); break;
311 case EGL_BAD_CURRENT_SURFACE: TRACE("\t! Error generated: bad current surface\n"); break;
312 case EGL_BAD_DISPLAY: TRACE("\t! Error generated: bad display\n"); break;
313 case EGL_BAD_MATCH: TRACE("\t! Error generated: bad match\n"); break;
314 case EGL_BAD_NATIVE_PIXMAP: TRACE("\t! Error generated: bad native pixmap\n"); break;
315 case EGL_BAD_NATIVE_WINDOW: TRACE("\t! Error generated: bad native window\n"); break;
316 case EGL_BAD_PARAMETER: TRACE("\t! Error generated: bad parameter\n"); break;
317 case EGL_BAD_SURFACE: TRACE("\t! Error generated: bad surface\n"); break;
318 case EGL_CONTEXT_LOST: TRACE("\t! Error generated: context lost\n"); break;
319 default: TRACE("\t! Error generated: <0x%X>\n", errorCode); break;
320 }
321 }
322}
323}
324
325namespace egl
326{
327EGLint GetError(void);
328EGLDisplay GetDisplay(EGLNativeDisplayType display_id);
329EGLBoolean Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
330EGLBoolean Terminate(EGLDisplay dpy);
331const char *QueryString(EGLDisplay dpy, EGLint name);
332EGLBoolean GetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
333EGLBoolean ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
334EGLBoolean GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
335EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType window, const EGLint *attrib_list);
336EGLSurface CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
337EGLSurface CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
338EGLBoolean DestroySurface(EGLDisplay dpy, EGLSurface surface);
339EGLBoolean QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
340EGLBoolean BindAPI(EGLenum api);
341EGLenum QueryAPI(void);
342EGLBoolean WaitClient(void);
343EGLBoolean ReleaseThread(void);
344EGLSurface CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
345EGLBoolean SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
346EGLBoolean BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
347EGLBoolean ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
348EGLBoolean SwapInterval(EGLDisplay dpy, EGLint interval);
349EGLContext CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
350EGLBoolean DestroyContext(EGLDisplay dpy, EGLContext ctx);
351EGLBoolean MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
352EGLContext GetCurrentContext(void);
353EGLSurface GetCurrentSurface(EGLint readdraw);
354EGLDisplay GetCurrentDisplay(void);
355EGLBoolean QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
356EGLBoolean WaitGL(void);
357EGLBoolean WaitNative(EGLint engine);
358EGLBoolean SwapBuffers(EGLDisplay dpy, EGLSurface surface);
359EGLBoolean CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
360EGLImageKHR CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
361EGLBoolean DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image);
362EGLDisplay GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list);
363EGLSurface CreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
364EGLSurface CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
365EGLSyncKHR CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
366EGLBoolean DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
367EGLint ClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
368EGLBoolean GetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
369__eglMustCastToProperFunctionPointerType GetProcAddress(const char *procname);
370}
371
372extern "C"
373{
374EGLAPI EGLint EGLAPIENTRY eglGetError(void)
375{
376 return egl::GetError();
377}
378
379EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id)
380{
381 return egl::GetDisplay(display_id);
382}
383
384EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
385{
386 return egl::Initialize(dpy, major, minor);
387}
388
389EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy)
390{
391 return egl::Terminate(dpy);
392}
393
394EGLAPI const char *EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
395{
396 return egl::QueryString(dpy, name);
397}
398
399EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
400{
401 return egl::GetConfigs(dpy, configs, config_size, num_config);
402}
403
404EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
405{
406 return egl::ChooseConfig(dpy, attrib_list, configs, config_size, num_config);
407}
408
409EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
410{
411 return egl::GetConfigAttrib(dpy, config, attribute, value);
412}
413
414EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType window, const EGLint *attrib_list)
415{
416 return egl::CreateWindowSurface(dpy, config, window, attrib_list);
417}
418
419EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
420{
421 return egl::CreatePbufferSurface(dpy, config, attrib_list);
422}
423
424EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
425{
426 return egl::CreatePixmapSurface(dpy, config, pixmap, attrib_list);
427}
428
429EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
430{
431 return egl::DestroySurface(dpy, surface);
432}
433
434EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
435{
436 return egl::QuerySurface(dpy, surface, attribute, value);
437}
438
439EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api)
440{
441 return egl::BindAPI(api);
442}
443
444EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void)
445{
446 return egl::QueryAPI();
447}
448
449EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void)
450{
451 return egl::WaitClient();
452}
453
454EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void)
455{
456 return egl::ReleaseThread();
457}
458
459EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
460{
461 return egl::CreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
462}
463
464EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
465{
466 return egl::SurfaceAttrib(dpy, surface, attribute, value);
467}
468
469EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
470{
471 return egl::BindTexImage(dpy, surface, buffer);
472}
473
474EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
475{
476 return egl::ReleaseTexImage(dpy, surface, buffer);
477}
478
479EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval)
480{
481 return egl::SwapInterval(dpy, interval);
482}
483
484EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
485{
486 return egl::CreateContext(dpy, config, share_context, attrib_list);
487}
488
489EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
490{
491 return egl::DestroyContext(dpy, ctx);
492}
493
494EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
495{
496 return egl::MakeCurrent(dpy, draw, read, ctx);
497}
498
499EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void)
500{
501 return egl::GetCurrentContext();
502}
503
504EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw)
505{
506 return egl::GetCurrentSurface(readdraw);
507}
508
509EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void)
510{
511 return egl::GetCurrentDisplay();
512}
513
514EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
515{
516 return egl::QueryContext(dpy, ctx, attribute, value);
517}
518
519EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void)
520{
521 return egl::WaitClient();
522}
523
524EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine)
525{
526 return egl::WaitNative(engine);
527}
528
529EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
530{
531 return egl::SwapBuffers(dpy, surface);
532}
533
534EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
535{
536 return egl::CopyBuffers(dpy, surface, target);
537}
538
539EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
540{
541 return egl::CreateImageKHR(dpy, ctx, target, buffer, attrib_list);
542}
543
544EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
545{
546 return egl::DestroyImageKHR(dpy, image);
547}
548
549EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
550{
551 return egl::GetPlatformDisplayEXT(platform, native_display, attrib_list);
552}
553
554EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list)
555{
556 return egl::CreatePlatformWindowSurfaceEXT(dpy, config, native_window, attrib_list);
557}
558
559EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list)
560{
561 return egl::CreatePlatformPixmapSurfaceEXT(dpy, config, native_pixmap, attrib_list);
562}
563
564EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
565{
566 return egl::CreateSyncKHR(dpy, type, attrib_list);
567}
568
569EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
570{
571 return egl::DestroySyncKHR(dpy, sync);
572}
573
574EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
575{
576 return egl::ClientWaitSyncKHR(dpy, sync, flags, timeout);
577}
578
579EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
580{
581 return egl::GetSyncAttribKHR(dpy, sync, attribute, value);
582}
583
584EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname)
585{
586 return egl::GetProcAddress(procname);
587}
588}
589
590LibEGLexports::LibEGLexports()
591{
592 this->eglGetError = egl::GetError;
593 this->eglGetDisplay = egl::GetDisplay;
594 this->eglInitialize = egl::Initialize;
595 this->eglTerminate = egl::Terminate;
596 this->eglQueryString = egl::QueryString;
597 this->eglGetConfigs = egl::GetConfigs;
598 this->eglChooseConfig = egl::ChooseConfig;
599 this->eglGetConfigAttrib = egl::GetConfigAttrib;
600 this->eglCreateWindowSurface = egl::CreateWindowSurface;
601 this->eglCreatePbufferSurface = egl::CreatePbufferSurface;
602 this->eglCreatePixmapSurface = egl::CreatePixmapSurface;
603 this->eglDestroySurface = egl::DestroySurface;
604 this->eglQuerySurface = egl::QuerySurface;
605 this->eglBindAPI = egl::BindAPI;
606 this->eglQueryAPI = egl::QueryAPI;
607 this->eglWaitClient = egl::WaitClient;
608 this->eglReleaseThread = egl::ReleaseThread;
609 this->eglCreatePbufferFromClientBuffer = egl::CreatePbufferFromClientBuffer;
610 this->eglSurfaceAttrib = egl::SurfaceAttrib;
611 this->eglBindTexImage = egl::BindTexImage;
612 this->eglReleaseTexImage = egl::ReleaseTexImage;
613 this->eglSwapInterval = egl::SwapInterval;
614 this->eglCreateContext = egl::CreateContext;
615 this->eglDestroyContext = egl::DestroyContext;
616 this->eglMakeCurrent = egl::MakeCurrent;
617 this->eglGetCurrentContext = egl::GetCurrentContext;
618 this->eglGetCurrentSurface = egl::GetCurrentSurface;
619 this->eglGetCurrentDisplay = egl::GetCurrentDisplay;
620 this->eglQueryContext = egl::QueryContext;
621 this->eglWaitGL = egl::WaitGL;
622 this->eglWaitNative = egl::WaitNative;
623 this->eglSwapBuffers = egl::SwapBuffers;
624 this->eglCopyBuffers = egl::CopyBuffers;
625 this->eglCreateImageKHR = egl::CreateImageKHR;
626 this->eglDestroyImageKHR = egl::DestroyImageKHR;
627 this->eglGetProcAddress = egl::GetProcAddress;
628 this->eglCreateSyncKHR = egl::CreateSyncKHR;
629 this->eglDestroySyncKHR = egl::DestroySyncKHR;
630 this->eglClientWaitSyncKHR = egl::ClientWaitSyncKHR;
631 this->eglGetSyncAttribKHR = egl::GetSyncAttribKHR;
632
633 this->clientGetCurrentContext = egl::getCurrentContext;
634}
635
636extern "C" EGLAPI LibEGLexports *libEGL_swiftshader()
637{
638 static LibEGLexports libEGL;
639 return &libEGL;
640}
641
642LibGLES_CM libGLES_CM;
643LibGLESv2 libGLESv2;