gallium/draw: initial code to properly support llvm in the draw module
[mesa.git] / src / mesa / drivers / dri / r200 / r200_pixel.c
index 654f2c6ae986778aeb37c9a1597fbfc729828c26..bfb7e2a2ed3f8370c3ed357fb691e080e456c56c 100644 (file)
@@ -53,14 +53,14 @@ check_color( const GLcontext *ctx, GLenum type, GLenum format,
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    GLuint cpp = rmesa->radeon.radeonScreen->cpp;
 
-   if (R200_DEBUG & DEBUG_PIXEL)
+   if (R200_DEBUG & RADEON_PIXEL)
       fprintf(stderr, "%s\n", __FUNCTION__);
 
    if (        (pitch & 63) ||
        ctx->_ImageTransferState ||
        packing->SwapBytes ||
        packing->LsbFirst) {
-      if (R200_DEBUG & DEBUG_PIXEL)
+      if (R200_DEBUG & RADEON_PIXEL)
         fprintf(stderr, "%s: failed 1\n", __FUNCTION__);
       return GL_FALSE;
    }
@@ -68,12 +68,12 @@ check_color( const GLcontext *ctx, GLenum type, GLenum format,
    if ( type == GL_UNSIGNED_INT_8_8_8_8_REV &&
        cpp == 4 &&
        format == GL_BGRA ) {
-      if (R200_DEBUG & DEBUG_PIXEL)
+      if (R200_DEBUG & RADEON_PIXEL)
         fprintf(stderr, "%s: passed 2\n", __FUNCTION__);
       return GL_TRUE;
    }
 
-   if (R200_DEBUG & DEBUG_PIXEL)
+   if (R200_DEBUG & RADEON_PIXEL)
       fprintf(stderr, "%s: failed\n", __FUNCTION__);
 
    return GL_FALSE;
@@ -88,10 +88,10 @@ check_color_per_fragment_ops( const GLcontext *ctx )
                    ctx->Fog.Enabled ||
                    ctx->Scissor.Enabled ||
                    ctx->Stencil._Enabled ||
-                   !ctx->Color.ColorMask[0] ||
-                   !ctx->Color.ColorMask[1] ||
-                   !ctx->Color.ColorMask[2] ||
-                   !ctx->Color.ColorMask[3] ||
+                   !ctx->Color.ColorMask[0][0] ||
+                   !ctx->Color.ColorMask[0][1] ||
+                   !ctx->Color.ColorMask[0][2] ||
+                   !ctx->Color.ColorMask[0][3] ||
                    ctx->Color.ColorLogicOpEnabled ||
                    ctx->Texture._EnabledUnits
            ) &&
@@ -101,7 +101,7 @@ check_color_per_fragment_ops( const GLcontext *ctx )
 }
 
 
-
+#if 0
 static GLboolean
 clip_pixelrect( const GLcontext *ctx,
                const GLframebuffer *buffer,
@@ -142,6 +142,7 @@ clip_pixelrect( const GLcontext *ctx,
 
    return GL_TRUE;
 }
+#endif
 
 static GLboolean
 r200TryReadPixels( GLcontext *ctx,
@@ -150,22 +151,22 @@ r200TryReadPixels( GLcontext *ctx,
                  const struct gl_pixelstore_attrib *pack,
                  GLvoid *pixels )
 {
+   return GL_FALSE;
+#if 0
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
    GLint pitch = pack->RowLength ? pack->RowLength : width;
    GLint blit_format;
    GLuint cpp = rmesa->radeon.radeonScreen->cpp;
    GLint size = width * height * cpp;
 
-   return GL_FALSE;
-#if 0
-   if (R200_DEBUG & DEBUG_PIXEL)
+   if (R200_DEBUG & RADEON_PIXEL)
       fprintf(stderr, "%s\n", __FUNCTION__);
 
    /* Only accelerate reading to GART buffers.
     */
    if ( !r200IsGartMemory(rmesa, pixels,
                         pitch * height * rmesa->radeon.radeonScreen->cpp ) ) {
-      if (R200_DEBUG & DEBUG_PIXEL)
+      if (R200_DEBUG & RADEON_PIXEL)
         fprintf(stderr, "%s: dest not GART\n", __FUNCTION__);
    }
 
@@ -173,7 +174,7 @@ r200TryReadPixels( GLcontext *ctx,
     * blitter:
     */
    if (!pack->Invert) {
-      if (R200_DEBUG & DEBUG_PIXEL)
+      if (R200_DEBUG & RADEON_PIXEL)
         fprintf(stderr, "%s: MESA_PACK_INVERT not set\n", __FUNCTION__);
       return GL_FALSE;
    }
@@ -206,14 +207,14 @@ r200TryReadPixels( GLcontext *ctx,
    if (!clip_pixelrect(ctx, ctx->ReadBuffer, &x, &y, &width, &height,
                       &size)) {
       UNLOCK_HARDWARE( &rmesa->radeon );
-      if (R200_DEBUG & DEBUG_PIXEL)
+      if (R200_DEBUG & RADEON_PIXEL)
         fprintf(stderr, "%s totally clipped -- nothing to do\n",
                 __FUNCTION__);
       return GL_TRUE;
    }
 
    {
-      __DRIdrawablePrivate *dPriv = rmesa->radeon.dri.drawable;
+      __DRIdrawable *dPriv = rmesa->radeon.dri.drawable;
       driRenderbuffer *drb = (driRenderbuffer *) ctx->ReadBuffer->_ColorReadBuffer;
       int nbox = dPriv->numClipRects;
       int src_offset = drb->offset
@@ -231,7 +232,7 @@ r200TryReadPixels( GLcontext *ctx,
       y += dPriv->y;
 
 
-      if (R200_DEBUG & DEBUG_PIXEL)
+      if (R200_DEBUG & RADEON_PIXEL)
         fprintf(stderr, "readpixel blit src_pitch %d dst_pitch %d\n",
                 src_pitch, dst_pitch);
 
@@ -274,7 +275,7 @@ r200ReadPixels( GLcontext *ctx,
                 const struct gl_pixelstore_attrib *pack,
                 GLvoid *pixels )
 {
-   if (R200_DEBUG & DEBUG_PIXEL)
+   if (R200_DEBUG & RADEON_PIXEL)
       fprintf(stderr, "%s\n", __FUNCTION__);
 
    if (!r200TryReadPixels( ctx, x, y, width, height, format, type, pack,
@@ -292,8 +293,12 @@ static void do_draw_pix( GLcontext *ctx,
                         const void *pixels,
                         GLuint planemask)
 {
+   if (R200_DEBUG & RADEON_PIXEL)
+      fprintf(stderr, "%s\n", __FUNCTION__);
+
+#if 0
    r200ContextPtr rmesa = R200_CONTEXT(ctx);
-   __DRIdrawablePrivate *dPriv = radeon_get_drawable(&rmesa->radeon);
+   __DRIdrawable *dPriv = radeon_get_drawable(&rmesa->radeon);
    drm_clip_rect_t *box = dPriv->pClipRects;
    struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorDrawBuffers[0];
    driRenderbuffer *drb = (driRenderbuffer *) rb;
@@ -304,9 +309,6 @@ static void do_draw_pix( GLcontext *ctx,
    int src_offset = r200GartOffsetFromVirtual( rmesa, pixels );
    int src_pitch = pitch * rmesa->radeon.radeonScreen->cpp;
 
-   if (R200_DEBUG & DEBUG_PIXEL)
-      fprintf(stderr, "%s\n", __FUNCTION__);
-#if 0
    switch ( rmesa->radeon.radeonScreen->cpp ) {
    case 2:
       blit_format = R200_CP_COLOR_FORMAT_RGB565;
@@ -386,7 +388,7 @@ r200TryDrawPixels( GLcontext *ctx,
    GLuint cpp = rmesa->radeon.radeonScreen->cpp;
    GLint size = height * pitch * cpp;
 
-   if (R200_DEBUG & DEBUG_PIXEL)
+   if (R200_DEBUG & RADEON_PIXEL)
       fprintf(stderr, "%s\n", __FUNCTION__);
 
    /* check that we're drawing to exactly one color buffer */
@@ -398,10 +400,10 @@ r200TryDrawPixels( GLcontext *ctx,
    case GL_RGBA:
    case GL_BGRA:
       planemask = radeonPackColor(cpp,
-                               ctx->Color.ColorMask[RCOMP],
-                               ctx->Color.ColorMask[GCOMP],
-                               ctx->Color.ColorMask[BCOMP],
-                               ctx->Color.ColorMask[ACOMP]);
+                               ctx->Color.ColorMask[0][RCOMP],
+                               ctx->Color.ColorMask[0][GCOMP],
+                               ctx->Color.ColorMask[0][BCOMP],
+                               ctx->Color.ColorMask[0][ACOMP]);
 
       if (cpp == 2)
         planemask |= planemask << 16;
@@ -412,7 +414,7 @@ r200TryDrawPixels( GLcontext *ctx,
       /* Can't do conversions on GART reads/draws.
        */
       if ( !r200IsGartMemory( rmesa, pixels, size ) ) {
-        if (R200_DEBUG & DEBUG_PIXEL)
+        if (R200_DEBUG & RADEON_PIXEL)
            fprintf(stderr, "%s: not GART memory\n", __FUNCTION__);
         return GL_FALSE;
       }
@@ -455,7 +457,7 @@ r200DrawPixels( GLcontext *ctx,
                 const struct gl_pixelstore_attrib *unpack,
                 const GLvoid *pixels )
 {
-   if (R200_DEBUG & DEBUG_PIXEL)
+   if (R200_DEBUG & RADEON_PIXEL)
       fprintf(stderr, "%s\n", __FUNCTION__);
 
    if (!r200TryDrawPixels( ctx, x, y, width, height, format, type,