Module: Mesa
Branch: master
Commit: 199fab25b7cb047c0d7ac26ee12df3b2e1369723
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=199fab25b7cb047c0d7ac26ee12df3b2e1369723

Author: Francisco Jerez <curroje...@riseup.net>
Date:   Mon Mar 22 18:25:30 2010 +0100

dri/nouveau: Fix swrast fallbacks when the read and draw buffers aren't the 
same.

---

 src/mesa/drivers/dri/nouveau/nouveau_span.c |   30 ++++++++++++++++++---------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/mesa/drivers/dri/nouveau/nouveau_span.c 
b/src/mesa/drivers/dri/nouveau/nouveau_span.c
index f1a56dd..1bfdecc 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_span.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_span.c
@@ -32,7 +32,6 @@
 #include "swrast/swrast.h"
 
 #define LOCAL_VARS                                                     \
-       struct gl_framebuffer *fb = ctx->DrawBuffer;                    \
        struct nouveau_surface *s = &to_nouveau_renderbuffer(rb)->surface; \
        GLuint p;                                                       \
        (void)p;
@@ -45,12 +44,12 @@
 #define HW_CLIPLOOP() {                                                        
\
        int minx = 0;                                                   \
        int miny = 0;                                                   \
-       int maxx = fb->Width;                                           \
-       int maxy = fb->Height;
+       int maxx = rb->Width;                                           \
+       int maxy = rb->Height;
 
 #define HW_ENDCLIPLOOP() }
 
-#define Y_FLIP(y) (fb->Name ? (y) : rb->Height - 1 - (y))
+#define Y_FLIP(y) (rb->Name ? (y) : rb->Height - 1 - (y))
 
 /* RGB565 span functions */
 #define SPANTMP_PIXEL_FMT GL_RGB
@@ -144,17 +143,28 @@ texture_unit_map_unmap(GLcontext *ctx, struct 
gl_texture_unit *u, GLboolean map)
 }
 
 static void
-span_map_unmap(GLcontext *ctx, GLboolean map)
+framebuffer_map_unmap(struct gl_framebuffer *fb, GLboolean map)
 {
        int i;
 
-       for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++)
-               renderbuffer_map_unmap(ctx->DrawBuffer->_ColorDrawBuffers[i], 
map);
+       for (i = 0; i < fb->_NumColorDrawBuffers; i++)
+               renderbuffer_map_unmap(fb->_ColorDrawBuffers[i], map);
+
+       renderbuffer_map_unmap(fb->_ColorReadBuffer, map);
+
+       if (fb->_DepthBuffer)
+               renderbuffer_map_unmap(fb->_DepthBuffer->Wrapped, map);
+}
+
+static void
+span_map_unmap(GLcontext *ctx, GLboolean map)
+{
+       int i;
 
-       renderbuffer_map_unmap(ctx->DrawBuffer->_ColorReadBuffer, map);
+       framebuffer_map_unmap(ctx->DrawBuffer, map);
 
-       if (ctx->DrawBuffer->_DepthBuffer)
-               renderbuffer_map_unmap(ctx->DrawBuffer->_DepthBuffer->Wrapped, 
map);
+       if (ctx->ReadBuffer != ctx->DrawBuffer)
+               framebuffer_map_unmap(ctx->ReadBuffer, map);
 
        for (i = 0; i < ctx->Const.MaxTextureUnits; i++)
                texture_unit_map_unmap(ctx, &ctx->Texture.Unit[i], map);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to