intel: Finalize the miptree before mapping it for fallbacks.
[mesa.git] / src / mesa / drivers / dri / intel / intel_span.c
index fb5c01bc4dc1a4aded76f9e28de5f63e4072f02f..fb840c1020d800c5bd8b5203e448f6db16d8b5a7 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;                                                           \
@@ -106,13 +106,20 @@ intel_set_span_functions(struct intel_context *intel,
 #define TAG2(x,y) intel_##x##y##_xRGB8888
 #include "spantmp2.h"
 
+/* a8 color span and pixel functions */
+#define SPANTMP_PIXEL_FMT GL_ALPHA
+#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_BYTE
+#define TAG(x) intel_##x##_A8
+#define TAG2(x,y) intel_##x##y##_A8
+#include "spantmp2.h"
+
 #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. */                        \
@@ -134,7 +141,7 @@ intel_set_span_functions(struct intel_context *intel,
    (*(uint32_t *)(irb->region->buffer->virtual + NO_TILE(_x, _y)) = d)
 #define READ_DEPTH(d, _x, _y) \
    d = *(uint32_t *)(irb->region->buffer->virtual + NO_TILE(_x, _y))
-#define TAG(x) intel_##x##_z24_x8
+#define TAG(x) intel_##x##_z24_s8
 #include "depthtmp.h"
 
 void
@@ -244,12 +251,14 @@ intelSpanRenderStart(GLcontext * ctx)
    struct intel_context *intel = intel_context(ctx);
    GLuint i;
 
-   intelFlush(&intel->ctx);
+   intel_flush(&intel->ctx);
    intel_prepare_render(intel);
 
    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_finalize_mipmap_tree(intel, i);
          intel_tex_map_images(intel, intel_texture_object(texObj));
       }
    }
@@ -341,6 +350,9 @@ intel_set_span_functions(struct intel_context *intel,
    struct intel_renderbuffer *irb = (struct intel_renderbuffer *) rb;
 
    switch (irb->Base.Format) {
+   case MESA_FORMAT_A8:
+      intel_InitPointers_A8(rb);
+      break;
    case MESA_FORMAT_RGB565:
       intel_InitPointers_RGB565(rb);
       break;
@@ -361,7 +373,7 @@ intel_set_span_functions(struct intel_context *intel,
       break;
    case MESA_FORMAT_X8_Z24:
    case MESA_FORMAT_S8_Z24:
-      intel_InitDepthPointers_z24_x8(rb);
+      intel_InitDepthPointers_z24_s8(rb);
       break;
    default:
       _mesa_problem(NULL,