mesa/swrast: fix inverted front buffer rendering with old-school swrast
authorDave Airlie <airlied@redhat.com>
Wed, 13 Nov 2013 02:53:52 +0000 (12:53 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 21 Nov 2013 00:50:17 +0000 (10:50 +1000)
I've no idea when this broke, but we have some people who wanted it fixed,
so here's my attempt.

reproducer, run readpix with swrast hit f, or run trival tri -sb things are
upside down, after this patch they aren't.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62142
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66213

Cc: <mesa-stable@lists.freedesktop.org>"
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/drivers/dri/swrast/swrast.c

index c062071b09b53f5be104e4fb64c1a7e09989c124..73dc5c4c06161974cee3584d7b7b1b8240df6012 100644 (file)
@@ -406,8 +406,8 @@ swrast_map_renderbuffer(struct gl_context *ctx,
                                     (char *) xrb->Base.Buffer,
                                     dPriv->loaderPrivate);
 
-      *out_map = xrb->Base.Buffer;
-      *out_stride = stride;
+      *out_map = xrb->Base.Buffer + (h - 1) * stride;
+      *out_stride = -stride;
       return;
    }