Play a little bit with texture formats.

Get NeHe demos 06, 07 and 19 working.
This commit is contained in:
Vladimir Dergachev 2005-01-05 00:18:46 +00:00
parent 065f725672
commit e99f390ff6
4 changed files with 41 additions and 18 deletions

View file

@ -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);

View file

@ -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
}
}

View file

@ -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:

View file

@ -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;