mirror of
https://gitee.com/openharmony/third_party_mesa3d
synced 2024-11-27 01:20:36 +00:00
wgl: Implement WGL_ARB_create_context_robustness
Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Bill Kristiansen <billkris@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15002>
This commit is contained in:
parent
a2c9e1cb50
commit
06ae10bb92
@ -0,0 +1 @@
|
||||
WGL_ARB_create_context_robustness
|
@ -445,12 +445,16 @@ wgl_create_context(_EGLDisplay *disp, _EGLConfig *conf,
|
||||
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
|
||||
if (wgl_ctx->base.Flags & EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR)
|
||||
flags |= WGL_CONTEXT_DEBUG_BIT_ARB;
|
||||
unsigned resetStrategy = WGL_NO_RESET_NOTIFICATION_ARB;
|
||||
if (wgl_ctx->base.ResetNotificationStrategy != EGL_NO_RESET_NOTIFICATION)
|
||||
resetStrategy = WGL_LOSE_CONTEXT_ON_RESET_ARB;
|
||||
wgl_ctx->ctx = stw_create_context_attribs(disp->PlatformDisplay, 0, shared,
|
||||
wgl_ctx->base.ClientMajorVersion,
|
||||
wgl_ctx->base.ClientMinorVersion,
|
||||
flags,
|
||||
profile_mask,
|
||||
stw_config->iPixelFormat);
|
||||
stw_config->iPixelFormat,
|
||||
resetStrategy);
|
||||
|
||||
if (!wgl_ctx->ctx)
|
||||
goto cleanup;
|
||||
|
@ -128,7 +128,7 @@ DrvCreateLayerContext(HDC hdc, INT iLayerPlane)
|
||||
{
|
||||
struct stw_context *ctx = stw_create_context_attribs(hdc, iLayerPlane, 0, 1, 0, 0,
|
||||
WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||
0);
|
||||
0, WGL_NO_RESET_NOTIFICATION_ARB);
|
||||
if (!ctx)
|
||||
return 0;
|
||||
|
||||
@ -167,7 +167,7 @@ struct stw_context *
|
||||
stw_create_context_attribs(HDC hdc, INT iLayerPlane, struct stw_context *shareCtx,
|
||||
int majorVersion, int minorVersion,
|
||||
int contextFlags, int profileMask,
|
||||
int iPixelFormat)
|
||||
int iPixelFormat, int resetStrategy)
|
||||
{
|
||||
const struct stw_pixelformat_info *pfi;
|
||||
struct st_context_attribs attribs;
|
||||
@ -226,6 +226,10 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, struct stw_context *shareCt
|
||||
attribs.flags |= ST_CONTEXT_FLAG_FORWARD_COMPATIBLE;
|
||||
if (contextFlags & WGL_CONTEXT_DEBUG_BIT_ARB)
|
||||
attribs.flags |= ST_CONTEXT_FLAG_DEBUG;
|
||||
if (contextFlags & WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB)
|
||||
attribs.flags |= ST_CONTEXT_FLAG_ROBUST_ACCESS;
|
||||
if (resetStrategy != WGL_NO_RESET_NOTIFICATION_ARB)
|
||||
attribs.flags |= ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED;
|
||||
|
||||
switch (profileMask) {
|
||||
case WGL_CONTEXT_CORE_PROFILE_BIT_ARB:
|
||||
|
@ -53,7 +53,7 @@ struct stw_context *stw_create_context_attribs(HDC hdc, INT iLayerPlane,
|
||||
struct stw_context *shareCtx,
|
||||
int majorVersion, int minorVersion,
|
||||
int contextFlags, int profileMask,
|
||||
int iPixelFormat);
|
||||
int iPixelFormat, int resetStrategy);
|
||||
|
||||
DHGLRC stw_create_context_handle(struct stw_context *context, DHGLRC handle);
|
||||
|
||||
|
@ -76,10 +76,12 @@ wglCreateContextAttribsARB(HDC hDC, HGLRC hShareContext, const int *attribList)
|
||||
int majorVersion = 1, minorVersion = 0, layerPlane = 0;
|
||||
int contextFlags = 0x0;
|
||||
int profileMask = WGL_CONTEXT_CORE_PROFILE_BIT_ARB;
|
||||
int resetStrategy = WGL_NO_RESET_NOTIFICATION_ARB;
|
||||
int i;
|
||||
BOOL done = FALSE;
|
||||
const int contextFlagsAll = (WGL_CONTEXT_DEBUG_BIT_ARB |
|
||||
WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB);
|
||||
WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB |
|
||||
WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB);
|
||||
|
||||
/* parse attrib_list */
|
||||
if (attribList) {
|
||||
@ -100,6 +102,9 @@ wglCreateContextAttribsARB(HDC hDC, HGLRC hShareContext, const int *attribList)
|
||||
case WGL_CONTEXT_PROFILE_MASK_ARB:
|
||||
profileMask = attribList[++i];
|
||||
break;
|
||||
case WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB:
|
||||
resetStrategy = attribList[++i];
|
||||
break;
|
||||
case 0:
|
||||
/* end of list */
|
||||
done = TRUE;
|
||||
@ -150,6 +155,12 @@ wglCreateContextAttribsARB(HDC hDC, HGLRC hShareContext, const int *attribList)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (resetStrategy != WGL_NO_RESET_NOTIFICATION_ARB &&
|
||||
resetStrategy != WGL_LOSE_CONTEXT_ON_RESET_ARB) {
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get pointer to OPENGL32.DLL's wglCreate/DeleteContext() functions */
|
||||
if (!wglCreateContext_func || !wglDeleteContext_func) {
|
||||
/* Get the OPENGL32.DLL library */
|
||||
@ -201,7 +212,8 @@ wglCreateContextAttribsARB(HDC hDC, HGLRC hShareContext, const int *attribList)
|
||||
|
||||
struct stw_context *stw_ctx = stw_create_context_attribs(hDC, layerPlane, share_stw,
|
||||
majorVersion, minorVersion,
|
||||
contextFlags, profileMask, 0);
|
||||
contextFlags, profileMask, 0,
|
||||
resetStrategy);
|
||||
|
||||
if (!stw_ctx) {
|
||||
wglDeleteContext_func(context);
|
||||
|
@ -37,6 +37,7 @@
|
||||
static const char *stw_extension_string =
|
||||
"WGL_ARB_create_context "
|
||||
"WGL_ARB_create_context_profile "
|
||||
"WGL_ARB_create_context_robustness "
|
||||
"WGL_ARB_extensions_string "
|
||||
"WGL_ARB_make_current_read "
|
||||
"WGL_ARB_multisample "
|
||||
|
Loading…
Reference in New Issue
Block a user