From: Vladimir Dergachev Date: Fri, 14 Jan 2005 06:39:14 +0000 (+0000) Subject: Remove redundant register. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=52f5ff525b18c360a2b4a2c96609905cacc36391;p=mesa.git Remove redundant register. Hook up some functions in r300Enable(). --- diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index dd3389a60d4..3d8f4e97118 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -303,8 +303,6 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.vpt.cmd[R300_VPT_CMD_0] = cmducs(R300_SE_VPORT_XSCALE, 6); ALLOC_STATE( unk2080, always, 2, "unk2080", 0 ); r300->hw.unk2080.cmd[0] = cmducs(0x2080, 1); - ALLOC_STATE( ovf, always, R300_OVF_CMDSIZE, "ovf", 0 ); - r300->hw.ovf.cmd[R300_OVF_CMD_0] = cmducs(R300_VAP_OUTPUT_VTX_FMT_0, 2); ALLOC_STATE( vte, always, 3, "vte", 0 ); r300->hw.vte.cmd[0] = cmducs(R300_SE_VTE_CNTL, 2); ALLOC_STATE( unk2134, always, 3, "unk2134", 0 ); @@ -462,7 +460,6 @@ void r300InitCmdBuf(r300ContextPtr r300) insert_at_tail(&r300->hw.atomlist, &r300->hw.vpt); insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2080); - insert_at_tail(&r300->hw.atomlist, &r300->hw.ovf); insert_at_tail(&r300->hw.atomlist, &r300->hw.vte); insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2134); insert_at_tail(&r300->hw.atomlist, &r300->hw.unk2140); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index bee36f08b33..a561f31118e 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -209,11 +209,6 @@ struct r300_state_atom { #define R300_VPT_ZOFFSET 6 #define R300_VPT_CMDSIZE 7 -#define R300_OVF_CMD_0 0 -#define R300_OVF_FMT_0 1 -#define R300_OVF_FMT_1 2 -#define R300_OVF_CMDSIZE 3 - #define R300_VIR_CMD_0 0 /* vir is variable size (at least 1) */ #define R300_VIR_CNTL_0 1 #define R300_VIR_CNTL_1 2 @@ -375,7 +370,6 @@ struct r300_hw_state { struct r300_state_atom vpt; /* viewport (1D98) */ struct r300_state_atom unk2080; /* (2080) */ - struct r300_state_atom ovf; /* output vertex format (2090) */ struct r300_state_atom vte; /* (20B0) */ struct r300_state_atom unk2134; /* (2134) */ struct r300_state_atom unk2140; /* (2140) */ @@ -386,7 +380,7 @@ struct r300_hw_state { struct r300_state_atom unk2220; /* (2220) */ struct r300_state_atom unk2288; /* (2288) */ struct r300_state_atom pvs; /* pvs_cntl (22D0) */ - struct r300_state_atom vof; /* VAP output format register 0x4000 */ + struct r300_state_atom vof; /* VAP output format register 0x2090 */ struct r300_state_atom gb_enable; /* (4008) */ struct r300_state_atom gb_misc; /* Multisampling position shifts ? (4010) */ struct r300_state_atom unk4200; /* (4200) */ diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 9fb42108cb5..56dad7c0cfc 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -201,6 +201,25 @@ static int blend_factor(GLenum factor, GLboolean is_src) * and GL_FUNC_REVERSE_SUBTRACT will cause wrong results otherwise for * unknown reasons. */ + +/* helper function */ +static void r300_set_blend_cntl(r300ContextPtr rmesa, int func, int eqn, int cbits, int funcA, int eqnA) +{ + GLuint new_ablend, new_cblend; + + new_ablend = eqnA | funcA; + new_cblend = eqn | func | cbits; + if(rmesa->hw.bld.cmd[R300_BLD_ABLEND] == rmesa->hw.bld.cmd[R300_BLD_CBLEND]){ + new_cblend |= R300_BLEND_NO_SEPARATE; + } + if((new_ablend != rmesa->hw.bld.cmd[R300_BLD_ABLEND]) + || (new_cblend != rmesa->hw.bld.cmd[R300_BLD_CBLEND])){ + R300_STATECHANGE(rmesa, bld); + rmesa->hw.bld.cmd[R300_BLD_ABLEND]=new_ablend; + rmesa->hw.bld.cmd[R300_BLD_CBLEND]=new_cblend; + } +} + static void r300_set_blend_state(GLcontext * ctx) { r300ContextPtr rmesa = R300_CONTEXT(ctx); @@ -217,7 +236,6 @@ static void r300_set_blend_state(GLcontext * ctx) (R200_BLEND_GL_ZERO << R200_DST_BLEND_SHIFT); int eqnA = R200_COMB_FCN_ADD_CLAMP; - R300_STATECHANGE(rmesa, bld); if (rmesa->radeon.radeonScreen->drmSupportsBlendColor) { if (ctx->Color._LogicOpEnabled) { @@ -225,8 +243,9 @@ static void r300_set_blend_state(GLcontext * ctx) rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl | R300_ROP_ENABLE; #endif - rmesa->hw.bld.cmd[R300_BLD_ABLEND] = eqn | func; - rmesa->hw.bld.cmd[R300_BLD_CBLEND] = eqn | func; + r300_set_blend_cntl(rmesa, + func, eqn, 0, + func, eqn); return; } else if (ctx->Color.BlendEnabled) { #if 0 @@ -238,8 +257,9 @@ static void r300_set_blend_state(GLcontext * ctx) #if 0 rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl; #endif - rmesa->hw.bld.cmd[R300_BLD_ABLEND] = eqn | func; - rmesa->hw.bld.cmd[R300_BLD_CBLEND] = eqn | func; + r300_set_blend_cntl(rmesa, + func, eqn, 0, + func, eqn); return; } } else { @@ -260,6 +280,9 @@ static void r300_set_blend_state(GLcontext * ctx) rmesa->hw.ctx.cmd[CTX_RB3D_CNTL] = cntl; rmesa->hw.ctx.cmd[CTX_RB3D_BLENDCNTL] = eqn | func; #endif + r300_set_blend_cntl(rmesa, + func, eqn, 0, + func, eqn); return; } } @@ -346,14 +369,12 @@ static void r300_set_blend_state(GLcontext * ctx) return; } - rmesa->hw.bld.cmd[R300_BLD_ABLEND] = eqnA | funcA; - rmesa->hw.bld.cmd[R300_BLD_CBLEND] = eqn | func ; - if(rmesa->hw.bld.cmd[R300_BLD_ABLEND] == rmesa->hw.bld.cmd[R300_BLD_CBLEND]){ - rmesa->hw.bld.cmd[R300_BLD_CBLEND] |= R300_BLEND_UNKNOWN | R300_BLEND_ENABLE | R300_BLEND_NO_SEPARATE; - } else { - rmesa->hw.bld.cmd[R300_BLD_CBLEND] |= R300_BLEND_UNKNOWN | R300_BLEND_ENABLE; - } - + r300_set_blend_cntl(rmesa, + func, eqn, R300_BLEND_UNKNOWN | R300_BLEND_ENABLE, + funcA, eqnA); + r300_set_blend_cntl(rmesa, + func, eqn, R300_BLEND_UNKNOWN | R300_BLEND_ENABLE, + funcA, eqnA); } static void r300BlendEquationSeparate(GLcontext * ctx, @@ -412,6 +433,29 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state) state ? "GL_TRUE" : "GL_FALSE"); switch (cap) { + /* Fast track this one... + */ + case GL_TEXTURE_1D: + case GL_TEXTURE_2D: + case GL_TEXTURE_3D: + break; + + case GL_ALPHA_TEST: + R200_STATECHANGE(r300, at); + if (state) { + r300->hw.at.cmd[R300_AT_ALPHA_TEST] |= + R300_ALPHA_TEST_ENABLE; + } else { + r300->hw.at.cmd[R300_AT_ALPHA_TEST] |= + ~R300_ALPHA_TEST_ENABLE; + } + break; + + case GL_BLEND: + case GL_COLOR_LOGIC_OP: + r300_set_blend_state(ctx); + break; + case GL_DEPTH_TEST: R300_STATECHANGE(r300, zc); @@ -1333,9 +1377,6 @@ void r300ResetHwState(r300ContextPtr r300) //BEGIN: TODO r300->hw.unk2080.cmd[1] = 0x0030045A; - r300->hw.ovf.cmd[R300_OVF_FMT_0] = 0x00000003; - r300->hw.ovf.cmd[R300_OVF_FMT_1] = 0x00000000; - r300->hw.vte.cmd[1] = R300_VPORT_X_SCALE_ENA | R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA @@ -1609,7 +1650,7 @@ void r300InitStateFuncs(struct dd_function_table* functions) radeonInitStateFuncs(functions); functions->UpdateState = r300InvalidateState; - //functions->AlphaFunc = r300AlphaFunc; + functions->AlphaFunc = r300AlphaFunc; functions->BlendColor = r300BlendColor; functions->BlendEquationSeparate = r300BlendEquationSeparate; functions->BlendFuncSeparate = r300BlendFuncSeparate;