aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i810/i810texstate.c
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2005-08-25 19:15:01 +0000
committerIan Romanick <[email protected]>2005-08-25 19:15:01 +0000
commit8bc0b3f9611f9634d497fe2174246e866920f865 (patch)
tree78f720d0abaf3733d0dafa8e0bd1f0ee69d853f9 /src/mesa/drivers/dri/i810/i810texstate.c
parent8de9d92acf3e2ec76245c34d90fac65c7bb1994c (diff)
Fix texture format selection. ChooseTextureFormat is supposed to select the
hardware format of the texture, and SetTexImages is supposed to use the format selected by ChooseTextureFormat. However, both routines were making their choices based on the texture's BaseFormat. This is wrong. ChooseTextureFormat uses BaseFormat and SetTexImages uses TexFormat->MesaFormat. Once SetTexImages was fixed to use the right format values, ChooseTextureFormat was cleaned up. It now uses the few available texture formats supported by the i810 in a smarter way. This should improve the quality of LUMINANCE, LUMINANCE_ALPHA, and INTENSITY textures. I tested this by cycling through all the texture formats in demos/texenv and tests/yuvsquare.
Diffstat (limited to 'src/mesa/drivers/dri/i810/i810texstate.c')
-rw-r--r--src/mesa/drivers/dri/i810/i810texstate.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/mesa/drivers/dri/i810/i810texstate.c b/src/mesa/drivers/dri/i810/i810texstate.c
index e100c565cbf..10a15f961f6 100644
--- a/src/mesa/drivers/dri/i810/i810texstate.c
+++ b/src/mesa/drivers/dri/i810/i810texstate.c
@@ -25,6 +25,7 @@
#include "glheader.h"
#include "macros.h"
#include "mtypes.h"
+#include "texformat.h"
#include "simple_list.h"
#include "enums.h"
@@ -52,29 +53,33 @@ static void i810SetTexImages( i810ContextPtr imesa,
/* fprintf(stderr, "%s\n", __FUNCTION__); */
- switch (baseImage->Format) {
- case GL_RGB:
- case GL_LUMINANCE:
- t->texelBytes = 2;
- textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_RGB565;
+ t->texelBytes = 2;
+ switch (baseImage->TexFormat->MesaFormat) {
+ case MESA_FORMAT_ARGB1555:
+ textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_ARGB1555;
break;
- case GL_ALPHA:
- case GL_LUMINANCE_ALPHA:
- case GL_INTENSITY:
- case GL_RGBA:
- t->texelBytes = 2;
+ case MESA_FORMAT_ARGB4444:
textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_ARGB4444;
break;
- case GL_COLOR_INDEX:
- textureFormat = MI1_FMT_8CI | MI1_PF_8CI_ARGB4444;
- t->texelBytes = 1;
+ case MESA_FORMAT_RGB565:
+ textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_RGB565;
+ break;
+ case MESA_FORMAT_AL88:
+ textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_AY88;
break;
- case GL_YCBCR_MESA:
- t->texelBytes = 2;
+ case MESA_FORMAT_YCBCR:
textureFormat = MI1_FMT_422 | MI1_PF_422_YCRCB_SWAP_Y
| MI1_COLOR_CONV_ENABLE;
break;
-
+ case MESA_FORMAT_YCBCR_REV:
+ textureFormat = MI1_FMT_422 | MI1_PF_422_YCRCB
+ | MI1_COLOR_CONV_ENABLE;
+ break;
+ case MESA_FORMAT_CI8:
+ textureFormat = MI1_FMT_8CI | MI1_PF_8CI_ARGB4444;
+ t->texelBytes = 1;
+ break;
+
default:
fprintf(stderr, "i810SetTexImages: bad image->Format\n" );
return;