summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladimir Dergachev <volodya@freedesktop.org>2005-01-05 00:18:46 +0000
committerVladimir Dergachev <volodya@freedesktop.org>2005-01-05 00:18:46 +0000
commite99f390ff6b46495625b207e0e51f9431a564866 (patch)
tree8c4d14e3087c10e16aa227650b7cd38549bcf4f1
parent065f725672434319da6e5d91cc17c37a2e9c50eb (diff)
Play a little bit with texture formats.
Get NeHe demos 06, 07 and 19 working.
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c8
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c37
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c12
4 files changed, 41 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index aad85703784..5b4d94e7969 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -279,11 +279,13 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx,
e32(0x00000003);
+ #if 0 /* looks like the Z offset issue got fixed */
rmesa->hw.vte.cmd[1] = R300_VPORT_X_SCALE_ENA
| R300_VPORT_X_OFFSET_ENA
| R300_VPORT_Y_SCALE_ENA
| R300_VPORT_Y_OFFSET_ENA
| R300_VTX_W0_FMT;
+ #endif
R300_STATECHANGE(rmesa, vte);
r300EmitState(rmesa);
@@ -312,6 +314,12 @@ static GLboolean r300_run_immediate_render(GLcontext *ctx,
r300EmitVertexShader(rmesa);
r300EmitPixelShader(rmesa);
+ #if 0
+ reg_start(R300_RB3D_COLORMASK, 0);
+ e32(0xf);
+ #endif
+ /* ----------------------------------- */
+
/* We need LOAD_VBPNTR to setup AOS_ATTR fields.. the offsets are irrelevant */
r300EmitLOAD_VBPNTR(rmesa, 0);
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index f67025494f0..023e22f1566 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -812,20 +812,35 @@ void r300_setup_textures(GLcontext *ctx)
r300->hw.tex.unknown4.cmd[R300_TEX_VALUE_0+i]=0x0;
r300->hw.tex.unknown5.cmd[R300_TEX_VALUE_0+i]=0x0;
+
+ fprintf(stderr, "Want to set format %08x\n", t->format);
/* We don't know how to set this yet */
r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x88a0c;
+ r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x88013;
+ /* Use the code below to quickly find matching texture
+ formats. Requires an app that displays the same texture
+ repeatedly */
+ #if 0
+ {
+ static int fmt=0;
+ static int k=0;
+ k++;
+ if(k>400){
+ k=0;
+ fmt++;
+ if(fmt>0xff){
+ exit(-1);
+ fmt=0;
+ }
+ //sleep(1);
+ }
+ r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x00a0c | (fmt<<12);
+ }
+ #endif
+ r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x53a0c;
+ fprintf(stderr, "Instead setting format %08x\n", r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]);
+
- } else {
- /* Fill in with 0's */
- #if 0 /* No need.. */
- r300->hw.tex.filter.cmd[R300_TEX_VALUE_0+i]=0x0;
- r300->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+i]=0x0;
- r300->hw.tex.size.cmd[R300_TEX_VALUE_0+i]=0x0;
- r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=0x0;
- r300->hw.tex.offset.cmd[R300_TEX_VALUE_0+i]=r300->radeon.radeonScreen->fbLocation;
- r300->hw.tex.unknown4.cmd[R300_TEX_VALUE_0+i]=0x0;
- r300->hw.tex.unknown5.cmd[R300_TEX_VALUE_0+i]=0x0;
- #endif
}
}
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index d32b9f0288f..7577eb8ddd9 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -318,7 +318,7 @@ static const struct gl_texture_format *r300ChooseTextureFormat(GLcontext * ctx,
const GLboolean force16bpt =
(rmesa->texture_depth == DRI_CONF_TEXTURE_DEPTH_FORCE_16);
(void)format;
-
+
switch (internalFormat) {
case 4:
case GL_RGBA:
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index 22d1d6c6f9d..55d97f304e2 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -239,13 +239,13 @@ static void r300SetTexImages(r300ContextPtr rmesa,
t->filter &= ~R200_MAX_MIP_LEVEL_MASK;
t->filter |= (numLevels - 1) << R200_MAX_MIP_LEVEL_SHIFT;
- t->format &= ~(R200_TXFORMAT_WIDTH_MASK |
- R200_TXFORMAT_HEIGHT_MASK |
+ t->format &= ~(R300_TX_FORMAT_WIDTH_MASK |
+ R300_TX_FORMAT_HEIGHT_MASK |
R200_TXFORMAT_CUBIC_MAP_ENABLE |
R200_TXFORMAT_F5_WIDTH_MASK |
R200_TXFORMAT_F5_HEIGHT_MASK);
- t->format |= ((log2Width << R200_TXFORMAT_WIDTH_SHIFT) |
- (log2Height << R200_TXFORMAT_HEIGHT_SHIFT));
+ t->format |= ((log2Width << R300_TX_FORMAT_WIDTH_SHIFT) |
+ (log2Height << R300_TX_FORMAT_HEIGHT_SHIFT));
t->format_x &= ~(R200_DEPTH_LOG2_MASK | R200_TEXCOORD_MASK);
if (tObj->Target == GL_TEXTURE_3D) {
@@ -1291,7 +1291,7 @@ void r300UpdateTextureState(GLcontext * ctx)
if (GET_CHIP(rmesa->radeon.radeonScreen) == RADEON_CHIP_REAL_R200) {
/*
* T0 hang workaround -------------
- * not needed for r300 derivatives?
+ * not needed for r200 derivatives?
*/
if ((rmesa->hw.ctx.cmd[CTX_PP_CNTL] & R200_TEX_ENABLE_MASK) ==
R200_TEX_0_ENABLE
@@ -1339,7 +1339,7 @@ void r300UpdateTextureState(GLcontext * ctx)
/*
* Texture cache LRU hang workaround -------------
- * not needed for r300 derivatives?
+ * not needed for r200 derivatives?
*/
dbg = 0x0;