summaryrefslogtreecommitdiffstats
path: root/src/egl
diff options
context:
space:
mode:
authorChia-I Wu <olvaffe@gmail.com>2009-09-27 17:00:51 +0800
committerBrian Paul <brianp@vmware.com>2009-09-29 08:10:48 -0600
commitd845f2754bb8c0677323a5922cb90f9ea42bdb1f (patch)
tree533866d53b7547f9eba5bee51096d03bed88b497 /src/egl
parent55893b9439754c5213a9c182ee84f6c2554a0281 (diff)
downloadexternal_mesa3d-d845f2754bb8c0677323a5922cb90f9ea42bdb1f.zip
external_mesa3d-d845f2754bb8c0677323a5922cb90f9ea42bdb1f.tar.gz
external_mesa3d-d845f2754bb8c0677323a5922cb90f9ea42bdb1f.tar.bz2
egl: Add support for querying render buffer.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Diffstat (limited to 'src/egl')
-rw-r--r--src/egl/main/eglcontext.c40
-rw-r--r--src/egl/main/eglcontext.h3
2 files changed, 36 insertions, 7 deletions
diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c
index b094f49..ee4b1b5 100644
--- a/src/egl/main/eglcontext.c
+++ b/src/egl/main/eglcontext.c
@@ -45,6 +45,7 @@ _eglInitContext(_EGLDriver *drv, _EGLContext *ctx,
ctx->DrawSurface = EGL_NO_SURFACE;
ctx->ReadSurface = EGL_NO_SURFACE;
ctx->ClientAPI = api;
+ ctx->WindowRenderBuffer = EGL_NONE;
return EGL_TRUE;
}
@@ -87,6 +88,24 @@ _eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx)
}
+#ifdef EGL_VERSION_1_2
+static EGLint
+_eglQueryContextRenderBuffer(_EGLContext *ctx)
+{
+ _EGLSurface *surf = ctx->DrawSurface;
+ EGLint rb;
+
+ if (!surf)
+ return EGL_NONE;
+ if (surf->Type == EGL_WINDOW_BIT && ctx->WindowRenderBuffer != EGL_NONE)
+ rb = ctx->WindowRenderBuffer;
+ else
+ rb = surf->RenderBuffer;
+ return rb;
+}
+#endif /* EGL_VERSION_1_2 */
+
+
EGLBoolean
_eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c,
EGLint attribute, EGLint *value)
@@ -94,22 +113,29 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c,
(void) drv;
(void) dpy;
+ if (!value)
+ return _eglError(EGL_BAD_PARAMETER, "eglQueryContext");
+
switch (attribute) {
case EGL_CONFIG_ID:
*value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID);
- return EGL_TRUE;
+ break;
+ case EGL_CONTEXT_CLIENT_VERSION:
+ *value = c->ClientVersion;
+ break;
#ifdef EGL_VERSION_1_2
case EGL_CONTEXT_CLIENT_TYPE:
*value = c->ClientAPI;
- return EGL_TRUE;
+ break;
+ case EGL_RENDER_BUFFER:
+ *value = _eglQueryContextRenderBuffer(c);
+ break;
#endif /* EGL_VERSION_1_2 */
- case EGL_CONTEXT_CLIENT_VERSION:
- *value = c->ClientVersion;
- return EGL_TRUE;
default:
- _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
- return EGL_FALSE;
+ return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext");
}
+
+ return EGL_TRUE;
}
diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h
index 647f244..45c7b47 100644
--- a/src/egl/main/eglcontext.h
+++ b/src/egl/main/eglcontext.h
@@ -24,6 +24,9 @@ struct _egl_context
EGLint ClientAPI; /**< EGL_OPENGL_ES_API, EGL_OPENGL_API, EGL_OPENVG_API */
EGLint ClientVersion; /**< 1 = OpenGLES 1.x, 2 = OpenGLES 2.x */
+
+ /* The real render buffer when a window surface is bound */
+ EGLint WindowRenderBuffer;
};