Add support for various egl Get methods

Trac #12375 This patch stores the current READ/DRAW and display in the context and allows these eglGets to work. Original-Author: Jim Hauxwell <james@dattrax.co.uk> Signed-off-by: Nicolas Capens Signed-off-by: Daniel Koch git-svn-id: https://angleproject.googlecode.com/svn/trunk@321 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 5ac5dd25
......@@ -847,6 +847,10 @@ EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface
UNIMPLEMENTED(); // FIXME
}
egl::setCurrentDisplay(dpy);
egl::setCurrentDrawSurface(draw);
egl::setCurrentReadSurface(read);
glMakeCurrent(context, display, static_cast<egl::Surface*>(draw));
return success(EGL_TRUE);
......@@ -883,9 +887,20 @@ EGLSurface __stdcall eglGetCurrentSurface(EGLint readdraw)
try
{
UNIMPLEMENTED(); // FIXME
return success(EGL_NO_SURFACE);
if (readdraw == EGL_READ)
{
EGLSurface read = egl::getCurrentReadSurface();
return success(read);
}
else if (readdraw == EGL_DRAW)
{
EGLSurface draw = egl::getCurrentDrawSurface();
return success(draw);
}
else
{
return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
}
}
catch(std::bad_alloc&)
{
......@@ -901,9 +916,9 @@ EGLDisplay __stdcall eglGetCurrentDisplay(void)
try
{
UNIMPLEMENTED(); // FIXME
EGLDisplay dpy = egl::getCurrentDisplay();
return success(EGL_NO_DISPLAY);
return success(dpy);
}
catch(std::bad_alloc&)
{
......
......@@ -47,6 +47,9 @@ BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
current->error = EGL_SUCCESS;
current->API = EGL_OPENGL_ES_API;
current->display = EGL_NO_DISPLAY;
current->drawSurface = EGL_NO_SURFACE;
current->readSurface = EGL_NO_SURFACE;
}
}
break;
......@@ -108,6 +111,48 @@ EGLenum getCurrentAPI()
return current->API;
}
void setCurrentDisplay(EGLDisplay dpy)
{
Current *current = (Current*)TlsGetValue(currentTLS);
current->display = dpy;
}
EGLDisplay getCurrentDisplay()
{
Current *current = (Current*)TlsGetValue(currentTLS);
return current->display;
}
void setCurrentDrawSurface(EGLSurface surface)
{
Current *current = (Current*)TlsGetValue(currentTLS);
current->drawSurface = surface;
}
EGLSurface getCurrentDrawSurface()
{
Current *current = (Current*)TlsGetValue(currentTLS);
return current->drawSurface;
}
void setCurrentReadSurface(EGLSurface surface)
{
Current *current = (Current*)TlsGetValue(currentTLS);
current->readSurface = surface;
}
EGLSurface getCurrentReadSurface()
{
Current *current = (Current*)TlsGetValue(currentTLS);
return current->readSurface;
}
}
void error(EGLint errorCode)
......
......@@ -18,6 +18,9 @@ struct Current
{
EGLint error;
EGLenum API;
EGLDisplay display;
EGLSurface drawSurface;
EGLSurface readSurface;
};
void setCurrentError(EGLint error);
......@@ -25,6 +28,15 @@ EGLint getCurrentError();
void setCurrentAPI(EGLenum API);
EGLenum getCurrentAPI();
void setCurrentDisplay(EGLDisplay dpy);
EGLDisplay getCurrentDisplay();
void setCurrentDrawSurface(EGLSurface surface);
EGLSurface getCurrentDrawSurface();
void setCurrentReadSurface(EGLSurface surface);
EGLSurface getCurrentReadSurface();
}
void error(EGLint errorCode);
......
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