<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Mar 16, 2016 at 10:01 PM, Kenneth Graunke <span dir="ltr"><<a href="mailto:kenneth@whitecape.org" target="_blank">kenneth@whitecape.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Stencil texturing is required by ES 3.1.  Apparently we never actually<br>
turned it on, and we missed some necessary code.<br>
<br>
Fixes nine dEQP-GLES31.functional tests:<br>
<br>
stencil_texturing.format.stencil_index8_2d<br>
texture.border_clamp.formats.stencil_index8.nearest_size_pot<br>
texture.border_clamp.formats.stencil_index8.nearest_size_npot<br>
texture.border_clamp.formats.stencil_index8.gather_size_pot<br>
texture.border_clamp.formats.stencil_index8.gather_size_npot<br>
texture.border_clamp.unused_channels.stencil_index8<br>
state_query.internal_format.renderbuffer.stencil_index8_samples<br>
state_query.internal_format.texture_2d_multisample.stencil_index8_samples<br>
state_query.internal_format.texture_2d_multisample_array.stencil_index8_samples<br>
<br>
For now, leave it turned off in desktop GL.  There are still bugs with<br>
stencil array textures, and I suspect there are multisampling bugs too.<br>
<br>
</span>v2: Don't trip the assert.<br>
<span class=""><br>
Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
</span> src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c | 5 ++---<br>
<span class=""> src/mesa/drivers/dri/i965/brw_surface_formats.c   | 1 +<br>
 src/mesa/drivers/dri/i965/intel_extensions.c      | 2 ++<br>
 src/mesa/main/texformat.c                         | 5 +++++<br>
</span> 4 files changed, 10 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c<br>
index 5b0c2e9..aefa7b5 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c<br>
@@ -435,8 +435,7 @@ brw_meta_stencil_blit(struct brw_context *brw,<br>
     * returns a valid format.  When we properly support the extension, we<br>
     * should remove this.<br>
     */<br>
-   assert(ctx->Extensions.ARB_texture_stencil8 == false);<br>
-   ctx->Extensions.ARB_texture_stencil8 = true;<br>
+   bool save_stencil8_enable = ctx->Extensions.ARB_texture_stencil8;<br></blockquote><div><br></div><div>Did you intend to drop the line where we force-enable the extension?  I understand saving it off, but we should probably still force it on if you're only going to enable it for ES. <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">    drawFb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);<br>
    if (drawFb == NULL) {<br>
@@ -479,7 +478,7 @@ brw_meta_stencil_blit(struct brw_context *brw,<br>
    _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);<br>
<br>
 error:<br>
-   ctx->Extensions.ARB_texture_stencil8 = false;<br>
+   ctx->Extensions.ARB_texture_stencil8 = save_stencil8_enable;<br>
    _mesa_meta_fb_tex_blit_end(ctx, target, &blit);<br>
    _mesa_meta_end(ctx);<br>
<div class="HOEnZb"><div class="h5"><br>
diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c<br>
index 3c0b23b..a1160d9 100644<br>
--- a/src/mesa/drivers/dri/i965/brw_surface_formats.c<br>
+++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c<br>
@@ -718,6 +718,7 @@ brw_init_surface_formats(struct brw_context *brw)<br>
    ctx->TextureFormatSupported[MESA_FORMAT_Z24_UNORM_X8_UINT] = true;<br>
    ctx->TextureFormatSupported[MESA_FORMAT_Z_FLOAT32] = true;<br>
    ctx->TextureFormatSupported[MESA_FORMAT_Z32_FLOAT_S8X24_UINT] = true;<br>
+   ctx->TextureFormatSupported[MESA_FORMAT_S_UINT8] = true;<br>
<br>
    /* Benchmarking shows that Z16 is slower than Z24, so there's no reason to<br>
     * use it unless you're under memory (not memory bandwidth) pressure.<br>
diff --git a/src/mesa/drivers/dri/i965/intel_extensions.c b/src/mesa/drivers/dri/i965/intel_extensions.c<br>
index 60ac124..8d9dab5 100644<br>
--- a/src/mesa/drivers/dri/i965/intel_extensions.c<br>
+++ b/src/mesa/drivers/dri/i965/intel_extensions.c<br>
@@ -367,6 +367,8 @@ intelInitExtensions(struct gl_context *ctx)<br>
<br>
    if (brw->gen >= 8) {<br>
       ctx->Extensions.ARB_stencil_texturing = true;<br>
+      if (ctx->API == API_OPENGLES2)<br>
+         ctx->Extensions.ARB_texture_stencil8 = true;<br>
    }<br>
<br>
    if (brw->gen >= 9) {<br>
diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c<br>
index 419fd78..be2581b 100644<br>
--- a/src/mesa/main/texformat.c<br>
+++ b/src/mesa/main/texformat.c<br>
@@ -765,6 +765,11 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,<br>
       RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM);<br>
       break;<br>
<br>
+   case GL_STENCIL_INDEX:<br>
+   case GL_STENCIL_INDEX8:<br>
+      RETURN_IF_SUPPORTED(MESA_FORMAT_S_UINT8);<br>
+      break;<br>
+<br></div></div></blockquote><div><br></div><div>This should really go in its own patch.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">
    default:<br>
       /* For non-generic compressed format we assert two things:<br>
        *<br>
--<br>
2.7.3<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</div></div></blockquote></div><br></div></div>