wgl: Pass smapi explicitly to context creation

Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Acked-by: Sidney Just <justsid@x-plane.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Tested-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12964>
This commit is contained in:
Jesse Natalie 2021-09-21 08:39:23 -07:00 committed by Marge Bot
parent d57a4abcf8
commit f5b1824ce3
5 changed files with 17 additions and 3 deletions

View file

@ -218,7 +218,9 @@ wgl_initialize_impl(_EGLDisplay *disp, HDC hdc)
goto cleanup;
}
wgl_dpy->screen = stw_get_device()->screen;
struct stw_device *stw_dev = stw_get_device();
wgl_dpy->screen = stw_dev->screen;
wgl_dpy->smapi = stw_dev->smapi;
disp->ClientAPIs = 0;
if (_eglIsApiValid(EGL_OPENGL_API))
@ -443,6 +445,7 @@ wgl_create_context(_EGLDisplay *disp, _EGLConfig *conf,
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_dpy->smapi,
wgl_ctx->base.ClientMajorVersion,
wgl_ctx->base.ClientMinorVersion,
flags,

View file

@ -35,6 +35,7 @@ struct wgl_egl_display
{
int ref_count;
struct pipe_screen *screen;
struct st_manager *smapi;
};
struct wgl_egl_config

View file

@ -126,7 +126,10 @@ DrvCreateContext(HDC hdc)
DHGLRC APIENTRY
DrvCreateLayerContext(HDC hdc, INT iLayerPlane)
{
struct stw_context *ctx = stw_create_context_attribs(hdc, iLayerPlane, 0, 1, 0, 0,
if (!stw_dev)
return 0;
struct stw_context *ctx = stw_create_context_attribs(hdc, iLayerPlane, NULL, stw_dev->smapi, 1, 0, 0,
WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
0, WGL_NO_RESET_NOTIFICATION_ARB);
if (!ctx)
@ -165,6 +168,7 @@ get_matching_pixel_format(HDC hdc)
*/
struct stw_context *
stw_create_context_attribs(HDC hdc, INT iLayerPlane, struct stw_context *shareCtx,
struct st_manager *smapi,
int majorVersion, int minorVersion,
int contextFlags, int profileMask,
int iPixelFormat, int resetStrategy)
@ -279,7 +283,7 @@ stw_create_context_attribs(HDC hdc, INT iLayerPlane, struct stw_context *shareCt
attribs.options = stw_dev->st_options;
ctx->st = stw_dev->stapi->create_context(stw_dev->stapi,
stw_dev->smapi, &attribs, &ctx_err, shareCtx ? shareCtx->st : NULL);
smapi, &attribs, &ctx_err, shareCtx ? shareCtx->st : NULL);
if (ctx->st == NULL)
goto no_st_ctx;

View file

@ -35,6 +35,7 @@
struct hud_context;
struct stw_framebuffer;
struct st_context_iface;
struct st_manager;
struct stw_context
{
@ -53,6 +54,7 @@ struct stw_context
struct stw_context *stw_create_context_attribs(HDC hdc, INT iLayerPlane,
struct stw_context *shareCtx,
struct st_manager *smapi,
int majorVersion, int minorVersion,
int contextFlags, int profileMask,
int iPixelFormat, int resetStrategy);

View file

@ -83,6 +83,9 @@ wglCreateContextAttribsARB(HDC hDC, HGLRC hShareContext, const int *attribList)
WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB |
WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB);
if (!stw_dev)
return NULL;
/* parse attrib_list */
if (attribList) {
for (i = 0; !done && attribList[i]; i++) {
@ -211,6 +214,7 @@ wglCreateContextAttribsARB(HDC hDC, HGLRC hShareContext, const int *attribList)
struct stw_context *share_stw = stw_lookup_context(share_dhglrc);
struct stw_context *stw_ctx = stw_create_context_attribs(hDC, layerPlane, share_stw,
stw_dev->smapi,
majorVersion, minorVersion,
contextFlags, profileMask, 0,
resetStrategy);