summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/r300_state.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_state.c')
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c126
1 files changed, 55 insertions, 71 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index b235baaf10..bdd6855802 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -715,8 +715,8 @@ static void r300LineWidth(GLcontext * ctx, GLfloat widthf)
widthf = ctx->Line._Width;
R300_STATECHANGE(r300, lcntl);
- r300->hw.lcntl.cmd[1] = (int)(widthf * 6.0);
- r300->hw.lcntl.cmd[1] |= R300_LINE_CNT_VE;
+ r300->hw.lcntl.cmd[1] =
+ R300_LINE_CNT_HO | R300_LINE_CNT_VE | (int)(widthf * 6.0);
}
static void r300PolygonMode(GLcontext * ctx, GLenum face, GLenum mode)
@@ -1354,6 +1354,17 @@ union r300_outputs_written {
static void r300SetupRSUnit(GLcontext * ctx)
{
r300ContextPtr r300 = R300_CONTEXT(ctx);
+ /* I'm still unsure if these are needed */
+ GLuint interp_magic[8] = {
+ 0x00,
+ R300_RS_INTERP_1_UNKNOWN,
+ R300_RS_INTERP_2_UNKNOWN,
+ R300_RS_INTERP_3_UNKNOWN,
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00
+ };
union r300_outputs_written OutputsWritten;
GLuint InputsRead;
int fp_reg, high_rr;
@@ -1361,11 +1372,9 @@ static void r300SetupRSUnit(GLcontext * ctx)
int i;
if (hw_tcl_on)
- OutputsWritten.vp_outputs =
- CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten;
+ OutputsWritten.vp_outputs = CURRENT_VERTEX_SHADER(ctx)->key.OutputsWritten;
else
- RENDERINPUTS_COPY(OutputsWritten.index_bitset,
- r300->state.render_inputs_bitset);
+ RENDERINPUTS_COPY(OutputsWritten.index_bitset, r300->state.render_inputs_bitset);
if (ctx->FragmentProgram._Current)
InputsRead = ctx->FragmentProgram._Current->Base.InputsRead;
@@ -1397,9 +1406,8 @@ static void r300SetupRSUnit(GLcontext * ctx)
}
for (i = 0; i < ctx->Const.MaxTextureUnits; i++) {
- r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = 0
- | R300_RS_INTERP_USED
- | (in_texcoords << R300_RS_INTERP_SRC_SHIFT);
+ r300->hw.ri.cmd[R300_RI_INTERP_0 + i] = 0 | R300_RS_INTERP_USED | (in_texcoords << R300_RS_INTERP_SRC_SHIFT)
+ | interp_magic[i];
r300->hw.rr.cmd[R300_RR_ROUTE_0 + fp_reg] = 0;
if (InputsRead & (FRAG_BIT_TEX0 << i)) {
@@ -1408,65 +1416,45 @@ static void r300SetupRSUnit(GLcontext * ctx)
| (fp_reg << R300_RS_ROUTE_DEST_SHIFT);
high_rr = fp_reg;
- if (!R300_OUTPUTS_WRITTEN_TEST
- (OutputsWritten, VERT_RESULT_TEX0 + i,
- _TNL_ATTRIB_TEX(i))) {
- /* Passing invalid data here can lock the GPU. */
- WARN_ONCE
- ("fragprog wants coords for tex%d, vp doesn't provide them!\n",
- i);
- //_mesa_print_program(&CURRENT_VERTEX_SHADER(ctx)->Base);
- //_mesa_exit(-1);
+ /* Passing invalid data here can lock the GPU. */
+ if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_TEX0 + i, _TNL_ATTRIB_TEX(i))) {
+ InputsRead &= ~(FRAG_BIT_TEX0 << i);
+ fp_reg++;
+ } else {
+ WARN_ONCE("fragprog wants coords for tex%d, vp doesn't provide them!\n", i);
}
- InputsRead &= ~(FRAG_BIT_TEX0 << i);
- fp_reg++;
}
/* Need to count all coords enabled at vof */
- if (R300_OUTPUTS_WRITTEN_TEST
- (OutputsWritten, VERT_RESULT_TEX0 + i, _TNL_ATTRIB_TEX(i)))
+ if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_TEX0 + i, _TNL_ATTRIB_TEX(i))) {
in_texcoords++;
+ }
}
if (InputsRead & FRAG_BIT_COL0) {
- if (!R300_OUTPUTS_WRITTEN_TEST
- (OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) {
- WARN_ONCE
- ("fragprog wants col0, vp doesn't provide it\n");
- goto out; /* FIXME */
- //_mesa_print_program(&CURRENT_VERTEX_SHADER(ctx)->Base);
- //_mesa_exit(-1);
+ if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL0, _TNL_ATTRIB_COLOR0)) {
+ r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0 | R300_RS_ROUTE_0_COLOR | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
+ InputsRead &= ~FRAG_BIT_COL0;
+ col_interp_nr++;
+ } else {
+ WARN_ONCE("fragprog wants col0, vp doesn't provide it\n");
}
-
- r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0
- | R300_RS_ROUTE_0_COLOR
- | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
- InputsRead &= ~FRAG_BIT_COL0;
- col_interp_nr++;
}
- out:
if (InputsRead & FRAG_BIT_COL1) {
- if (!R300_OUTPUTS_WRITTEN_TEST
- (OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) {
- WARN_ONCE
- ("fragprog wants col1, vp doesn't provide it\n");
- //_mesa_exit(-1);
+ if (R300_OUTPUTS_WRITTEN_TEST(OutputsWritten, VERT_RESULT_COL1, _TNL_ATTRIB_COLOR1)) {
+ r300->hw.rr.cmd[R300_RR_ROUTE_1] |= R300_RS_ROUTE_1_UNKNOWN11 | R300_RS_ROUTE_1_COLOR1 | (fp_reg++ << R300_RS_ROUTE_1_COLOR1_DEST_SHIFT);
+ InputsRead &= ~FRAG_BIT_COL1;
+ if (high_rr < 1)
+ high_rr = 1;
+ col_interp_nr++;
+ } else {
+ WARN_ONCE("fragprog wants col1, vp doesn't provide it\n");
}
-
- r300->hw.rr.cmd[R300_RR_ROUTE_1] |=
- R300_RS_ROUTE_1_UNKNOWN11 | R300_RS_ROUTE_1_COLOR1 |
- (fp_reg++ << R300_RS_ROUTE_1_COLOR1_DEST_SHIFT);
- InputsRead &= ~FRAG_BIT_COL1;
- if (high_rr < 1)
- high_rr = 1;
- col_interp_nr++;
}
/* Need at least one. This might still lock as the values are undefined... */
if (in_texcoords == 0 && col_interp_nr == 0) {
- r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0
- | R300_RS_ROUTE_0_COLOR
- | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
+ r300->hw.rr.cmd[R300_RR_ROUTE_0] |= 0 | R300_RS_ROUTE_0_COLOR | (fp_reg++ << R300_RS_ROUTE_0_COLOR_DEST_SHIFT);
col_interp_nr++;
}
@@ -1475,17 +1463,13 @@ static void r300SetupRSUnit(GLcontext * ctx)
| R300_RS_CNTL_0_UNKNOWN_18;
assert(high_rr >= 0);
- r300->hw.rr.cmd[R300_RR_CMD_0] =
- cmdpacket0(R300_RS_ROUTE_0, high_rr + 1);
+ r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R300_RS_ROUTE_0, high_rr + 1);
r300->hw.rc.cmd[2] = 0xC0 | high_rr;
if (InputsRead)
- WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n",
- InputsRead);
+ WARN_ONCE("Don't know how to satisfy InputsRead=0x%08x\n", InputsRead);
}
-#define vpucount(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count)
-
#define bump_vpu_count(ptr, new_count) do{\
drm_r300_cmd_header_t* _p=((drm_r300_cmd_header_t*)(ptr));\
int _nc=(new_count)/4; \
@@ -1785,8 +1769,6 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state)
case GL_POLYGON_OFFSET_POINT:
case GL_POLYGON_OFFSET_LINE:
- break;
-
case GL_POLYGON_OFFSET_FILL:
R300_STATECHANGE(r300, occlusion_cntl);
if (state) {
@@ -1859,10 +1841,12 @@ static void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk2134.cmd[1] = 0x00FFFFFF;
r300->hw.unk2134.cmd[2] = 0x00000000;
- if (_mesa_little_endian())
- r300->hw.vap_cntl_status.cmd[1] = R300_VC_NO_SWAP;
- else
- r300->hw.vap_cntl_status.cmd[1] = R300_VC_32BIT_SWAP;
+
+#ifdef MESA_LITTLE_ENDIAN
+ r300->hw.vap_cntl_status.cmd[1] = R300_VC_NO_SWAP;
+#else
+ r300->hw.vap_cntl_status.cmd[1] = R300_VC_32BIT_SWAP;
+#endif
/* disable VAP/TCL on non-TCL capable chips */
if (!has_tcl)
@@ -1872,10 +1856,10 @@ static void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk221C.cmd[1] = R300_221C_NORMAL;
- r300->hw.unk2220.cmd[1] = r300PackFloat32(1.0);
- r300->hw.unk2220.cmd[2] = r300PackFloat32(1.0);
- r300->hw.unk2220.cmd[3] = r300PackFloat32(1.0);
- r300->hw.unk2220.cmd[4] = r300PackFloat32(1.0);
+ r300->hw.vap_clip.cmd[1] = r300PackFloat32(1.0); /* X */
+ r300->hw.vap_clip.cmd[2] = r300PackFloat32(1.0); /* X */
+ r300->hw.vap_clip.cmd[3] = r300PackFloat32(1.0); /* Y */
+ r300->hw.vap_clip.cmd[4] = r300PackFloat32(1.0); /* Y */
/* XXX: Other families? */
switch (r300->radeon.radeonScreen->chip_family) {
@@ -1930,13 +1914,13 @@ static void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk4214.cmd[1] = 0x00050005;
- r300PointSize(ctx, 0.0);
+ r300PointSize(ctx, 1.0);
r300->hw.unk4230.cmd[1] = 0x18000006;
r300->hw.unk4230.cmd[2] = 0x00020006;
r300->hw.unk4230.cmd[3] = r300PackFloat32(1.0 / 192.0);
- r300LineWidth(ctx, 0.0);
+ r300LineWidth(ctx, 1.0);
r300->hw.unk4260.cmd[1] = 0;
r300->hw.unk4260.cmd[2] = r300PackFloat32(0.0);
@@ -2152,7 +2136,7 @@ static void r300SetupPixelShader(r300ContextPtr rmesa)
tex_offset << R300_PFS_NODE_TEX_OFFSET_SHIFT)
| (fp->node[i].
tex_end << R300_PFS_NODE_TEX_END_SHIFT)
- | fp->node[i].flags; /* ( (k==3) ? R300_PFS_NODE_LAST_NODE : 0); */
+ | fp->node[i].flags;
} else {
rmesa->hw.fp.cmd[R300_FP_NODE0 + (3 - i)] = 0;
}