[Mesa-dev] [PATCH 02/22] i965/gen8: Follow stencil meta blit overrides in the context
Topi Pohjolainen
topi.pohjolainen at intel.com
Mon Jun 9 00:45:36 PDT 2014
Hardware before gen8 does not have full stencil texturing support and
therefore the signaling for stencil index mode cannot be done through
the texture itself - but via driver specific context instead.
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c | 3 ---
src/mesa/drivers/dri/i965/brw_state.h | 10 ++++++++++
src/mesa/drivers/dri/i965/gen8_surface_state.c | 2 +-
3 files changed, 11 insertions(+), 4 deletions(-)
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 cc7fdbe..f505b62 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -430,9 +430,6 @@ brw_meta_stencil_blit(struct brw_context *brw,
set_read_rb_tex_image(brw, &blit, &target);
- _mesa_TexParameteri(target, GL_DEPTH_STENCIL_TEXTURE_MODE,
- GL_STENCIL_INDEX);
-
prog = setup_program(ctx, target != GL_TEXTURE_2D);
setup_bounding_rect(prog, orig_dims);
setup_drawing_rect(prog, &dims);
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index c52a977..c680763 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -212,6 +212,16 @@ void brw_configure_w_tiled(const struct intel_mipmap_tree *mt,
unsigned *pitch, uint32_t *tiling,
unsigned *format);
+static inline bool
+brw_use_stencil_index_mode(const struct brw_context *brw,
+ struct gl_texture_object *tex_obj)
+{
+ const struct gl_texture_image *img = tex_obj->Image[0][tex_obj->BaseLevel];
+
+ return (tex_obj->StencilSampling && img->_BaseFormat == GL_DEPTH_STENCIL) ||
+ (brw->meta_blit.is_active && brw->meta_blit.use_stencil_index_mode);
+}
+
uint32_t brw_format_for_mesa_format(mesa_format mesa_format);
GLuint translate_tex_target(GLenum target);
diff --git a/src/mesa/drivers/dri/i965/gen8_surface_state.c b/src/mesa/drivers/dri/i965/gen8_surface_state.c
index 406f68e..cd2fb40 100644
--- a/src/mesa/drivers/dri/i965/gen8_surface_state.c
+++ b/src/mesa/drivers/dri/i965/gen8_surface_state.c
@@ -141,7 +141,7 @@ gen8_update_texture_surface(struct gl_context *ctx,
return;
}
- if (tObj->StencilSampling && firstImage->_BaseFormat == GL_DEPTH_STENCIL) {
+ if (brw_use_stencil_index_mode(brw, tObj)) {
mt = mt->stencil_mt;
format = MESA_FORMAT_S_UINT8;
}
--
1.8.3.1
More information about the mesa-dev
mailing list