summaryrefslogtreecommitdiff
path: root/src/mesa
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h11
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c2
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c7
-rw-r--r--src/mesa/drivers/dri/r300/r300_tex.c79
-rw-r--r--src/mesa/drivers/dri/r300/r300_texstate.c8
5 files changed, 69 insertions, 38 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index 38beffbc21..33b2f3da54 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -578,6 +578,17 @@ I am fairly certain that they are correct unless stated otherwise in comments.
# define R300_TX_MAG_FILTER_MASK (3 << 9)
# define R300_TX_MIN_FILTER_NEAREST (1 << 11)
# define R300_TX_MIN_FILTER_LINEAR (2 << 11)
+/* TODO: Test and verify R300_TX_MIN_FILTER_MASK */
+# define R300_TX_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 12)
+# define R300_TX_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 12)
+# define R300_TX_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 12)
+# define R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 12)
+# define R300_TX_MIN_FILTER_ANISO_NEAREST (8 << 12)
+# define R300_TX_MIN_FILTER_ANISO_LINEAR (9 << 12)
+# define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 12)
+# define R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 12)
+
+# define R300_TX_MIN_FILTER_MASK (0x0000f800)
#define R300_TX_UNK1_0 0x4440
#define R300_TX_SIZE_0 0x4480
# define R300_TX_WIDTHMASK_SHIFT 0
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 249da09f27..d069f3512c 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -193,7 +193,7 @@ static void r300_render_immediate_primitive(r300ContextPtr rmesa,
GLuint i;
int k, type;
LOCAL_VARS
-
+
type=r300_get_primitive_type(rmesa, ctx, start, end, prim);
#if 0
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 7c09e3c026..142d34bd83 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -955,7 +955,12 @@ void r300_setup_textures(GLcontext *ctx)
r300->hw.txe.cmd[R300_TXE_ENABLE]|=(1<<i);
r300->hw.tex.filter.cmd[R300_TEX_VALUE_0+i]=t->filter;
- r300->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+i]=t->pitch;
+
+ /* Turn off rest of the bits that are wrong */
+ t->filter &= R300_TX_MIN_FILTER_MASK | R300_TX_MAG_FILTER_MASK;
+
+ /* No idea why linear filtered textures shake when puting random data */
+ /*r300->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+i]=(rand()%0xffffffff) & (~0x1fff);*/
r300->hw.tex.size.cmd[R300_TEX_VALUE_0+i]=t->size;
r300->hw.tex.format.cmd[R300_TEX_VALUE_0+i]=t->format;
r300->hw.tex.offset.cmd[R300_TEX_VALUE_0+i]=r300->radeon.radeonScreen->fbLocation+t->offset;
diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c
index 7577eb8ddd..33a8fa1e5c 100644
--- a/src/mesa/drivers/dri/r300/r300_tex.c
+++ b/src/mesa/drivers/dri/r300/r300_tex.c
@@ -66,7 +66,9 @@ static void r300SetTexWrap(r300TexObjPtr t, GLenum swrap, GLenum twrap,
{
GLboolean is_clamp = GL_FALSE;
GLboolean is_clamp_to_border = GL_FALSE;
-
+
+/* Most of these seem to be incorrect so disable for now */
+#if 0
t->filter &=
~(R200_CLAMP_S_MASK | R200_CLAMP_T_MASK | R200_BORDER_MODE_D3D);
@@ -176,10 +178,14 @@ static void r300SetTexWrap(r300TexObjPtr t, GLenum swrap, GLenum twrap,
}
t->border_fallback = (is_clamp && is_clamp_to_border);
+#endif
}
static void r300SetTexMaxAnisotropy(r300TexObjPtr t, GLfloat max)
{
+
+/* Needs testing */
+#if 0
t->filter &= ~R200_MAX_ANISO_MASK;
if (max == 1.0) {
@@ -193,6 +199,7 @@ static void r300SetTexMaxAnisotropy(r300TexObjPtr t, GLfloat max)
} else {
t->filter |= R200_MAX_ANISO_16_TO_1;
}
+#endif
}
/**
@@ -205,49 +212,51 @@ static void r300SetTexMaxAnisotropy(r300TexObjPtr t, GLfloat max)
static void r300SetTexFilter(r300TexObjPtr t, GLenum minf, GLenum magf)
{
- GLuint anisotropy = (t->filter & R200_MAX_ANISO_MASK);
+ GLuint anisotropy = 0; //(t->filter & R200_MAX_ANISO_MASK);
- t->filter &= ~(R200_MIN_FILTER_MASK | R200_MAG_FILTER_MASK);
- t->format_x &= ~R200_VOLUME_FILTER_MASK;
+ t->filter &= ~(R300_TX_MIN_FILTER_MASK | R300_TX_MAG_FILTER_MASK);
+#if 0
+ //t->format_x &= ~R200_VOLUME_FILTER_MASK;
+#endif
if (anisotropy == R200_MAX_ANISO_1_TO_1) {
switch (minf) {
case GL_NEAREST:
- t->filter |= R200_MIN_FILTER_NEAREST;
+ t->filter |= R300_TX_MIN_FILTER_NEAREST;
break;
case GL_LINEAR:
- t->filter |= R200_MIN_FILTER_LINEAR;
+ t->filter |= R300_TX_MIN_FILTER_LINEAR;
break;
case GL_NEAREST_MIPMAP_NEAREST:
- t->filter |= R200_MIN_FILTER_NEAREST_MIP_NEAREST;
+ t->filter |= R300_TX_MIN_FILTER_NEAREST_MIP_NEAREST;
break;
case GL_NEAREST_MIPMAP_LINEAR:
- t->filter |= R200_MIN_FILTER_LINEAR_MIP_NEAREST;
+ t->filter |= R300_TX_MIN_FILTER_LINEAR_MIP_NEAREST;
break;
case GL_LINEAR_MIPMAP_NEAREST:
- t->filter |= R200_MIN_FILTER_NEAREST_MIP_LINEAR;
+ t->filter |= R300_TX_MIN_FILTER_NEAREST_MIP_LINEAR;
break;
case GL_LINEAR_MIPMAP_LINEAR:
- t->filter |= R200_MIN_FILTER_LINEAR_MIP_LINEAR;
+ t->filter |= R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR;
break;
}
} else {
switch (minf) {
case GL_NEAREST:
- t->filter |= R200_MIN_FILTER_ANISO_NEAREST;
+ t->filter |= R300_TX_MIN_FILTER_ANISO_NEAREST;
break;
case GL_LINEAR:
- t->filter |= R200_MIN_FILTER_ANISO_LINEAR;
+ t->filter |= R300_TX_MIN_FILTER_ANISO_LINEAR;
break;
case GL_NEAREST_MIPMAP_NEAREST:
case GL_LINEAR_MIPMAP_NEAREST:
t->filter |=
- R200_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST;
+ R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST;
break;
case GL_NEAREST_MIPMAP_LINEAR:
case GL_LINEAR_MIPMAP_LINEAR:
t->filter |=
- R200_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR;
+ R300_TX_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR;
break;
}
}
@@ -257,12 +266,12 @@ static void r300SetTexFilter(r300TexObjPtr t, GLenum minf, GLenum magf)
*/
switch (magf) {
case GL_NEAREST:
- t->filter |= R200_MAG_FILTER_NEAREST;
- t->format_x |= R200_VOLUME_FILTER_NEAREST;
+ t->filter |= R300_TX_MAG_FILTER_NEAREST;
+ /*t->format_x |= R200_VOLUME_FILTER_NEAREST;*/
break;
case GL_LINEAR:
- t->filter |= R200_MAG_FILTER_LINEAR;
- t->format_x |= R200_VOLUME_FILTER_LINEAR;
+ t->filter |= R300_TX_MAG_FILTER_LINEAR;
+ /*t->format_x |= R200_VOLUME_FILTER_LINEAR;*/
break;
}
}
@@ -802,16 +811,15 @@ static void r300TexEnv(GLcontext * ctx, GLenum target,
fprintf(stderr, "%s( %s )\n",
__FUNCTION__, _mesa_lookup_enum_by_nr(pname));
}
-
- fprintf(stderr, "%s:%s I am broken - Fixme !\n", __FILE__, __FUNCTION__);
-
- #if 0
+
/* This is incorrect: Need to maintain this data for each of
* GL_TEXTURE_{123}D, GL_TEXTURE_RECTANGLE_NV, etc, and switch
* between them according to _ReallyEnabled.
*/
switch (pname) {
case GL_TEXTURE_ENV_COLOR:{
+ fprintf(stderr, "%s:%s I am broken - Fixme !\n", __FILE__, __FUNCTION__);
+ /*
GLubyte c[4];
GLuint envColor;
UNCLAMPED_FLOAT_TO_RGBA_CHAN(c, texUnit->EnvColor);
@@ -822,12 +830,11 @@ static void r300TexEnv(GLcontext * ctx, GLenum target,
envColor;
}
break;
- }
+ */}
case GL_TEXTURE_LOD_BIAS_EXT:{
GLfloat bias, min;
GLuint b;
- const int fixed_one = 0x8000000;
/* The R200's LOD bias is a signed 2's complement value with a
* range of -16.0 <= bias < 16.0.
@@ -839,15 +846,20 @@ static void r300TexEnv(GLcontext * ctx, GLenum target,
driQueryOptionb(&rmesa->radeon.optionCache,
"no_neg_lod_bias") ? 0.0 : -16.0;
bias = CLAMP(bias, min, 16.0);
- b = (int)(bias * fixed_one) & R200_LOD_BIAS_MASK;
-
- if ((rmesa->hw.tex[unit].
- cmd[TEX_PP_TXFORMAT_X] & R200_LOD_BIAS_MASK) !=
- b) {
- R200_STATECHANGE(rmesa, tex[unit]);
- rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] &=
- ~R200_LOD_BIAS_MASK;
- rmesa->hw.tex[unit].cmd[TEX_PP_TXFORMAT_X] |= b;
+
+#define R300_LOD_BIAS_MASK 0x1fff
+
+ /* 1.0 is 0x00000100 and 10.0 is 0x00000a00 --aet */
+
+ b = 0x1000 / 16.0 * bias;
+ /* No clue about negative biases but this would
+ seem logical if positive max is 0x1000 */
+ b &= R300_LOD_BIAS_MASK;
+
+ if(b != (rmesa->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+unit] & R300_LOD_BIAS_MASK)){
+ R300_STATECHANGE(rmesa, tex.unknown1);
+ rmesa->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+unit] &= ~R300_LOD_BIAS_MASK;
+ rmesa->hw.tex.unknown1.cmd[R300_TEX_VALUE_0+unit] |= b;
}
break;
}
@@ -855,7 +867,6 @@ static void r300TexEnv(GLcontext * ctx, GLenum target,
default:
return;
}
- #endif
}
/**
diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c
index fde17e3df6..15d3605d01 100644
--- a/src/mesa/drivers/dri/r300/r300_texstate.c
+++ b/src/mesa/drivers/dri/r300/r300_texstate.c
@@ -120,13 +120,16 @@ static void r300SetTexImages(r300ContextPtr rmesa,
t->format &= ~(R200_TXFORMAT_FORMAT_MASK |
R200_TXFORMAT_ALPHA_IN_MAP);
+#if 0
t->filter &= ~R200_YUV_TO_RGB;
-
+#endif
if (VALID_FORMAT(baseImage->TexFormat->MesaFormat)) {
t->format |=
tx_table[baseImage->TexFormat->MesaFormat].format;
+#if 0
t->filter |=
tx_table[baseImage->TexFormat->MesaFormat].filter;
+#endif
} else {
_mesa_problem(NULL, "unexpected texture format in %s",
__FUNCTION__);
@@ -241,9 +244,10 @@ static void r300SetTexImages(r300ContextPtr rmesa,
/* Hardware state:
*/
+#if 1
t->filter &= ~R200_MAX_MIP_LEVEL_MASK;
t->filter |= (numLevels - 1) << R200_MAX_MIP_LEVEL_SHIFT;
-
+#endif
t->format &= ~(R300_TX_FORMAT_WIDTH_MASK |
R300_TX_FORMAT_HEIGHT_MASK |
R200_TXFORMAT_CUBIC_MAP_ENABLE |