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>
This commit is contained in:
Connor Abbott 2022-06-22 00:15:44 +02:00 committed by Marge Bot
parent 8183a728a2
commit 75724fe119
3 changed files with 5 additions and 15 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;