Mesa (main): mesa/st: Fix border color type for stencil sampling
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 29 03:37:28 UTC 2022
Module: Mesa
Branch: main
Commit: 75724fe1190582eabfb10ae7d451a2a72938a721
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=75724fe1190582eabfb10ae7d451a2a72938a721
Author: Connor Abbott <cwabbott0 at gmail.com>
Date: Wed Jun 22 00:15:44 2022 +0200
mesa/st: Fix border color type for stencil sampling
When the stencil aspect of a depth+stencil texture is sampled, it's
actually integer. Also fixup st_translate_color() that assumed it was
float. This fixes the border color on zink+turnip.
v2: Add "|| texBaseFormat == GL_STENCIL_INDEX" to catch the case where
S8 is emulated as D24S8.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17177>
---
src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt | 12 ------------
src/mesa/state_tracker/st_atom_sampler.c | 4 +++-
src/mesa/state_tracker/st_format.c | 4 ++--
3 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt b/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt
index f1a76fb9ea7..91560f4ed45 100644
--- a/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt
+++ b/src/gallium/drivers/zink/ci/zink-tu-a630-fails.txt
@@ -24,17 +24,5 @@ KHR-Single-GL46.arrays_of_arrays_gl.SubroutineFunctionCalls2,Crash
KHR-Single-GL46.enhanced_layouts.xfb_capture_inactive_output_block_member,Fail
KHR-Single-GL46.enhanced_layouts.xfb_capture_struct,Fail
KHR-Single-GL46.enhanced_layouts.xfb_vertex_streams,Fail
-dEQP-GLES31.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_pot,Fail
-dEQP-GLES31.functional.texture.border_clamp.formats.depth32f_stencil8_sample_stencil.nearest_size_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.formats.depth32f_stencil8_sample_stencil.nearest_size_pot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_clamp_to_edge_t_clamp_to_border_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_clamp_to_edge_t_clamp_to_border_pot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_mirrored_repeat_t_clamp_to_border_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_mirrored_repeat_t_clamp_to_border_pot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_repeat_t_clamp_to_border_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_repeat_t_clamp_to_border_pot,Fail
dEQP-GLES31.functional.texture.border_clamp.range_clamp.linear_srgb_color,Fail
dEQP-GLES31.functional.texture.border_clamp.range_clamp.nearest_srgb_color,Fail
-dEQP-GLES31.functional.texture.border_clamp.unused_channels.depth24_stencil8_sample_stencil,Fail
-dEQP-GLES31.functional.texture.border_clamp.unused_channels.depth32f_stencil8_sample_stencil,Fail
diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index cdf267f385c..7aaaa22590b 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -93,8 +93,10 @@ st_convert_sampler(const struct st_context *st,
if (msamp->Attrib.IsBorderColorNonZero &&
/* This is true if wrap modes are using the border color: */
(sampler->wrap_s | sampler->wrap_t | sampler->wrap_r) & 0x1) {
- const GLboolean is_integer = texobj->_IsIntegerFormat;
GLenum texBaseFormat = _mesa_base_tex_image(texobj)->_BaseFormat;
+ const GLboolean is_integer =
+ texobj->_IsIntegerFormat || texobj->StencilSampling ||
+ texBaseFormat == GL_STENCIL_INDEX;
if (texobj->StencilSampling)
texBaseFormat = GL_STENCIL_INDEX;
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 252e0810d0c..978d7fbe23d 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -1557,6 +1557,8 @@ st_translate_color(union pipe_color_union *color,
case GL_LUMINANCE_ALPHA:
ci[1] = ci[2] = ci[0];
break;
+ /* Stencil border is tricky on some hw. Help drivers a little here. */
+ case GL_STENCIL_INDEX:
case GL_INTENSITY:
ci[1] = ci[2] = ci[3] = ci[0];
break;
@@ -1588,8 +1590,6 @@ st_translate_color(union pipe_color_union *color,
case GL_LUMINANCE_ALPHA:
cf[1] = cf[2] = cf[0];
break;
- /* Stencil border is tricky on some hw. Help drivers a little here. */
- case GL_STENCIL_INDEX:
case GL_INTENSITY:
cf[1] = cf[2] = cf[3] = cf[0];
break;
More information about the mesa-commit
mailing list