[Mesa-dev] [PATCH 14/14] i965: Update cached stencil region pointer when updating draw buffers
chad at chad-versace.us
chad at chad-versace.us
Wed May 4 13:33:58 PDT 2011
From: Chad Versace <chad.versace at intel.com>
That is, update brw_context.state.stencil_region and set the dirty bit
BRW_NEW_STENCIL_BUFFER.
Signed-off-by: Chad Versace <chad.versace at intel.com>
---
src/mesa/drivers/dri/i965/brw_vtbl.c | 8 +++++++-
src/mesa/drivers/dri/intel/intel_buffers.c | 8 ++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c
index 3bb8588..ccd1f8a 100644
--- a/src/mesa/drivers/dri/i965/brw_vtbl.c
+++ b/src/mesa/drivers/dri/i965/brw_vtbl.c
@@ -101,13 +101,19 @@ static void brw_set_draw_region( struct intel_context *intel,
{
struct brw_context *brw = brw_context(&intel->ctx);
- assert(!stencil_region);
+ assert(stencil_region == NULL || intel->has_hiz);
if (brw->state.depth_region != depth_region) {
brw->state.dirty.brw |= BRW_NEW_DEPTH_BUFFER;
intel_region_release(&brw->state.depth_region);
intel_region_reference(&brw->state.depth_region, depth_region);
}
+
+ if (brw->state.stencil_region != stencil_region) {
+ brw->state.dirty.brw |= BRW_NEW_STENCIL_BUFFER;
+ intel_region_release(&brw->state.stencil_region);
+ intel_region_reference(&brw->state.stencil_region, stencil_region);
+ }
}
diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c
index 0857b8a..1a7142e 100644
--- a/src/mesa/drivers/dri/intel/intel_buffers.c
+++ b/src/mesa/drivers/dri/intel/intel_buffers.c
@@ -91,7 +91,9 @@ void
intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb)
{
struct intel_context *intel = intel_context(ctx);
- struct intel_region *colorRegions[MAX_DRAW_BUFFERS], *depthRegion = NULL;
+ struct intel_region *colorRegions[MAX_DRAW_BUFFERS];
+ struct intel_region *depthRegion = NULL;
+ struct intel_region *stencilRegion = NULL; /* Separate stencil region. */
struct intel_renderbuffer *irbDepth = NULL, *irbStencil = NULL;
bool fb_has_hiz = intel_framebuffer_has_hiz(fb);
@@ -194,6 +196,7 @@ intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb)
if (irbStencil && irbStencil->region) {
if (fb_has_hiz) {
assert(irbStencil->Base.Format == MESA_FORMAT_S8);
+ stencilRegion = irbStencil->region;
} else {
assert(irbStencil->Base.Format == MESA_FORMAT_S8_Z24);
}
@@ -214,6 +217,7 @@ intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb)
if (!fb_has_hiz && !depthRegion && irbStencil && irbStencil->region)
depthRegion = irbStencil->region;
+
/*
* Update depth and stencil test state
*/
@@ -232,7 +236,7 @@ intel_draw_buffer(struct gl_context * ctx, struct gl_framebuffer *fb)
intel->NewGLState |= (_NEW_DEPTH | _NEW_STENCIL);
}
- intel->vtbl.set_draw_region(intel, colorRegions, depthRegion, NULL,
+ intel->vtbl.set_draw_region(intel, colorRegions, depthRegion, stencilRegion,
fb->_NumColorDrawBuffers);
intel->NewGLState |= _NEW_BUFFERS;
--
1.7.5
More information about the mesa-dev
mailing list