[Mesa-dev] [PATCH] i965: Fix stencil texturing in ES 3.1.

Kenneth Graunke kenneth at whitecape.org
Thu Mar 17 02:25:56 UTC 2016


Stencil texturing is required by ES 3.1.  Apparently we never actually
turned it on, and we missed some necessary code.

Fixes nine dEQP-GLES31.functional tests:

stencil_texturing.format.stencil_index8_2d
texture.border_clamp.formats.stencil_index8.nearest_size_pot
texture.border_clamp.formats.stencil_index8.nearest_size_npot
texture.border_clamp.formats.stencil_index8.gather_size_pot
texture.border_clamp.formats.stencil_index8.gather_size_npot
texture.border_clamp.unused_channels.stencil_index8
state_query.internal_format.renderbuffer.stencil_index8_samples
state_query.internal_format.texture_2d_multisample.stencil_index8_samples
state_query.internal_format.texture_2d_multisample_array.stencil_index8_samples

For now, leave it turned off in desktop GL.  There are still bugs with
stencil array textures, and I suspect there are multisampling bugs too.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
---
 src/mesa/drivers/dri/i965/brw_surface_formats.c | 1 +
 src/mesa/drivers/dri/i965/intel_extensions.c    | 2 ++
 src/mesa/main/texformat.c                       | 5 +++++
 3 files changed, 8 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c
index 3c0b23b..a1160d9 100644
--- a/src/mesa/drivers/dri/i965/brw_surface_formats.c
+++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c
@@ -718,6 +718,7 @@ brw_init_surface_formats(struct brw_context *brw)
    ctx->TextureFormatSupported[MESA_FORMAT_Z24_UNORM_X8_UINT] = true;
    ctx->TextureFormatSupported[MESA_FORMAT_Z_FLOAT32] = true;
    ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = true;
+   ctx->TextureFormatSupported[MESA_FORMAT_S_UINT8] = true;
 
    /* Benchmarking shows that Z16 is slower than Z24, so there's no reason to
     * use it unless you're under memory (not memory bandwidth) pressure.
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c
index 60ac124..8d9dab5 100644
--- a/src/mesa/drivers/dri/i965/intel_extensions.c
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c
@@ -367,6 +367,8 @@ intelInitExtensions(struct gl_context *ctx)
 
    if (brw->gen >= 8) {
       ctx->Extensions.ARB_stencil_texturing = true;
+      if (ctx->API == API_OPENGLES2)
+         ctx->Extensions.ARB_texture_stencil8 = true;
    }
 
    if (brw->gen >= 9) {
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c
index 419fd78..be2581b 100644
--- a/src/mesa/main/texformat.c
+++ b/src/mesa/main/texformat.c
@@ -765,6 +765,11 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);
       break;
 
+   case GL_STENCIL_INDEX:
+   case GL_STENCIL_INDEX8:
+      RETURN_IF_SUPPORTED(MESA_FORMAT_S_UINT8);
+      break;
+
    default:
       /* For non-generic compressed format we assert two things:
        *
-- 
2.7.3



More information about the mesa-dev mailing list