mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
egl: prototype some multi-API code
This commit is contained in:
parent
b98ac1d472
commit
4ebfc3c8ff
1 changed files with 19 additions and 10 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue