summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-05-30 15:23:03 -0600
committerBrian Paul <[email protected]>2008-06-04 08:57:15 -0600
commit4ebfc3c8ffccadaed98c4e032b7691eaf299b0bc (patch)
tree09091052d9650580512939275001e16b8f4b76b4
parentb98ac1d47257bf7b2661ae7c1a8904b7bc5d623c (diff)
egl: prototype some multi-API code
-rw-r--r--src/gallium/winsys/egl_xlib/egl_xlib.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c
index 99389970f55..ce3a0ae0daa 100644
--- a/src/gallium/winsys/egl_xlib/egl_xlib.c
+++ b/src/gallium/winsys/egl_xlib/egl_xlib.c
@@ -313,19 +313,21 @@ xlib_eglCreateContext(_EGLDriver *drv, EGLDisplay dpy, EGLConfig config,
return EGL_NO_CONTEXT;
}
- if (ctx->Base.ClientAPI != EGL_OPENGL_API) {
- _eglError(EGL_BAD_MATCH, "eglCreateContext(only OpenGL API supported)");
+ /* API-dependent context creation */
+ switch (ctx->Base.ClientAPI) {
+ case EGL_OPENGL_API:
+ /* create a softpipe context */
+ ctx->pipe = softpipe_create(xdrv->screen, xdrv->winsys, NULL);
+ /* Now do xlib / state tracker inits here */
+ _eglConfigToContextModesRec(conf, &visual);
+ ctx->Context = st_create_context(ctx->pipe, &visual, share_ctx);
+ break;
+ default:
+ _eglError(EGL_BAD_MATCH, "eglCreateContext(unsupported API)");
free(ctx);
return EGL_NO_CONTEXT;
}
- /* create a softpipe context */
- ctx->pipe = softpipe_create(xdrv->screen, xdrv->winsys, NULL);
-
- /* Now do xlib / state tracker inits here */
- _eglConfigToContextModesRec(conf, &visual);
- ctx->Context = st_create_context(ctx->pipe, &visual, share_ctx);
-
_eglSaveContext(&ctx->Base);
return _eglGetContextHandle(&ctx->Base);
@@ -341,7 +343,14 @@ xlib_eglDestroyContext(_EGLDriver *drv, EGLDisplay dpy, EGLContext ctx)
context->Base.DeletePending = EGL_TRUE;
}
else {
- st_destroy_context(context->Context);
+ /* API-dependent clean-up */
+ switch (context->Base.ClientAPI) {
+ case EGL_OPENGL_API:
+ st_destroy_context(context->Context);
+ break;
+ default:
+ assert(0);
+ }
free(context);
}
return EGL_TRUE;