summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/r300/r300_cmdbuf.c3
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h4
-rw-r--r--src/mesa/drivers/dri/r300/r300_emit.h1
-rw-r--r--src/mesa/drivers/dri/r300/r300_reg.h15
-rw-r--r--src/mesa/drivers/dri/r300/r300_shader.c1
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c20
6 files changed, 39 insertions, 5 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
index df825ba3b4..cd8b7228c6 100644
--- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c
+++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c
@@ -341,6 +341,8 @@ void r300InitCmdBuf(r300ContextPtr r300)
ALLOC_STATE( lsf, always, 2, "lsf", 0 );
r300->hw.lsf.cmd[0] = cmducs(R300_RE_LINE_STIPPLE_FACTOR, 1);
#endif
+ ALLOC_STATE( sm, always, 2, "sm", 0 );
+ r300->hw.sm.cmd[0] = cmducs(R300_RE_SHADE_MODEL, 1);
ALLOC_STATE( unk4260, always, 4, "unk4260", 0 );
r300->hw.unk4260.cmd[0] = cmducs(0x4260, 3);
ALLOC_STATE( unk4274, always, 5, "unk4274", 0 );
@@ -485,6 +487,7 @@ void r300InitCmdBuf(r300ContextPtr r300)
#endif
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4260);
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4274);
+ insert_at_tail(&r300->hw.atomlist, &r300->hw.sm);
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4288);
insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42A0);
insert_at_tail(&r300->hw.atomlist, &r300->hw.zbs);
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index fa6dbbf8af..86f7cfaba6 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -271,6 +271,9 @@ struct r300_state_atom {
#define R300_PS_POINTSIZE 1
#define R300_PS_CMDSIZE 2
+#define R300_SM_CMD_0 0
+#define R300_SM 1
+
#define R300_ZBS_CMD_0 0
#define R300_ZBS_T_FACTOR 1
#define R300_ZBS_T_CONSTANT 2
@@ -420,6 +423,7 @@ struct r300_hw_state {
#endif
struct r300_state_atom unk4260; /* (4260) */
struct r300_state_atom unk4274; /* (4274) */
+ struct r300_state_atom sm; /* shade model (4278) */
struct r300_state_atom unk4288; /* (4288) */
struct r300_state_atom unk42A0; /* (42A0) */
struct r300_state_atom zbs; /* zbias (42A4) */
diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h
index 6085ccf000..781d39514f 100644
--- a/src/mesa/drivers/dri/r300/r300_emit.h
+++ b/src/mesa/drivers/dri/r300/r300_emit.h
@@ -12,6 +12,7 @@
#define RADEON_CP_PACKET3_NOP 0xC0001000
#define RADEON_CP_PACKET3_NEXT_CHAR 0xC0001900
+#define RADEON_CP_PACKET3_UNK1B 0xC0001B00
#define RADEON_CP_PACKET3_PLY_NEXTSCAN 0xC0001D00
#define RADEON_CP_PACKET3_SET_SCISSORS 0xC0001E00
#define RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xC0002300
diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h
index 7242cbc892..32f4ebeea2 100644
--- a/src/mesa/drivers/dri/r300/r300_reg.h
+++ b/src/mesa/drivers/dri/r300/r300_reg.h
@@ -440,6 +440,11 @@ I am fairly certain that they are correct unless stated otherwise in comments.
/* Linestipple factor. 3a088889 == 1.0, 3baaaaa9 == 10.0 */
#define R300_RE_LINE_STIPPLE_FACTOR 0x4238
+#define R300_RE_SHADE_MODEL 0x4278
+# define R300_RE_SHADE_MODEL_SMOOTH 0x3aaaa
+# define R300_RE_SHADE_MODEL_FLAT 0x39595
+
+
#define R300_RE_POLYGON_MODE 0x4288
/* Not sure why there are duplicate of factor and constant values.
@@ -471,20 +476,19 @@ I am fairly certain that they are correct unless stated otherwise in comments.
/* BEGIN: Rasterization / Interpolators - many guesses
-// So far, 0_UNKOWN_7 has always been set.
// 0_UNKNOWN_18 has always been set except for clear operations.
// TC_CNT is the number of incoming texture coordinate sets (i.e. it depends
// on the vertex program, *not* the fragment program) */
#define R300_RS_CNTL_0 0x4300
# define R300_RS_CNTL_TC_CNT_SHIFT 2
# define R300_RS_CNTL_TC_CNT_MASK (7 << 2)
-# define R300_RS_CNTL_0_UNKNOWN_7 (1 << 7)
+# define R300_RS_CNTL_0_UNKNOWN_7 (1 << 7) /* Number of color interpolators used (shifted by 7) */
# define R300_RS_CNTL_0_UNKNOWN_18 (1 << 18)
/* Guess: RS_CNTL_1 holds the index of the highest used RS_ROUTE_n register. */
#define R300_RS_CNTL_1 0x4304
/* gap */
-/* Only used for texture coordinates (color seems to be always interpolated).
+/* Only used for texture coordinates.
// Use the source field to route texture coordinate input from the vertex program
// to the desired interpolator. Note that the source field is relative to the
// outputs the vertex program *actually* writes. If a vertex program only writes
@@ -1200,14 +1204,15 @@ I am fairly certain that they are correct unless stated otherwise in comments.
#define R300_VPI_OUT_OP_MIN (8 << 0)
#define R300_VPI_OUT_OP_SGE (9 << 0)
#define R300_VPI_OUT_OP_SLT (10 << 0)
-#define R300_VPI_OUT_OP_UNK1 (12 << 0) /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB */
+#define R300_VPI_OUT_OP_UNK12 (12 << 0) /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, vector(scalar, vector) */
#define R300_VPI_OUT_OP_EXP (65 << 0)
#define R300_VPI_OUT_OP_LOG (66 << 0)
+#define R300_VPI_OUT_OP_UNK67 (67 << 0) /* Used in fog computations, scalar(scalar) */
#define R300_VPI_OUT_OP_LIT (68 << 0)
#define R300_VPI_OUT_OP_POW (69 << 0)
#define R300_VPI_OUT_OP_RCP (70 << 0)
#define R300_VPI_OUT_OP_RSQ (72 << 0)
-#define R300_VPI_OUT_OP_UNK2 (73 << 0) /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB */
+#define R300_VPI_OUT_OP_UNK73 (73 << 0) /* Used in GL_POINT_DISTANCE_ATTENUATION_ARB, scalar(scalar) */
#define R300_VPI_OUT_OP_EX2 (75 << 0)
#define R300_VPI_OUT_OP_LG2 (76 << 0)
#define R300_VPI_OUT_OP_MAD_2 (128 << 0)
diff --git a/src/mesa/drivers/dri/r300/r300_shader.c b/src/mesa/drivers/dri/r300/r300_shader.c
index 0690b19a0c..c3c89e0215 100644
--- a/src/mesa/drivers/dri/r300/r300_shader.c
+++ b/src/mesa/drivers/dri/r300/r300_shader.c
@@ -74,6 +74,7 @@ void r300ProgramStringNotify(GLcontext *ctx, GLenum target,
case GL_VERTEX_PROGRAM_ARB:
vp->translated=GL_FALSE;
translate_vertex_shader(vp);
+ //debug_vp(ctx, vp);
break;
case GL_FRAGMENT_PROGRAM_ARB:
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 922113c920..3d9f6ee8fd 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -886,6 +886,23 @@ static void r300PolygonMode(GLcontext *ctx, GLenum face, GLenum mode)
}
}
+static void r300ShadeModel(GLcontext * ctx, GLenum mode)
+{
+ r300ContextPtr rmesa = R300_CONTEXT(ctx);
+
+ R300_STATECHANGE(rmesa, sm);
+ switch (mode) {
+ case GL_FLAT:
+ rmesa->hw.sm.cmd[R300_SM] = R300_RE_SHADE_MODEL_FLAT;
+ break;
+ case GL_SMOOTH:
+ rmesa->hw.sm.cmd[R300_SM] = R300_RE_SHADE_MODEL_SMOOTH;
+ break;
+ default:
+ return;
+ }
+}
+
static void r300StencilFunc(GLcontext * ctx, GLenum func,
GLint ref, GLuint mask)
{
@@ -2098,6 +2115,8 @@ void r300ResetHwState(r300ContextPtr r300)
r300DepthMask(ctx, ctx->Depth.Mask);
r300DepthFunc(ctx, ctx->Depth.Func);
+ r300ShadeModel(ctx, ctx->Light.ShadeModel);
+
/* stencil */
r300Enable(ctx, GL_STENCIL_TEST, ctx->Stencil.Enabled);
r300StencilMask(ctx, ctx->Stencil.WriteMask[0]);
@@ -2441,6 +2460,7 @@ void r300InitStateFuncs(struct dd_function_table* functions)
functions->DepthMask = r300DepthMask;
functions->CullFace = r300CullFace;
functions->FrontFace = r300FrontFace;
+ functions->ShadeModel = r300ShadeModel;
/* Stencil related */
functions->ClearStencil = r300ClearStencil;