summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAapo Tahkola <[email protected]>2005-02-20 03:01:09 +0000
committerAapo Tahkola <[email protected]>2005-02-20 03:01:09 +0000
commiteb6560bf2b1f4775045eb648abfa5b5ccbad8a7b (patch)
tree0a857862e374ddf1d6daf5b4f5f81bb0120f4b1b
parent35bc4ac68062afeae17f96b8f4173a599cfc7f05 (diff)
Adding support for front buffer mode, removing some code we dont really need and some new debugging stuff.
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.c4
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c56
-rw-r--r--src/mesa/drivers/dri/r300/r300_state.c93
3 files changed, 74 insertions, 79 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c
index 9466504cfca..ca9ee7c1ca5 100644
--- a/src/mesa/drivers/dri/r300/r300_context.c
+++ b/src/mesa/drivers/dri/r300/r300_context.c
@@ -217,9 +217,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual,
*/
ctx = r300->radeon.glCtx;
- if(ctx->Visual.doubleBufferMode == 0){
- fprintf(stderr, "Help me! Single buffer mode doesnt work yet.\n");
- }
+
ctx->Const.MaxTextureImageUnits = driQueryOptioni(&r300->radeon.optionCache,
"texture_image_units");
ctx->Const.MaxTextureCoordUnits = driQueryOptioni(&r300->radeon.optionCache,
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index 771459a2ab2..261886ebc4c 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -58,62 +58,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "r300_maos.h"
#include "r300_emit.h"
-/* Turns out we might not need this after all... */
-void update_zbias(GLcontext * ctx, int prim)
-{
- r300ContextPtr rmesa = R300_CONTEXT(ctx);
- int enabled = 0;
- uint32_t values[4];
- //return ;
- switch(prim & PRIM_MODE_MASK) {
- case GL_POINTS:
- if(ctx->Polygon.OffsetPoint == GL_TRUE)
- enabled=1;
- break;
- case GL_LINES:
- case GL_LINE_STRIP:
- case GL_LINE_LOOP:
- if(ctx->Polygon.OffsetLine == GL_TRUE)
- enabled=1;
- break;
- case GL_TRIANGLES:
- case GL_TRIANGLE_STRIP:
- case GL_TRIANGLE_FAN:
- case GL_QUADS:
- case GL_QUAD_STRIP:
- case GL_POLYGON:
- if(ctx->Polygon.OffsetFill == GL_TRUE)
- enabled=1;
- break;
- default:
- fprintf(stderr, "%s:%s Do not know how to handle primitive %02x - help me !\n",
- __FILE__, __FUNCTION__,
- prim & PRIM_MODE_MASK);
-
- }
-
- if(enabled){
- values[0]=values[2]=r300PackFloat32(ctx->Polygon.OffsetFactor * 12.0);
- values[1]=values[3]=r300PackFloat32(ctx->Polygon.OffsetUnits * 4.0);
- }else{
- values[0]=values[2]=r300PackFloat32(0.0);
- values[1]=values[3]=r300PackFloat32(0.0);
- }
-
- if(values[0] != rmesa->hw.zbs.cmd[R300_ZBS_T_FACTOR] ||
- values[1] != rmesa->hw.zbs.cmd[R300_ZBS_T_CONSTANT] ||
- values[2] != rmesa->hw.zbs.cmd[R300_ZBS_W_FACTOR] ||
- values[3] != rmesa->hw.zbs.cmd[R300_ZBS_W_CONSTANT]){
-
- R300_STATECHANGE(rmesa, zbs);
- rmesa->hw.zbs.cmd[R300_ZBS_T_FACTOR] = values[0];
- rmesa->hw.zbs.cmd[R300_ZBS_T_CONSTANT] = values[1];
- rmesa->hw.zbs.cmd[R300_ZBS_W_FACTOR] = values[2];
- rmesa->hw.zbs.cmd[R300_ZBS_W_CONSTANT] = values[3];
-
- }
-}
-
/**********************************************************************
* Hardware rasterization
*
diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c
index 3646507c3f4..b47957054db 100644
--- a/src/mesa/drivers/dri/r300/r300_state.c
+++ b/src/mesa/drivers/dri/r300/r300_state.c
@@ -1796,8 +1796,53 @@ static void r300InvalidateState(GLcontext * ctx, GLuint new_state)
r300ResetHwState(r300);
}
-void update_zbias(GLcontext * ctx, int prim);
-
+/* Checks that r300ResetHwState actually modifies all states.
+ Should probably be burried in somewhere else as this file is getting longish. */
+void verify_r300ResetHwState(r300ContextPtr r300, int stage)
+{
+ struct r300_state_atom* atom;
+ int i;
+ drm_r300_cmd_header_t cmd;
+
+ if(stage){ /* mess around with states */
+ unsigned long fp1, cb1;
+
+ fp1=r300->hw.fp.cmd[R300_FP_CMD_1]; /* some special cases... */
+ cb1=r300->hw.cb.cmd[R300_CB_CMD_1];
+
+ fprintf(stderr, "verify begin:\n");
+
+ foreach(atom, &r300->hw.atomlist) {
+ for(i=1; i < (*atom->check)(r300, atom); i++)
+ atom->cmd[i]=0xdeadbeef;
+ }
+ r300->hw.fp.cmd[R300_FP_CMD_1]=fp1;
+ r300->hw.cb.cmd[R300_CB_CMD_1]=cb1;
+
+ foreach(atom, &r300->hw.atomlist) {
+ cmd.u=atom->cmd[0];
+ switch(cmd.header.cmd_type){
+ case R300_CMD_UNCHECKED_STATE:
+ case R300_CMD_VPU:
+ case R300_CMD_PACKET3:
+ case R300_CMD_END3D:
+ case R300_CMD_CP_DELAY:
+ case R300_CMD_DMA_DISCARD:
+ break;
+ default: fprintf(stderr, "unknown cmd_type %d in atom %s\n",
+ cmd.header.cmd_type, atom->name);
+ }
+
+ }
+ } else { /* check that they were set */
+ foreach(atom, &r300->hw.atomlist) {
+ for(i=1; i < (*atom->check)(r300, atom); i++)
+ if(atom->cmd[i]==0xdeadbeef)
+ fprintf(stderr, "atom %s is untouched\n", atom->name);
+ }
+ }
+}
+
/**
* Completely recalculates hardware state based on the Mesa state.
*/
@@ -1809,6 +1854,8 @@ void r300ResetHwState(r300ContextPtr r300)
if (RADEON_DEBUG & DEBUG_STATE)
fprintf(stderr, "%s\n", __FUNCTION__);
+ //verify_r300ResetHwState(r300, 1);
+
/* This is a place to initialize registers which
have bitfields accessed by different functions
and not all bits are used */
@@ -1958,9 +2005,6 @@ void r300ResetHwState(r300ContextPtr r300)
r300PolygonMode(ctx, GL_FRONT, ctx->Polygon.FrontMode);
r300PolygonMode(ctx, GL_BACK, ctx->Polygon.BackMode);
-#if 0
- r300->hw.unk4288.cmd[1] = 0x00000000;
-#endif
r300->hw.unk4288.cmd[2] = 0x00000001;
r300->hw.unk4288.cmd[3] = 0x00000000;
r300->hw.unk4288.cmd[4] = 0x00000000;
@@ -1968,10 +2012,11 @@ void r300ResetHwState(r300ContextPtr r300)
r300->hw.unk42A0.cmd[1] = 0x00000000;
- update_zbias(ctx, GL_TRIANGLES);/* FIXME */
-#if 0
- r300->hw.unk42B4.cmd[1] = 0x00000000;
-#endif
+ r300PolygonOffset(ctx, ctx->Polygon.OffsetFactor, ctx->Polygon.OffsetUnits);
+ r300Enable(ctx, GL_POLYGON_OFFSET_POINT, ctx->Polygon.OffsetPoint);
+ r300Enable(ctx, GL_POLYGON_OFFSET_LINE, ctx->Polygon.OffsetLine);
+ r300Enable(ctx, GL_POLYGON_OFFSET_FILL, ctx->Polygon.OffsetFill);
+
r300->hw.unk42C0.cmd[1] = 0x4B7FFFFF;
r300->hw.unk42C0.cmd[2] = 0x00000000;
@@ -2029,18 +2074,25 @@ void r300ResetHwState(r300ContextPtr r300)
#endif
r300BlendColor(ctx, ctx->Color.BlendColor);
-#if 0
- r300->hw.unk4E10.cmd[1] = 0;
-#endif
r300->hw.unk4E10.cmd[2] = 0;
r300->hw.unk4E10.cmd[3] = 0;
-
- r300->hw.cb.cmd[R300_CB_OFFSET] =
- r300->radeon.radeonScreen->backOffset +
- r300->radeon.radeonScreen->fbLocation;
- r300->hw.cb.cmd[R300_CB_PITCH] = r300->radeon.radeonScreen->backPitch
- | R300_COLOR_UNKNOWN_22_23;
-
+
+ /* Again, r300ClearBuffer uses this */
+ if(ctx->Visual.doubleBufferMode){
+ r300->hw.cb.cmd[R300_CB_OFFSET] =
+ r300->radeon.radeonScreen->backOffset +
+ r300->radeon.radeonScreen->fbLocation;
+ r300->hw.cb.cmd[R300_CB_PITCH] = r300->radeon.radeonScreen->backPitch
+ | R300_COLOR_UNKNOWN_22_23;
+ } else {
+ r300->hw.cb.cmd[R300_CB_OFFSET] =
+ r300->radeon.radeonScreen->frontOffset +
+ r300->radeon.radeonScreen->fbLocation;
+ r300->hw.cb.cmd[R300_CB_PITCH] = r300->radeon.radeonScreen->frontPitch
+ | R300_COLOR_UNKNOWN_22_23;
+
+ }
+
r300->hw.unk4E50.cmd[1] = 0;
r300->hw.unk4E50.cmd[2] = 0;
r300->hw.unk4E50.cmd[3] = 0;
@@ -2099,6 +2151,7 @@ void r300ResetHwState(r300ContextPtr r300)
r300->hw.vps.cmd[R300_VPS_ZERO_3] = 0;
//END: TODO
+ //verify_r300ResetHwState(r300, 0);
r300->hw.all_dirty = GL_TRUE;
}
@@ -2139,7 +2192,7 @@ void r300InitState(r300ContextPtr r300)
ctx->Visual.depthBits == 24);
memset(&(r300->state.texture), 0, sizeof(r300->state.texture));
-
+
r300ResetHwState(r300);
}