summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrancisco Jerez <currojerez@riseup.net>2010-02-25 01:55:13 +0100
committerFrancisco Jerez <currojerez@riseup.net>2010-02-25 18:37:39 +0100
commit51e8a66fa197de7e17fb94d901a4cf26f0812670 (patch)
treec83cf90b001da55c49d70dc059133a300b8ea31b /src
parent59ddf8ca635465dea1d455c384f5905b65dc6979 (diff)
dri/nouveau: Use the XRGB8888 hardware texture format.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_texture.c45
-rw-r--r--src/mesa/drivers/dri/nouveau/nv04_state_tex.c2
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_frag.c7
-rw-r--r--src/mesa/drivers/dri/nouveau/nv10_state_tex.c4
-rw-r--r--src/mesa/drivers/dri/nouveau/nv20_state_tex.c18
5 files changed, 49 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 0947a2a95b..bf365bfca3 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -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:
diff --git a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
index facd41cff6..6d8762b7d1 100644
--- a/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv04_state_tex.c
@@ -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);
}
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
index b56b4ff02c..76b95fdd51 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_frag.c
@@ -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);
}
}
diff --git a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
index 7fe27317b2..02a5ca797a 100644
--- a/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv10_state_tex.c
@@ -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:
diff --git a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
index 7a5914d9b7..92870105f9 100644
--- a/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
+++ b/src/mesa/drivers/dri/nouveau/nv20_state_tex.c
@@ -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);
}