From 8ec456c68cc69349c2506ce64047d06c7113780c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 14 Sep 2009 12:40:53 -0600 Subject: [PATCH] intel: fix renderbuffer map/unmap regression Commit 36dd53a3cded9d003ec418732b7fc93c1476aa9b caused a few regressions because the glReadBuffer() buffer wasn't getting mapped when GL_READ_BUFFER != GL_DRAW_BUFFER. --- src/mesa/drivers/dri/intel/intel_span.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 1e73943..9771307 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -448,24 +448,22 @@ intel_map_unmap_framebuffer(struct intel_context *intel, struct gl_framebuffer *fb, GLboolean map) { - GLcontext *ctx = &intel->ctx; GLuint i, j; - /* color buffers */ - if (fb == ctx->DrawBuffer) { - for (j = 0; j < fb->_NumColorDrawBuffers; j++) { - if (map) - intel_renderbuffer_map(intel, fb->_ColorDrawBuffers[j]); - else - intel_renderbuffer_unmap(intel, fb->_ColorDrawBuffers[j]); - } - } else { + /* color draw buffers */ + for (j = 0; j < fb->_NumColorDrawBuffers; j++) { if (map) - intel_renderbuffer_map(intel, fb->_ColorReadBuffer); + intel_renderbuffer_map(intel, fb->_ColorDrawBuffers[j]); else - intel_renderbuffer_unmap(intel, fb->_ColorReadBuffer); + intel_renderbuffer_unmap(intel, fb->_ColorDrawBuffers[j]); } + /* color read buffer */ + if (map) + intel_renderbuffer_map(intel, fb->_ColorReadBuffer); + else + intel_renderbuffer_unmap(intel, fb->_ColorReadBuffer); + /* check for render to textures */ for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = @@ -524,7 +522,8 @@ intelSpanRenderStart(GLcontext * ctx) } intel_map_unmap_framebuffer(intel, ctx->DrawBuffer, GL_TRUE); - intel_map_unmap_framebuffer(intel, ctx->ReadBuffer, GL_TRUE); + if (ctx->ReadBuffer != ctx->DrawBuffer) + intel_map_unmap_framebuffer(intel, ctx->ReadBuffer, GL_TRUE); } /** @@ -547,7 +546,8 @@ intelSpanRenderFinish(GLcontext * ctx) } intel_map_unmap_framebuffer(intel, ctx->DrawBuffer, GL_FALSE); - intel_map_unmap_framebuffer(intel, ctx->ReadBuffer, GL_FALSE); + if (ctx->ReadBuffer != ctx->DrawBuffer) + intel_map_unmap_framebuffer(intel, ctx->ReadBuffer, GL_FALSE); UNLOCK_HARDWARE(intel); } -- 2.7.4