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 <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18598>
This commit is contained in:
Mike Blumenkrantz 2022-09-14 10:04:59 -04:00 committed by Marge Bot
parent 95d4faea49
commit 3a6984bbc0

View file

@ -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++) {