intel: fix check for Y orientation in span functions.
[mesa.git] / src / mesa / drivers / dri / intel / intel_span.c
index 8f4e681ffea03a3c0c43baf7da0479a739f6b7c4..bdd2fd9e85758ec274315c88cbb7ff1365dc4ee0 100644 (file)
@@ -150,7 +150,7 @@ static uint32_t x_tile_swizzle(struct intel_renderbuffer *irb,
        int     x_tile_number, y_tile_number;
        int     tile_off, tile_base;
        
-       tile_stride = (irb->pfPitch * irb->region->cpp) << 3;
+       tile_stride = (irb->region->pitch * irb->region->cpp) << 3;
 
        xbyte = x * irb->region->cpp;
 
@@ -190,7 +190,7 @@ static uint32_t x_tile_swizzle(struct intel_renderbuffer *irb,
        printf("(%d,%d) -> %d + %d = %d (pitch = %d, tstride = %d)\n",
               x, y, tile_off, tile_base,
               tile_off + tile_base,
-              irb->pfPitch, tile_stride);
+              irb->region->pitch, tile_stride);
 #endif
 
        return tile_base + tile_off;
@@ -205,7 +205,7 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
        int     x_tile_number, y_tile_number;
        int     tile_off, tile_base;
        
-       tile_stride = (irb->pfPitch * irb->region->cpp) << 5;
+       tile_stride = (irb->region->pitch * irb->region->cpp) << 5;
 
        xbyte = x * irb->region->cpp;
 
@@ -255,8 +255,8 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
 #define LOCAL_VARS                                                     \
    struct intel_context *intel = intel_context(ctx);                   \
    struct intel_renderbuffer *irb = intel_renderbuffer(rb);            \
-   const GLint yScale = irb->RenderToTexture ? 1 : -1;                 \
-   const GLint yBias = irb->RenderToTexture ? 0 : irb->Base.Height - 1;        \
+   const GLint yScale = ctx->DrawBuffer->Name ? 1 : -1;                        \
+   const GLint yBias = ctx->DrawBuffer->Name ? 0 : irb->Base.Height - 1;\
    unsigned int num_cliprects;                                         \
    struct drm_clip_rect *cliprects;                                    \
    int x_off, y_off;                                                   \
@@ -392,8 +392,8 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb,
 #define LOCAL_DEPTH_VARS                                               \
    struct intel_context *intel = intel_context(ctx);                   \
    struct intel_renderbuffer *irb = intel_renderbuffer(rb);            \
-   const GLint yScale = irb->RenderToTexture ? 1 : -1;                 \
-   const GLint yBias = irb->RenderToTexture ? 0 : irb->Base.Height - 1; \
+   const GLint yScale = ctx->DrawBuffer->Name ? 1 : -1;                        \
+   const GLint yBias = ctx->DrawBuffer->Name ? 0 : irb->Base.Height - 1;\
    unsigned int num_cliprects;                                         \
    struct drm_clip_rect *cliprects;                                    \
    int x_off, y_off;                                                   \
@@ -528,8 +528,6 @@ intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb)
    if (irb == NULL || irb->region == NULL)
       return;
 
-   irb->pfPitch = irb->region->pitch;
-
    intel_set_span_functions(intel, rb);
 }
 
@@ -543,7 +541,6 @@ intel_renderbuffer_unmap(struct intel_context *intel,
       return;
 
    clear_span_cache(irb);
-   irb->pfPitch = 0;
 
    rb->GetRow = NULL;
    rb->PutRow = NULL;
@@ -633,7 +630,7 @@ intelSpanRenderStart(GLcontext * ctx)
    intelFlush(&intel->ctx);
    LOCK_HARDWARE(intel);
 
-   for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
+   for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
       if (ctx->Texture.Unit[i]._ReallyEnabled) {
          struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current;
          intel_tex_map_images(intel, intel_texture_object(texObj));
@@ -655,7 +652,7 @@ intelSpanRenderFinish(GLcontext * ctx)
 
    _swrast_flush(ctx);
 
-   for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) {
+   for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) {
       if (ctx->Texture.Unit[i]._ReallyEnabled) {
          struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current;
          intel_tex_unmap_images(intel, intel_texture_object(texObj));