[Mesa-dev] [PATCH] i965: Momentarily pretend to support ARB_texture_stencil8 for blits.
Kenneth Graunke
kenneth at whitecape.org
Tue Jun 9 15:18:48 PDT 2015
Broadwell's stencil blitting code attempts to bind a renderbuffer as a
texture, using dd->BindRenderbufferTexImage().
This calls _mesa_init_teximage_fields(), which then attempts to set
img->_BaseFormat = _mesa_base_tex_format(ctx, internalFormat), which
assert fails if internalFormat is GL_STENCIL_INDEX8 but
ARB_texture_stencil8 is unsupported.
To work around this, just pretend to support the extension momentarily,
during the blit. Meta has already munged a variety of other things in
the context (including the API!), so it's not that much worse than what
we're already doing.
Fixes regressions since commit f7aad9da20b13c98f77d6a690b327716f39c0a47
(mesa/teximage: use correct extension for accept stencil texture.).
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Cc: airlied at gmail.com
Cc: imirkin at alum.mit.edu
---
src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c | 2 ++
1 file changed, 2 insertions(+)
Here's a brown paper bag fix. I had apparently run all of Piglit with Dave's
patch in place, but I'd accidentally built Mesa with "--enable-debuga", so
no assertions.
I think this is the best thing to do for now. Alternatives would be:
1. Delete the assertion in _mesa_init_teximage_fields() [very lame]
2. Make intel_bind_renderbuffer_tex_image lie about the formats and
then fix them up. [seems like more work]
3. Just enable the extension
[I don't want to do this without consulting Topi, and he's on vacation]
[would also need a lot of testing...]
*shrug*. This works. It's easy.
diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
index fc7018d..4a33de9 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -414,6 +414,7 @@ brw_meta_stencil_blit(struct brw_context *brw,
GLenum target;
_mesa_meta_fb_tex_blit_begin(ctx, &blit);
+ ctx->Extensions.ARB_texture_stencil8 = true;
_mesa_GenFramebuffers(1, &fbo);
/* Force the surface to be configured for level zero. */
@@ -451,6 +452,7 @@ brw_meta_stencil_blit(struct brw_context *brw,
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
error:
+ ctx->Extensions.ARB_texture_stencil8 = false;
_mesa_meta_fb_tex_blit_end(ctx, target, &blit);
_mesa_meta_end(ctx);
--
2.4.2
More information about the mesa-dev
mailing list