summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOliver McFadden <z3ro.geek@gmail.com>2007-07-13 02:11:58 +0000
committerOliver McFadden <z3ro.geek@gmail.com>2007-07-13 04:51:36 +0000
commit42dcdb9372f541f35c06920368946ebe24696fc4 (patch)
tree65020e53bf2881437dd51c1ca7b2f663b7728151 /src
parent08a005e076d4520f564881e4c7e54b47cc7e20c3 (diff)
r300: Moved some hardware initialization into appropriate functions.
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index d6f477bbf5..48d92da211 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -82,6 +82,8 @@ static void r300BlendColor(GLcontext * ctx, const GLfloat cf[4])
rmesa->hw.blend_color.cmd[1] = PACK_COLOR_8888(color[3], color[0],
color[1], color[2]);
+ rmesa->hw.blend_color.cmd[2] = 0;
+ rmesa->hw.blend_color.cmd[3] = 0;
}
/**
@@ -358,6 +360,20 @@ static void r300SetEarlyZState(GLcontext * ctx)
r300ContextPtr r300 = R300_CONTEXT(ctx);
R300_STATECHANGE(r300, zstencil_format);
+ switch (ctx->Visual.depthBits) {
+ case 16:
+ r300->hw.zstencil_format.cmd[1] = R300_DEPTH_FORMAT_16BIT_INT_Z;
+ break;
+ case 24:
+ r300->hw.zstencil_format.cmd[1] = R300_DEPTH_FORMAT_24BIT_INT_Z;
+ break;
+ default:
+ fprintf(stderr, "Error: Unsupported depth %d... exiting\n", ctx->Visual.depthBits);
+ _mesa_exit(-1);
+ }
+
+ // r300->hw.zstencil_format.cmd[1] |= R300_DEPTH_FORMAT_UNK32;
+
if (ctx->Color.AlphaEnabled && ctx->Color.AlphaFunc != GL_ALWAYS)
/* disable early Z */
r300->hw.zstencil_format.cmd[2] = R300_EARLY_Z_DISABLE;
@@ -369,6 +385,9 @@ static void r300SetEarlyZState(GLcontext * ctx)
/* disable early Z */
r300->hw.zstencil_format.cmd[2] = R300_EARLY_Z_DISABLE;
}
+
+ r300->hw.zstencil_format.cmd[3] = 0x00000003;
+ r300->hw.zstencil_format.cmd[4] = 0x00000000;
}
static void r300SetAlphaState(GLcontext * ctx)
@@ -417,6 +436,7 @@ static void r300SetAlphaState(GLcontext * ctx)
R300_STATECHANGE(r300, at);
r300->hw.at.cmd[R300_AT_ALPHA_TEST] = pp_misc;
+ r300->hw.at.cmd[R300_AT_UNKNOWN] = 0;
r300SetEarlyZState(ctx);
}
@@ -527,6 +547,9 @@ static void r300UpdatePolygonMode(GLcontext * ctx)
R300_STATECHANGE(r300, polygon_mode);
r300->hw.polygon_mode.cmd[1] = hw_mode;
}
+
+ r300->hw.polygon_mode.cmd[2] = 0x00000001;
+ r300->hw.polygon_mode.cmd[3] = 0x00000000;
}
/**
@@ -776,6 +799,7 @@ static void r300ShadeModel(GLcontext * ctx, GLenum mode)
r300ContextPtr rmesa = R300_CONTEXT(ctx);
R300_STATECHANGE(rmesa, shade);
+ rmesa->hw.shade.cmd[1] = 0x00000002;
switch (mode) {
case GL_FLAT:
rmesa->hw.shade.cmd[2] = R300_RE_SHADE_MODEL_FLAT;
@@ -786,6 +810,8 @@ static void r300ShadeModel(GLcontext * ctx, GLenum mode)
default:
return;
}
+ rmesa->hw.shade.cmd[3] = 0x00000000;
+ rmesa->hw.shade.cmd[4] = 0x00000000;
}
static void r300StencilFuncSeparate(GLcontext * ctx, GLenum face,
@@ -1862,15 +1888,10 @@ static void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk4260.cmd[2] = r300PackFloat32(0.0);
r300->hw.unk4260.cmd[3] = r300PackFloat32(1.0);
- r300->hw.shade.cmd[1] = 0x00000002;
r300ShadeModel(ctx, ctx->Light.ShadeModel);
- r300->hw.shade.cmd[3] = 0x00000000;
- r300->hw.shade.cmd[4] = 0x00000000;
r300PolygonMode(ctx, GL_FRONT, ctx->Polygon.FrontMode);
r300PolygonMode(ctx, GL_BACK, ctx->Polygon.BackMode);
- r300->hw.polygon_mode.cmd[2] = 0x00000001;
- r300->hw.polygon_mode.cmd[3] = 0x00000000;
r300->hw.zbias_cntl.cmd[1] = 0x00000000;
r300PolygonOffset(ctx, ctx->Polygon.OffsetFactor,
@@ -1901,14 +1922,11 @@ static void r300ResetHwState(r300ContextPtr r300)
r300Fogfv(ctx, GL_FOG_COLOR, ctx->Fog.Color);
r300Fogfv(ctx, GL_FOG_COORDINATE_SOURCE_EXT, NULL);
- r300->hw.at.cmd[R300_AT_UNKNOWN] = 0;
r300->hw.unk4BD8.cmd[1] = 0;
r300->hw.unk4E00.cmd[1] = 0;
r300BlendColor(ctx, ctx->Color.BlendColor);
- r300->hw.blend_color.cmd[2] = 0;
- r300->hw.blend_color.cmd[3] = 0;
/* Again, r300ClearBuffer uses this */
r300->hw.cb.cmd[R300_CB_OFFSET] =
@@ -1939,25 +1957,6 @@ static void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk4EA0.cmd[1] = 0x00000000;
r300->hw.unk4EA0.cmd[2] = 0xffffffff;
- switch (ctx->Visual.depthBits) {
- case 16:
- r300->hw.zstencil_format.cmd[1] = R300_DEPTH_FORMAT_16BIT_INT_Z;
- break;
- case 24:
- r300->hw.zstencil_format.cmd[1] = R300_DEPTH_FORMAT_24BIT_INT_Z;
- break;
- default:
- fprintf(stderr, "Error: Unsupported depth %d... exiting\n",
- ctx->Visual.depthBits);
- _mesa_exit(-1);
-
- }
- /* z compress? */
- //r300->hw.zstencil_format.cmd[1] |= R300_DEPTH_FORMAT_UNK32;
-
- r300->hw.zstencil_format.cmd[3] = 0x00000003;
- r300->hw.zstencil_format.cmd[4] = 0x00000000;
-
r300->hw.zb.cmd[R300_ZB_OFFSET] =
r300->radeon.radeonScreen->depthOffset +
r300->radeon.radeonScreen->fbLocation;