Commit 6899f6c8 by Nicolas Capens Committed by Nicolas Capens

Eliminate the getCurrentContext() dependency.

BUG=18110152 Change-Id: Ic1e502cdd1392c16d6f53a139f57bc224b338cc4 Reviewed-on: https://swiftshader-review.googlesource.com/1241Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent f6cd5dec
...@@ -311,7 +311,7 @@ bool Surface::checkForResize() ...@@ -311,7 +311,7 @@ bool Surface::checkForResize()
if(static_cast<egl::Surface*>(getCurrentDrawSurface()) == this) if(static_cast<egl::Surface*>(getCurrentDrawSurface()) == this)
{ {
gl::makeCurrent(gl::getCurrentContext(), static_cast<egl::Display*>(getCurrentDisplay()), this); gl::makeCurrent(static_cast<gl::Context*>(getCurrentContext()), static_cast<egl::Display*>(getCurrentDisplay()), this);
} }
return true; return true;
......
...@@ -884,7 +884,7 @@ EGLContext EGLAPIENTRY eglGetCurrentContext(void) ...@@ -884,7 +884,7 @@ EGLContext EGLAPIENTRY eglGetCurrentContext(void)
try try
{ {
EGLContext context = gl::getCurrentContext(); EGLContext context = egl::getCurrentContext();
return success(context); return success(context);
} }
......
...@@ -91,7 +91,6 @@ CONSTRUCTOR static bool eglAttachProcess() ...@@ -91,7 +91,6 @@ CONSTRUCTOR static bool eglAttachProcess()
gl::createDevice = (gl::Device*(*)())getProcAddress(libGLESv2, "createDevice"); gl::createDevice = (gl::Device*(*)())getProcAddress(libGLESv2, "createDevice");
gl::createContext = (gl::Context *(*)(const egl::Config*, const gl::Context*))getProcAddress(libGLESv2, "glCreateContext"); gl::createContext = (gl::Context *(*)(const egl::Config*, const gl::Context*))getProcAddress(libGLESv2, "glCreateContext");
gl::makeCurrent = (void (*)(gl::Context*, egl::Display*, egl::Surface*))getProcAddress(libGLESv2, "glMakeCurrent"); gl::makeCurrent = (void (*)(gl::Context*, egl::Display*, egl::Surface*))getProcAddress(libGLESv2, "glMakeCurrent");
gl::getCurrentContext = (gl::Context *(*)())getProcAddress(libGLESv2, "glGetCurrentContext");
gl::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLESv2, "glGetProcAddress"); gl::getProcAddress = (__eglMustCastToProperFunctionPointerType (*)(const char*))getProcAddress(libGLESv2, "glGetProcAddress");
gl::createBackBuffer = (gl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLESv2, "createBackBuffer"); gl::createBackBuffer = (gl::Image *(*)(int, int, const egl::Config*))getProcAddress(libGLESv2, "createBackBuffer");
gl::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLESv2, "createFrameBuffer"); gl::createFrameBuffer = (sw::FrameBuffer *(*)(EGLNativeDisplayType, EGLNativeWindowType, int, int))getProcAddress(libGLESv2, "createFrameBuffer");
...@@ -190,6 +189,20 @@ EGLDisplay getCurrentDisplay() ...@@ -190,6 +189,20 @@ EGLDisplay getCurrentDisplay()
return current->display; return current->display;
} }
void setCurrentContext(EGLContext ctx)
{
Current *current = eglGetCurrent();
current->context = ctx;
}
EGLDisplay getCurrentContext()
{
Current *current = eglGetCurrent();
return current->context;
}
void setCurrentDrawSurface(EGLSurface surface) void setCurrentDrawSurface(EGLSurface surface)
{ {
Current *current = eglGetCurrent(); Current *current = eglGetCurrent();
......
...@@ -25,6 +25,7 @@ namespace egl ...@@ -25,6 +25,7 @@ namespace egl
EGLint error; EGLint error;
EGLenum API; EGLenum API;
EGLDisplay display; EGLDisplay display;
EGLContext context;
EGLSurface drawSurface; EGLSurface drawSurface;
EGLSurface readSurface; EGLSurface readSurface;
}; };
...@@ -38,6 +39,9 @@ namespace egl ...@@ -38,6 +39,9 @@ namespace egl
void setCurrentDisplay(EGLDisplay dpy); void setCurrentDisplay(EGLDisplay dpy);
EGLDisplay getCurrentDisplay(); EGLDisplay getCurrentDisplay();
void setCurrentContext(EGLContext ctx);
EGLContext getCurrentContext();
void setCurrentDrawSurface(EGLSurface surface); void setCurrentDrawSurface(EGLSurface surface);
EGLSurface getCurrentDrawSurface(); EGLSurface getCurrentDrawSurface();
...@@ -86,7 +90,6 @@ namespace gl ...@@ -86,7 +90,6 @@ namespace gl
extern Context *(*createContext)(const egl::Config *config, const Context *shareContext); extern Context *(*createContext)(const egl::Config *config, const Context *shareContext);
extern void (*bindTexImage)(egl::Surface *surface); extern void (*bindTexImage)(egl::Surface *surface);
extern void (*makeCurrent)(Context *context, egl::Display *display, egl::Surface *surface); extern void (*makeCurrent)(Context *context, egl::Display *display, egl::Surface *surface);
extern Context *(*getCurrentContext)();
extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname); extern __eglMustCastToProperFunctionPointerType (*getProcAddress)(const char *procname);
extern Image *(*createBackBuffer)(int width, int height, const egl::Config *config); extern Image *(*createBackBuffer)(int width, int height, const egl::Config *config);
extern sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height); extern sw::FrameBuffer *(*createFrameBuffer)(EGLNativeDisplayType display, EGLNativeWindowType window, int width, int height);
......
...@@ -2231,9 +2231,4 @@ extern "C" ...@@ -2231,9 +2231,4 @@ extern "C"
{ {
gl::makeCurrent(context, display, surface); gl::makeCurrent(context, display, surface);
} }
gl::Context *glGetCurrentContext()
{
return gl::getContext();
}
} }
...@@ -148,7 +148,6 @@ EXPORTS ...@@ -148,7 +148,6 @@ EXPORTS
; EGL dependencies ; EGL dependencies
glCreateContext @144 glCreateContext @144
glMakeCurrent @146 glMakeCurrent @146
glGetCurrentContext @147
glGetProcAddress @148 glGetProcAddress @148
glBindTexImage @158 glBindTexImage @158
......
...@@ -3044,9 +3044,4 @@ extern "C" ...@@ -3044,9 +3044,4 @@ extern "C"
{ {
gl::makeCurrent(context, display, surface); gl::makeCurrent(context, display, surface);
} }
gl::Context *glGetCurrentContext()
{
return gl::getContext();
}
} }
...@@ -171,7 +171,6 @@ EXPORTS ...@@ -171,7 +171,6 @@ EXPORTS
; EGL dependencies ; EGL dependencies
glCreateContext @144 glCreateContext @144
glMakeCurrent @146 glMakeCurrent @146
glGetCurrentContext @147
glGetProcAddress @148 glGetProcAddress @148
glBindTexImage @158 glBindTexImage @158
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment