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 );
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);
#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
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) */
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) */
* 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);
(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) {
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
#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 {
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;
}
}
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,
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);
//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
radeonInitStateFuncs(functions);
functions->UpdateState = r300InvalidateState;
- //functions->AlphaFunc = r300AlphaFunc;
+ functions->AlphaFunc = r300AlphaFunc;
functions->BlendColor = r300BlendColor;
functions->BlendEquationSeparate = r300BlendEquationSeparate;
functions->BlendFuncSeparate = r300BlendFuncSeparate;