dri/nouveau: Use the XRGB8888 hardware texture format.
authorFrancisco Jerez <currojerez@riseup.net>
Thu, 25 Feb 2010 00:55:13 +0000 (01:55 +0100)
committerFrancisco Jerez <currojerez@riseup.net>
Thu, 25 Feb 2010 17:37:39 +0000 (18:37 +0100)
src/mesa/drivers/dri/nouveau/nouveau_texture.c
src/mesa/drivers/dri/nouveau/nv04_state_tex.c
src/mesa/drivers/dri/nouveau/nv10_state_frag.c
src/mesa/drivers/dri/nouveau/nv10_state_tex.c
src/mesa/drivers/dri/nouveau/nv20_state_tex.c

index 0947a2a95b853e7b904111bb4171cd777fed5aa4..bf365bfca34f693dbb29819651da1e613701f323 100644 (file)
@@ -108,40 +108,28 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
        switch (internalFormat) {
        case 4:
        case GL_RGBA:
-       case GL_RGB10_A2:
+       case GL_RGBA2:
+       case GL_RGBA4:
+       case GL_RGBA8:
        case GL_RGBA12:
        case GL_RGBA16:
-       case GL_RGBA8:
+       case GL_RGB10_A2:
+               return MESA_FORMAT_ARGB8888;
+       case GL_RGB5_A1:
+               return MESA_FORMAT_ARGB1555;
+
        case GL_RGB:
        case GL_RGB8:
        case GL_RGB10:
        case GL_RGB12:
        case GL_RGB16:
-               return MESA_FORMAT_ARGB8888;
-       case GL_RGB5_A1:
-               return MESA_FORMAT_ARGB1555;
-
+               return MESA_FORMAT_XRGB8888;
        case 3:
        case GL_R3_G3_B2:
        case GL_RGB4:
        case GL_RGB5:
                return MESA_FORMAT_RGB565;
 
-       case GL_ALPHA:
-       case GL_ALPHA4:
-       case GL_ALPHA12:
-       case GL_ALPHA16:
-       case GL_ALPHA8:
-               return MESA_FORMAT_A8;
-
-       case 1:
-       case GL_LUMINANCE:
-       case GL_LUMINANCE4:
-       case GL_LUMINANCE12:
-       case GL_LUMINANCE16:
-       case GL_LUMINANCE8:
-               return MESA_FORMAT_L8;
-
        case 2:
        case GL_LUMINANCE_ALPHA:
        case GL_LUMINANCE4_ALPHA4:
@@ -152,6 +140,21 @@ nouveau_choose_tex_format(GLcontext *ctx, GLint internalFormat,
        case GL_LUMINANCE8_ALPHA8:
                return MESA_FORMAT_ARGB8888;
 
+       case 1:
+       case GL_LUMINANCE:
+       case GL_LUMINANCE4:
+       case GL_LUMINANCE12:
+       case GL_LUMINANCE16:
+       case GL_LUMINANCE8:
+               return MESA_FORMAT_L8;
+
+       case GL_ALPHA:
+       case GL_ALPHA4:
+       case GL_ALPHA12:
+       case GL_ALPHA16:
+       case GL_ALPHA8:
+               return MESA_FORMAT_A8;
+
        case GL_INTENSITY:
        case GL_INTENSITY4:
        case GL_INTENSITY12:
index facd41cff638c58a22c813f8cd0ecd3567161623..6d8762b7d1ebb4f74d2594e94c0773f3a3f91e5c 100644 (file)
@@ -48,6 +48,8 @@ get_tex_format(struct gl_texture_image *ti)
                return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_R5G6B5;
        case MESA_FORMAT_ARGB8888:
                return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_A8R8G8B8;
+       case MESA_FORMAT_XRGB8888:
+               return NV04_TEXTURED_TRIANGLE_FORMAT_COLOR_X8R8G8B8;
        default:
                assert(0);
        }
index b56b4ff02cf0a71e35df6b5366ba2593d8e06e5b..76b95fdd518094e37ee0814c0b75f6279aa9f703 100644 (file)
@@ -179,6 +179,13 @@ get_input_arg(struct combiner_state *rc, int arg, int flags)
                                return RC_IN_SOURCE(ZERO) |
                                        get_input_mapping(rc, operand,
                                                          flags ^ INVERT);
+
+               } else if (format == MESA_FORMAT_XRGB8888) {
+                       /* Sometimes emulated using ARGB8888. */
+                       if (!is_color_operand(operand))
+                               return RC_IN_SOURCE(ZERO) |
+                                       get_input_mapping(rc, operand,
+                                                         flags ^ INVERT);
                }
        }
 
index 7fe27317b232222e58fa812ef292ea058134c127..02a5ca797ae0cce44f6c485871fe37269af7e88f 100644 (file)
@@ -44,6 +44,9 @@ get_tex_format_pot(struct gl_texture_image *ti)
        case MESA_FORMAT_ARGB8888:
                return NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8;
 
+       case MESA_FORMAT_XRGB8888:
+               return NV10TCL_TX_FORMAT_FORMAT_X8R8G8B8;
+
        case MESA_FORMAT_ARGB1555:
                return NV10TCL_TX_FORMAT_FORMAT_A1R5G5B5;
 
@@ -79,6 +82,7 @@ get_tex_format_rect(struct gl_texture_image *ti)
                return NV10TCL_TX_FORMAT_FORMAT_R5G6B5_RECT;
 
        case MESA_FORMAT_ARGB8888:
+       case MESA_FORMAT_XRGB8888:
                return NV10TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT;
 
        case MESA_FORMAT_A8:
index 7a5914d9b7fe5eda207ccc42222dbfa2c86337f8..92870105f96beac422c1a74578b04e90ad05cb43 100644 (file)
@@ -45,6 +45,9 @@ get_tex_format_pot(struct gl_texture_image *ti)
        case MESA_FORMAT_ARGB4444:
                return NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4;
 
+       case MESA_FORMAT_XRGB8888:
+               return NV20TCL_TX_FORMAT_FORMAT_X8R8G8B8;
+
        case MESA_FORMAT_RGB565:
                return NV20TCL_TX_FORMAT_FORMAT_R5G6B5;
 
@@ -67,15 +70,21 @@ static uint32_t
 get_tex_format_rect(struct gl_texture_image *ti)
 {
        switch (ti->TexFormat) {
+       case MESA_FORMAT_ARGB8888:
+               return NV20TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT;
+
        case MESA_FORMAT_ARGB1555:
                return NV20TCL_TX_FORMAT_FORMAT_A1R5G5B5_RECT;
 
+       case MESA_FORMAT_ARGB4444:
+               return NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4_RECT;
+
+       case MESA_FORMAT_XRGB8888:
+               return NV20TCL_TX_FORMAT_FORMAT_R8G8B8_RECT;
+
        case MESA_FORMAT_RGB565:
                return NV20TCL_TX_FORMAT_FORMAT_R5G6B5_RECT;
 
-       case MESA_FORMAT_ARGB8888:
-               return NV20TCL_TX_FORMAT_FORMAT_A8R8G8B8_RECT;
-
        case MESA_FORMAT_L8:
                return NV20TCL_TX_FORMAT_FORMAT_L8_RECT;
 
@@ -83,9 +92,6 @@ get_tex_format_rect(struct gl_texture_image *ti)
        case MESA_FORMAT_I8:
                return NV20TCL_TX_FORMAT_FORMAT_A8_RECT;
 
-       case MESA_FORMAT_ARGB4444:
-               return NV20TCL_TX_FORMAT_FORMAT_A4R4G4B4_RECT;
-
        default:
                assert(0);
        }