summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/intel/intel_span.c
diff options
context:
space:
mode:
authorChad Versace <[email protected]>2011-11-13 17:45:51 -0800
committerChad Versace <[email protected]>2011-11-21 16:58:28 -0800
commitaf35a3523df7f555427de4835ae092d1836c3c95 (patch)
tree290d20ea155999ffb722564bb7d0033e8d60786f /src/mesa/drivers/dri/intel/intel_span.c
parent3d2235e6c76a8a6aef2a14ca57c68403cf056921 (diff)
intel: Fix swrast_render_start() for depthstencil buffers with separate stencil
1. Don't map the depthstencil buffer twice Place a guard in intel_renderbuffer_map() to prevent a renderbuffer from being mapped twice. This happened if a single buffer was attached to the framebuffer's depth and stencil attachment points. (Interestingly, because intel_map_renderbuffer_gtt() is idempotent, the double mapping did not cause bugs for depthstencil buffers *without* separate stencil). 2. Stop overriding gl_framebuffer::_DepthBuffer,_StencilBuffer Normally, if a depthstencil buffer is attached to the framebuffer's depth attachment point, then _mesa_update_framebuffer() installs a wrapper depth renderbuffer at gl_framebuffer::_DepthBuffer. Ditto for the stencil attachment point and gl_framebuffer::_StencilBuffer A depthstencil intel_renderbuffer with separate stencil contains hidden depth and stencil renderbuffers, which are the *real* renderbuffers. In order to force swrast to work, we were installing, in brw_update_draw_buffer(), the hidden renderbuffers at gl_framebuffer::_DepthBuffer and _StencilBuffer, thus overriding the behavior of _mesa_update_framebuffer(). However, now that intel_renderbuffer_map() is implemented with MapRenderbuffer(), overriding _mesa_update_framebuffer's introduces bugs. This patch removes the override code. Fixes several Piglit tests on gen7. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Signed-off-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/intel/intel_span.c')
-rw-r--r--src/mesa/drivers/dri/intel/intel_span.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c
index afb0f32a833..b103bbd9f7f 100644
--- a/src/mesa/drivers/dri/intel/intel_span.c
+++ b/src/mesa/drivers/dri/intel/intel_span.c
@@ -187,10 +187,13 @@ intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb)
if (!irb)
return;
- if (irb->wrapped_depth)
- intel_renderbuffer_map(intel, irb->wrapped_depth);
- if (irb->wrapped_stencil)
- intel_renderbuffer_map(intel, irb->wrapped_stencil);
+ if (rb->Data) {
+ /* Renderbuffer is already mapped. This usually happens when a single
+ * buffer is attached to the framebuffer's depth and stencil attachment
+ * points.
+ */
+ return;
+ }
ctx->Driver.MapRenderbuffer(ctx, rb, 0, 0, rb->Width, rb->Height,
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT,
@@ -211,10 +214,13 @@ intel_renderbuffer_unmap(struct intel_context *intel,
if (!irb)
return;
- if (irb->wrapped_depth)
- intel_renderbuffer_unmap(intel, irb->wrapped_depth);
- if (irb->wrapped_stencil)
- intel_renderbuffer_unmap(intel, irb->wrapped_stencil);
+ if (!rb->Data) {
+ /* Renderbuffer is already unmapped. This usually happens when a single
+ * buffer is attached to the framebuffer's depth and stencil attachment
+ * points.
+ */
+ return;
+ }
ctx->Driver.UnmapRenderbuffer(ctx, rb);