wgl: Fix depth/stencil image support when using zink kopper

Kopper requires that any depth/stencil images are created through winsys which
was not taken into account by the WGL frontend causing it to hit an assert:
'Assertion failed: ctx->fb_state.zsbuf->texture->bind & PIPE_BIND_DISPLAY_TARGET'

fixes #9256
cc: mesa-stable

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24055>
(cherry picked from commit d3662ba461)
This commit is contained in:
Billy Laws 2023-06-29 22:59:29 +01:00 committed by Eric Engestrom
parent 9409ec0332
commit 512e830f8b
3 changed files with 14 additions and 2 deletions

View file

@ -2317,7 +2317,7 @@
"description": "wgl: Fix depth/stencil image support when using zink kopper",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -204,7 +204,8 @@ stw_pixelformat_add(struct stw_device *stw_dev,
/*
* since gallium frontend can allocate depth/stencil/accum buffers, we provide
* only color buffers here
* only color buffers here in the non-zink case, however in the zink case
* kopper requires that we allocate depth/stencil through the winsys
*/
pfi->stvis.buffer_mask = ST_ATTACHMENT_FRONT_LEFT_MASK;
if (doublebuffer)
@ -213,6 +214,11 @@ stw_pixelformat_add(struct stw_device *stw_dev,
pfi->stvis.color_format = color->format;
pfi->stvis.depth_stencil_format = depth->format;
#ifdef GALLIUM_ZINK
if (stw_dev->zink && (depth->bits.depth > 0 || depth->bits.stencil > 0))
pfi->stvis.buffer_mask |= ST_ATTACHMENT_DEPTH_STENCIL_MASK;
#endif
pfi->stvis.accum_format = (accum) ?
PIPE_FORMAT_R16G16B16A16_SNORM : PIPE_FORMAT_NONE;

View file

@ -227,6 +227,12 @@ stw_st_framebuffer_validate_locked(struct st_context *st,
case ST_ATTACHMENT_DEPTH_STENCIL:
format = stwfb->stvis.depth_stencil_format;
bind = PIPE_BIND_DEPTH_STENCIL;
#ifdef GALLIUM_ZINK
if (stw_dev->zink)
bind |= PIPE_BIND_DISPLAY_TARGET;
#endif
break;
default:
format = PIPE_FORMAT_NONE;