From 3a6984bbc077d656fff401144986bfd40b4062bf Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Wed, 14 Sep 2022 10:04:59 -0400 Subject: [PATCH] zink: add stencil border color clamping fixes (tu): dEQP-GLES31.functional.texture.border_clamp.range_clamp.nearest_uint_stencil dEQP-GLES31.functional.texture.border_clamp.range_clamp.nearest_float_depth_uint_stencil_sample_stencil dEQP-GLES31.functional.texture.border_clamp.range_clamp.nearest_unorm_depth_uint_stencil_sample_stencil Reviewed-by: Emma Anholt Part-of: --- src/gallium/drivers/zink/zink_context.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/zink/zink_context.c b/src/gallium/drivers/zink/zink_context.c index ea9ab4b6ebb..fce06e42944 100644 --- a/src/gallium/drivers/zink/zink_context.c +++ b/src/gallium/drivers/zink/zink_context.c @@ -423,12 +423,15 @@ zink_create_sampler_state(struct pipe_context *pctx, memcpy(&cbci.customBorderColor, &state->border_color, sizeof(union pipe_color_union)); } else { if (util_format_is_depth_or_stencil(state->border_color_format)) { - if (is_integer) + if (is_integer) { cbci.format = VK_FORMAT_S8_UINT; - else + for (unsigned i = 0; i < 4; i++) + cbci.customBorderColor.uint32[i] = CLAMP(state->border_color.ui[i], 0, 255); + } else { cbci.format = zink_get_format(screen, util_format_get_depth_only(state->border_color_format)); - /* these are identical unions */ - memcpy(&cbci.customBorderColor, &state->border_color, sizeof(union pipe_color_union)); + /* these are identical unions */ + memcpy(&cbci.customBorderColor, &state->border_color, sizeof(union pipe_color_union)); + } } else { cbci.format = zink_get_format(screen, state->border_color_format); for (unsigned i = 0; i < 4; i++) {