[Mesa-dev] [PATCH 1/2] st/mesa: help fix stencil border color for GL_DEPTH_STENCIL textures

Marek Olšák maraeo at gmail.com
Tue Aug 21 03:20:05 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

GL_STENCIL_INDEX uses GL_INTENSITY for the border color, which is nicer
to hardware that doesn't read the stencil border value from the X channel.

This fixes a bunch of dEQP tests on Vega & Raven.

Cc: 18.1 18.2 <mesa-stable at lists.freedesktop.org>
---
 src/mesa/state_tracker/st_atom_sampler.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c
index 289856cd72d..27e4da31581 100644
--- a/src/mesa/state_tracker/st_atom_sampler.c
+++ b/src/mesa/state_tracker/st_atom_sampler.c
@@ -156,20 +156,23 @@ st_convert_sampler(const struct st_context *st,
    /* For non-black borders... */
    if (/* This is true if wrap modes are using the border color: */
        (sampler->wrap_s | sampler->wrap_t | sampler->wrap_r) & 0x1 &&
        (msamp->BorderColor.ui[0] ||
         msamp->BorderColor.ui[1] ||
         msamp->BorderColor.ui[2] ||
         msamp->BorderColor.ui[3])) {
       const GLboolean is_integer = texobj->_IsIntegerFormat;
       GLenum texBaseFormat = _mesa_base_tex_image(texobj)->_BaseFormat;
 
+      if (texobj->StencilSampling)
+         texBaseFormat = GL_STENCIL_INDEX;
+
       if (st->apply_texture_swizzle_to_border_color) {
          const struct st_texture_object *stobj = st_texture_object_const(texobj);
          /* XXX: clean that up to not use the sampler view at all */
          const struct st_sampler_view *sv = st_texture_get_current_sampler_view(st, stobj);
 
          if (sv) {
             struct pipe_sampler_view *view = sv->view;
             union pipe_color_union tmp;
             const unsigned char swz[4] =
             {
-- 
2.17.1



More information about the mesa-dev mailing list