summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Dergachev <[email protected]>2005-01-14 04:21:55 +0000
committerVladimir Dergachev <[email protected]>2005-01-14 04:21:55 +0000
commit2821b05a0fbe9e3fe4428e71fe03a6bc0f444505 (patch)
tree62a278a06c5a174d2cc384ce204926060c47cc16
parentd2001bd88ff10b191fa13a84b8d8a77352616fa6 (diff)
Incorporate latest data from Wladimir van der Laan.
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h52
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c30
2 files changed, 58 insertions, 24 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index f728190a583..ca032375bb3 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -599,22 +599,32 @@ I am fairly certain that they are correct unless stated otherwise in comments.
# define R300_TX_SIZE_MASK (15 << 26)
#define R300_TX_FORMAT_0 0x44C0
/* The interpretation of the format word by Wladimir van der Laan */
-# define R300_TX_FORMAT_I8 0x0
-# define R300_TX_FORMAT_I16 0x1
- /* gap */
-# define R300_TX_FORMAT_I8A8 0x3
-# define R300_TX_FORMAT_I16A16 0x4
- /* gap */
-# define R300_TX_FORMAT_R5G5B5 0x6
- /* gap */
-# define R300_TX_FORMAT_A4R4G4B4 0xA
-# define R300_TX_FORMAT_A1R5G5B5 0xB
-# define R300_TX_FORMAT_R8G8B8A8 0xC
-# define R300_TX_FORMAT_R10G10B10A2 0xD
-# define R300_TX_FORMAT_R16G16B16A16 0xE
+ /* The X, Y, Z and W refer to the layout of the components.
+ They are given meanings as R, G, B and Alpha by the swizzle
+ specification */
+# define R300_TX_FORMAT_X8 0x0
+# define R300_TX_FORMAT_X16 0x1
+# define R300_TX_FORMAT_Y4X4 0x2
+# define R300_TX_FORMAT_Y8X8 0x3
+# define R300_TX_FORMAT_Y16X16 0x4
+# define R300_TX_FORMAT_Z3Y3X2 0x5
+# define R300_TX_FORMAT_Z5Y6X5 0x6
+# define R300_TX_FORMAT_Z6Y5X5 0x7
+# define R300_TX_FORMAT_Z11Y11X10 0x8
+# define R300_TX_FORMAT_Z10Y11X11 0x9
+# define R300_TX_FORMAT_W4Z4Y4X4 0xA
+# define R300_TX_FORMAT_W1Z5Y5X5 0xB
+# define R300_TX_FORMAT_W8Z8Y8X8 0xC
+# define R300_TX_FORMAT_W2Z10Y10X10 0xD
+# define R300_TX_FORMAT_W16Z16Y16X16 0xE
# define R300_TX_FORMAT_DXT1 0xF
# define R300_TX_FORMAT_DXT3 0x10
-# define R300_TX_FORMAT_DXT5 0x15
+# define R300_TX_FORMAT_DXT5 0x11
+# define R300_TX_FORMAT_D3DMFT_CxV8U8 0x12 /* no swizzle */
+# define R300_TX_FORMA_A8R8G8B8 0x13 /* no swizzle */
+# define R300_TX_FORMA_B8G8_B8G8 0x14 /* no swizzle */
+# define R300_TX_FORMA_G8R8_G8B8 0x15 /* no swizzle */
+ /* 0x16 - some 16 bit green format.. ?? */
/* gap */
/* Floating point formats */
/* Note - hardware supports both 16 and 32 bit floating point */
@@ -639,11 +649,14 @@ I am fairly certain that they are correct unless stated otherwise in comments.
# define R300_TX_FORMAT_W 3
# define R300_TX_FORMAT_ZERO 4
# define R300_TX_FORMAT_ONE 5
+# define R300_TX_FORMAT_CUT_Z 6 /* 2.0*Z, everything above 1.0 is set to 0.0 */
+# define R300_TX_FORMAT_CUT_W 7 /* 2.0*W, everything above 1.0 is set to 0.0 */
# define R300_TX_FORMAT_B_SHIFT 18
# define R300_TX_FORMAT_G_SHIFT 15
# define R300_TX_FORMAT_R_SHIFT 12
# define R300_TX_FORMAT_A_SHIFT 9
+ /* Convenience macro to take care of layout and swizzling */
# define R300_EASY_TX_FORMAT(B, G, R, A, FMT) (\
((R300_TX_FORMAT_##B)<<R300_TX_FORMAT_B_SHIFT) \
| ((R300_TX_FORMAT_##G)<<R300_TX_FORMAT_G_SHIFT) \
@@ -651,7 +664,16 @@ I am fairly certain that they are correct unless stated otherwise in comments.
| ((R300_TX_FORMAT_##A)<<R300_TX_FORMAT_A_SHIFT) \
| (R300_TX_FORMAT_##FMT) \
)
-
+ /* These can be ORed with result of R300_EASY_TX_FORMAT() */
+ /* We don't really know what they do. Take values from a constant color ? */
+# define R300_TX_FORMAT_CONST_X (1<<5)
+# define R300_TX_FORMAT_CONST_Y (2<<5)
+# define R300_TX_FORMAT_CONST_Z (4<<5)
+# define R300_TX_FORMAT_CONST_W (8<<5)
+
+# define R300_TX_FORMAT_YUV_MODE 0x00800000
+
+
#define R300_TX_OFFSET_0 0x4540
/* BEGIN: Guess from R200 */
# define R300_TXO_ENDIAN_NO_SWAP (0 << 0)
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index e7e8a75c377..6dac835389e 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -827,15 +827,19 @@ static GLuint translate_texture_format(GLcontext *ctx, GLint tex_unit, GLuint fo
int i=0; /* number of alpha args .. */
GLuint fmt;
+ fprintf(stderr, "_ReallyEnabled=%d EnvMode=%s\n",
+ texUnit->_ReallyEnabled,
+ _mesa_lookup_enum_by_nr(texUnit->EnvMode));
+
switch(IntFormat){
case 4:
case GL_RGBA:
case GL_RGBA8:
- fmt=R300_EASY_TX_FORMAT(Z, Y, X, W, R8G8B8A8);
+ fmt=R300_EASY_TX_FORMAT(Z, Y, X, W, W8Z8Y8X8);
break;
case 3:
case GL_RGB8:
- fmt=R300_EASY_TX_FORMAT(Z, Y, X, ONE, R8G8B8A8);
+ fmt=R300_EASY_TX_FORMAT(Z, Y, X, ONE, W8Z8Y8X8);
break;
default:
return 0;
@@ -881,14 +885,14 @@ static GLuint translate_texture_format(GLcontext *ctx, GLint tex_unit, GLuint fo
/* tested with:
kfiresaver.kss
*/
- return R300_EASY_TX_FORMAT(Y, Z, W, ONE, R8G8B8A8);
+ return R300_EASY_TX_FORMAT(Y, Z, W, ONE, W8Z8Y8X8);
return 0x4b60c;
case FORMAT_HASH(0, 1, 0x2100, 0, 1, 0x2100, 0x00005547, 4):
/* tested with:
kfiresaver.kss
kfountain.kss
*/
- return R300_EASY_TX_FORMAT(Y, Z, W, ONE, R8G8B8A8);
+ return R300_EASY_TX_FORMAT(Y, Z, W, ONE, W8Z8Y8X8);
return 0x51a0c;
case FORMAT_HASH(0, 1, 0x2100, 0, 4, 0x1e01, 0x00008847, 3):
/* tested with
@@ -908,7 +912,7 @@ static GLuint translate_texture_format(GLcontext *ctx, GLint tex_unit, GLuint fo
/* Tested with:
Quake3demo
*/
- return R300_EASY_TX_FORMAT(Y, Z, W, ONE, R8G8B8A8);
+ return R300_EASY_TX_FORMAT(Y, Z, W, ONE, W8Z8Y8X8);
return 0x53a0c;
case FORMAT_HASH(0, 1, 0x2100, 0, 1, 0x2100, 0x00007847, GL_RGBA8):
case FORMAT_HASH(0, 1, 0x2100, 0, 1, 0x2100, 0x00006747, GL_RGBA8):
@@ -917,14 +921,14 @@ static GLuint translate_texture_format(GLcontext *ctx, GLint tex_unit, GLuint fo
/* Tested with:
Quake3demo
*/
- return R300_EASY_TX_FORMAT(Y, Z, W, W, R8G8B8A8);
+ return R300_EASY_TX_FORMAT(Y, Z, W, W, W8Z8Y8X8);
return 0x5360c;
case FORMAT_HASH(0, 1, 0x2100, 0, 1, 0x2100, 0x00007747, GL_RGBA8):
- return R300_EASY_TX_FORMAT(Z, Y, X, W, R8G8B8A8) ;
+ return R300_EASY_TX_FORMAT(Z, Y, X, W, W8Z8Y8X8) ;
case FORMAT_HASH(0, 1, 0x2100, 0, 1, 0x2100, 0x0008845, 0x00008056):
//return 0;
fprintf(stderr, "***\n");
- return R300_EASY_TX_FORMAT(Y, Z, W, W, R8G8B8A8);
+ return R300_EASY_TX_FORMAT(Y, Z, W, W, W8Z8Y8X8);
return 0x53a23;
}
@@ -1004,6 +1008,14 @@ void r300_setup_textures(GLcontext *ctx)
r300->state.texture.unit[i].texobj!=NULL?t->base.tObj->Image[0][0]->IntFormat:3);
+ fprintf(stderr, "Format=%s IntFormat=%08x MesaFormat=%08x BaseFormat=%s IsCompressed=%d Target=%s\n",
+ _mesa_lookup_enum_by_nr(t->base.tObj->Image[0][0]->Format),
+ t->base.tObj->Image[0][0]->IntFormat,
+ t->base.tObj->Image[0][0]->TexFormat->MesaFormat,
+ _mesa_lookup_enum_by_nr(t->base.tObj->Image[0][0]->TexFormat->BaseFormat),
+ t->base.tObj->Image[0][0]->IsCompressed,
+ _mesa_lookup_enum_by_nr(t->base.tObj->Target));
+
#if 0
fprintf(stderr, "pitch=%08x filter=%08x format=%08x\n", t->pitch, t->filter, r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]);
fprintf(stderr, "unknown1=%08x size=%08x\n", r300->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+i],
@@ -1044,7 +1056,7 @@ void r300_setup_textures(GLcontext *ctx)
}
//r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=known_formats[fmt];
r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=
- R300_EASY_TX_FORMAT(Z, Y, X, W, R8G8B8A8) | (fmt<<21);
+ R300_EASY_TX_FORMAT(Z, Y, X, W, W8Z8Y8X8) | (fmt<<21);
//r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x08a0c | (fmt<<16);
//r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x58a00 | (fmt);
//r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x53a0c | (fmt<<24);