From 6a04cff065c9a28495fe515fb5d9cd159d53de71 Mon Sep 17 00:00:00 2001 From: Aapo Tahkola Date: Tue, 8 Feb 2005 19:26:59 +0000 Subject: [PATCH] Fix the bug and get zbias back into shape. There might still be some problems with initial zbias... --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 8 -------- src/mesa/drivers/dri/r300/r300_cmdbuf.h | 2 +- src/mesa/drivers/dri/r300/r300_context.h | 6 ++---- src/mesa/drivers/dri/r300/r300_ioctl.c | 14 ++++++++------ src/mesa/drivers/dri/r300/r300_render.c | 6 +----- src/mesa/drivers/dri/r300/r300_state.c | 12 +++++------- src/mesa/drivers/dri/r300/r300_tex.c | 1 + 7 files changed, 18 insertions(+), 31 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 0142db2d0fd..67ec2fedc51 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -349,14 +349,10 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.unk4288.cmd[0] = cmducs(0x4288, 5); ALLOC_STATE( unk42A0, always, 2, "unk42A0", 0 ); r300->hw.unk42A0.cmd[0] = cmducs(0x42A0, 1); -#ifdef HAVE_ZBS ALLOC_STATE( zbs, always, R300_ZBS_CMDSIZE, "zbs", 0 ); r300->hw.zbs.cmd[R300_ZBS_CMD_0] = cmducs(R300_RE_ZBIAS_T_FACTOR, 4); -#endif -#ifdef GA ALLOC_STATE( unk42B4, always, 2, "unk42B4", 0 ); r300->hw.unk42B4.cmd[0] = cmducs(0x42B4, 1); -#endif ALLOC_STATE( cul, always, R300_CUL_CMDSIZE, "cul", 0 ); r300->hw.cul.cmd[R300_CUL_CMD_0] = cmducs(R300_RE_CULL_CNTL, 1); ALLOC_STATE( unk42C0, always, 3, "unk42C0", 0 ); @@ -490,12 +486,8 @@ void r300InitCmdBuf(r300ContextPtr r300) insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4274); insert_at_tail(&r300->hw.atomlist, &r300->hw.unk4288); insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42A0); -#ifdef HAVE_ZBS insert_at_tail(&r300->hw.atomlist, &r300->hw.zbs); -#endif -#ifdef GA insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42B4); -#endif insert_at_tail(&r300->hw.atomlist, &r300->hw.cul); insert_at_tail(&r300->hw.atomlist, &r300->hw.unk42C0); insert_at_tail(&r300->hw.atomlist, &r300->hw.rc); diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.h b/src/mesa/drivers/dri/r300/r300_cmdbuf.h index b762015882d..7f30f15562d 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.h +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.h @@ -38,6 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_context.h" +extern int r300FlushCmdBufLocked(r300ContextPtr r300, const char* caller); extern int r300FlushCmdBuf(r300ContextPtr r300, const char* caller); extern void r300EmitState(r300ContextPtr r300); @@ -45,7 +46,6 @@ extern void r300EmitState(r300ContextPtr r300); extern void r300InitCmdBuf(r300ContextPtr r300); extern void r300DestroyCmdBuf(r300ContextPtr r300); - /** * Make sure that enough space is available in the command buffer * by flushing if necessary. diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index eaec08d6027..428614b7a65 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -407,10 +407,8 @@ struct r300_hw_state { struct r300_state_atom unk4274; /* (4274) */ struct r300_state_atom unk4288; /* (4288) */ struct r300_state_atom unk42A0; /* (42A0) */ -#ifdef HAVE_ZBS -#endif - //struct r300_state_atom zbs; /* zbias (42A4) */ - //struct r300_state_atom unk42B4; /* (42B4) */ + struct r300_state_atom zbs; /* zbias (42A4) */ + struct r300_state_atom unk42B4; /* (42B4) */ struct r300_state_atom cul; /* cull cntl (42B8) */ struct r300_state_atom unk42C0; /* (42C0) */ struct r300_state_atom rc; /* rs control (4300) */ diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c index 84b475d064c..6ba5bf257aa 100644 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ b/src/mesa/drivers/dri/r300/r300_ioctl.c @@ -281,7 +281,8 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all, if (dPriv->numClipRects == 0) return; } -#ifdef HAVE_ZBS + +#if 0 /* We shouldnt need this now */ /* When unk42B4==0 z-bias is still on for vb mode with points ... */ R300_STATECHANGE(r300, zbs); zbs[0]=r300->hw.zbs.cmd[R300_ZBS_T_FACTOR]; @@ -293,12 +294,12 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all, r300->hw.zbs.cmd[R300_ZBS_T_CONSTANT] = r300->hw.zbs.cmd[R300_ZBS_W_FACTOR] = r300->hw.zbs.cmd[R300_ZBS_W_CONSTANT] = r300PackFloat32(0.0); - +#endif /* Make sure z-bias isnt on */ R300_STATECHANGE(r300, unk42B4); unk42B4=r300->hw.unk42B4.cmd[1]; - r300->hw.unk42B4.cmd[1]=0;//3; -#endif + r300->hw.unk42B4.cmd[1]=0; + if (mask & DD_FRONT_LEFT_BIT) { flags |= DD_FRONT_LEFT_BIT; mask &= ~DD_FRONT_LEFT_BIT; @@ -340,10 +341,11 @@ static void r300Clear(GLcontext * ctx, GLbitfield mask, GLboolean all, * but do keep it like this for now. */ r300ResetHwState(r300); -#ifdef HAVE_ZBS + R300_STATECHANGE(r300, unk42B4); r300->hw.unk42B4.cmd[1]=unk42B4; +#if 0 /* We shouldnt need this now */ /* Put real z-bias back */ R300_STATECHANGE(r300, zbs); r300->hw.zbs.cmd[R300_ZBS_T_FACTOR] = zbs[0]; @@ -407,7 +409,7 @@ void r300RefillCurrentDmaRegion(r300ContextPtr rmesa) break; if (rmesa->dma.nr_released_bufs) { - r200FlushCmdBufLocked(rmesa, __FUNCTION__); + r300FlushCmdBufLocked(rmesa, __FUNCTION__); } if (rmesa->radeon.do_usleeps) { diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index cbe7d91d1af..1b4f74c4e8b 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -58,8 +58,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_emit.h" - -#ifdef HAVE_ZBS /* Turns out we might not need this after all... */ void update_zbias(GLcontext * ctx, int prim) { @@ -115,7 +113,6 @@ void update_zbias(GLcontext * ctx, int prim) } } -#endif /********************************************************************** * Hardware rasterization @@ -664,7 +661,7 @@ static GLboolean r300_run_vb_render(GLcontext *ctx, end_3d(PASS_PREFIX_VOID); /* Flush state - we are done drawing.. */ - r300FlushCmdBufLocked(ctx, __FUNCTION__); + r300FlushCmdBufLocked(rmesa, __FUNCTION__); radeonWaitForIdleLocked(&(rmesa->radeon)); UNLOCK_HARDWARE(&(rmesa->radeon)); @@ -692,7 +689,6 @@ static GLboolean r300_run_render(GLcontext *ctx, #if 1 #if 0 - return r300_run_immediate_render(ctx, stage); #else return r300_run_vb_render(ctx, stage); diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index f31c9f0aa33..38a61ae6c8e 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -498,7 +498,7 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) case GL_CULL_FACE: r300UpdateCulling(ctx); break; -#ifdef HAVE_ZBS + case GL_POLYGON_OFFSET_POINT: case GL_POLYGON_OFFSET_LINE: WARN_ONCE("Don't know how to enable polygon offset point/line. Help me !\n"); @@ -512,7 +512,7 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) r300->hw.unk42B4.cmd[1] &= ~3; } break; -#endif + case GL_VERTEX_PROGRAM_ARB: //TCL_FALLBACK(rmesa->glCtx, R200_TCL_FALLBACK_TCL_DISABLE, state); break; @@ -1792,10 +1792,10 @@ void r300ResetHwState(r300ContextPtr r300) r300->hw.unk4288.cmd[5] = 0x00000000; r300->hw.unk42A0.cmd[1] = 0x00000000; -#ifdef GA -#ifndef HAVE_ZBS + + update_zbias(ctx, GL_TRIANGLES);/* FIXME */ +#if 0 r300->hw.unk42B4.cmd[1] = 0x00000000; -#endif #endif r300->hw.unk42C0.cmd[1] = 0x4B7FFFFF; r300->hw.unk42C0.cmd[2] = 0x00000000; @@ -1995,7 +1995,5 @@ void r300InitStateFuncs(struct dd_function_table* functions) functions->DepthRange = r300DepthRange; functions->PointSize = r300PointSize; -#ifdef HAVE_ZBS functions->PolygonOffset = r300PolygonOffset; -#endif } diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index b81b7e64c6b..7019f1b75c0 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -999,6 +999,7 @@ static struct gl_texture_object *r300NewTextureObject(GLcontext * ctx, if (!obj) return NULL; obj->MaxAnisotropy = rmesa->initialMaxAnisotropy; + rmesa->initialMaxAnisotropy); r300AllocTexObj(obj); return obj; } -- 2.30.2