From d3662ba461e15bbefc5f8887bee58e016f69f281 Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Thu, 29 Jun 2023 22:59:29 +0100 Subject: [PATCH] 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: --- src/gallium/frontends/wgl/stw_pixelformat.c | 8 +++++++- src/gallium/frontends/wgl/stw_st.c | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/gallium/frontends/wgl/stw_pixelformat.c b/src/gallium/frontends/wgl/stw_pixelformat.c index 94d3f9844a6..16d00707dde 100644 --- a/src/gallium/frontends/wgl/stw_pixelformat.c +++ b/src/gallium/frontends/wgl/stw_pixelformat.c @@ -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; diff --git a/src/gallium/frontends/wgl/stw_st.c b/src/gallium/frontends/wgl/stw_st.c index 19c8e942472..7db5ebf7f5c 100644 --- a/src/gallium/frontends/wgl/stw_st.c +++ b/src/gallium/frontends/wgl/stw_st.c @@ -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;