i965: Fix readpixels from ReadBuffer != DrawBuffer.
authorEric Anholt <eric@anholt.net>
Tue, 16 Mar 2010 20:23:23 +0000 (13:23 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 26 Mar 2010 00:30:37 +0000 (17:30 -0700)
Fixes piglit fbo-readdrawpix.
(cherry picked from commit 5782b2a968bb979b651e49bb5fc4162faa842050)

src/mesa/drivers/dri/intel/intel_span.c

index fb5c01bc4dc1a4aded76f9e28de5f63e4072f02f..377f3a8627eaface738ca0d6261a019065b8f672 100644 (file)
@@ -48,11 +48,11 @@ intel_set_span_functions(struct intel_context *intel,
 
 #define LOCAL_VARS                                                     \
    struct intel_renderbuffer *irb = intel_renderbuffer(rb);            \
-   const GLint yScale = ctx->DrawBuffer->Name ? 1 : -1;                        \
-   const GLint yBias = ctx->DrawBuffer->Name ? 0 : irb->Base.Height - 1;\
+   const GLint yScale = rb->Name ? 1 : -1;                             \
+   const GLint yBias = rb->Name ? 0 : rb->Height - 1;                  \
    int minx = 0, miny = 0;                                             \
-   int maxx = ctx->DrawBuffer->Width;                                  \
-   int maxy = ctx->DrawBuffer->Height;                                 \
+   int maxx = rb->Width;                                               \
+   int maxy = rb->Height;                                              \
    int pitch = irb->region->pitch * irb->region->cpp;                  \
    void *buf = irb->region->buffer->virtual;                           \
    GLuint p;                                                           \
@@ -108,11 +108,11 @@ intel_set_span_functions(struct intel_context *intel,
 
 #define LOCAL_DEPTH_VARS                                               \
    struct intel_renderbuffer *irb = intel_renderbuffer(rb);            \
-   const GLint yScale = ctx->DrawBuffer->Name ? 1 : -1;                        \
-   const GLint yBias = ctx->DrawBuffer->Name ? 0 : irb->Base.Height - 1;\
+   const GLint yScale = rb->Name ? 1 : -1;                             \
+   const GLint yBias = rb->Name ? 0 : rb->Height - 1;                  \
    int minx = 0, miny = 0;                                             \
-   int maxx = ctx->DrawBuffer->Width;                                  \
-   int maxy = ctx->DrawBuffer->Height;                                 \
+   int maxx = rb->Width;                                               \
+   int maxy = rb->Height;                                              \
    int pitch = irb->region->pitch * irb->region->cpp;                  \
    void *buf = irb->region->buffer->virtual;                           \
    (void)buf; (void)pitch; /* unused for non-gttmap. */                        \