From 949a760c9f5a33344b95dd591f0ab4d8a03832bc Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 28 Nov 2022 21:30:49 -0500 Subject: [PATCH] asahi: Fix Z32S8 harder Fixes dEQP-GLES3.functional.texture.format.sized.2d.depth32f_stencil8_pot after stencil texturing broke it. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index ae140c2..8caa4aa 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -624,11 +624,19 @@ agx_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *texture = orig_texture; enum pipe_format format = state->format; - /* Use stencil attachment, separate stencil always used on G13 */ - if (rsrc->separate_stencil) { - rsrc = rsrc->separate_stencil; - texture = &rsrc->base; - format = texture->format; + const struct util_format_description *desc = util_format_description(format); + + /* Separate stencil always used on G13, so we need to fix up for Z32S8 */ + if (util_format_has_stencil(desc) && rsrc->separate_stencil) { + if (util_format_has_depth(desc)) { + /* Reinterpret as the depth-only part */ + format = util_format_get_depth_only(format); + } else { + /* Use the stencil-only-part */ + rsrc = rsrc->separate_stencil; + texture = &rsrc->base; + format = texture->format; + } } /* Save off the resource that we actually use, with the stencil fixed up */ -- 2.7.4