Add suitable definitions for the _REV formats, plus a comment
[mesa.git] / src / mesa / drivers / dri / r300 / r300_state.c
index da953ae2ace0d485380b5c00530a1b991a97df3b..ad2cdf585a5c8aad55cc8ccf54a533412cf7bf2c 100644 (file)
@@ -69,7 +69,7 @@ static void r300AlphaFunc(GLcontext * ctx, GLenum func, GLfloat ref)
        GLubyte refByte;
 
        CLAMPED_FLOAT_TO_UBYTE(refByte, ref);
-
+       
        R300_STATECHANGE(rmesa, at);
 
        pp_misc &= ~(R300_ALPHA_TEST_OP_MASK | R300_REF_ALPHA_MASK);
@@ -459,12 +459,12 @@ static void r300Enable(GLcontext* ctx, GLenum cap, GLboolean state)
                break;
 
        case GL_ALPHA_TEST:
-               R200_STATECHANGE(r300, at);
+               R300_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->hw.at.cmd[R300_AT_ALPHA_TEST] &=
                            ~R300_ALPHA_TEST_ENABLE;
                }
                break;
@@ -1353,7 +1353,8 @@ void r300_setup_textures(GLcontext *ctx)
        }
        
        for(i=0; i < mtu; i++) {
-               
+               /*if(ctx->Texture.Unit[i].Enabled == 0)
+                       continue;*/
                if( ((r300->state.render_inputs & (_TNL_BIT_TEX0<<i))!=0) != ((ctx->Texture.Unit[i].Enabled)!=0) ) {
                        WARN_ONCE("Mismatch between render_inputs and ctx->Texture.Unit[i].Enabled value.\n");
                }
@@ -1997,8 +1998,10 @@ void r300ResetHwState(r300ContextPtr r300)
        r300SetupPixelShader(r300);
 
        r300_set_blend_state(ctx);
-       r300AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
 
+       r300AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
+       r300Enable(ctx, GL_ALPHA_TEST, ctx->Color.AlphaEnabled);
+               
                /* Initialize magic registers
                 TODO : learn what they really do, or get rid of
                 those we don't have to touch */
@@ -2067,6 +2070,10 @@ void r300ResetHwState(r300ContextPtr r300)
                r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = R300_GB_TILE_ENABLE
                                                        | R300_GB_TILE_PIPE_COUNT_R300
                                                        | R300_GB_TILE_SIZE_16;
+       else if (GET_CHIP(r300->radeon.radeonScreen) == RADEON_CHIP_R420)
+               r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = R300_GB_TILE_ENABLE
+                                                       | R300_GB_TILE_PIPE_COUNT_R420
+                                                       | R300_GB_TILE_SIZE_16;
        else
                r300->hw.gb_misc.cmd[R300_GB_MISC_TILE_CONFIG] = R300_GB_TILE_ENABLE
                                                        | R300_GB_TILE_PIPE_COUNT_RV300
@@ -2163,10 +2170,6 @@ void r300ResetHwState(r300ContextPtr r300)
        r300->hw.unk4BC8.cmd[2] = 0;
        r300->hw.unk4BC8.cmd[3] = 0;
 
-       //r300AlphaFunc(ctx, ctx->Color.AlphaFunc, ctx->Color.AlphaRef);
-#if 0
-       r300->hw.at.cmd[R300_AT_ALPHA_TEST] = 0;
-#endif
 
        r300->hw.at.cmd[R300_AT_UNKNOWN] = 0;
        r300->hw.unk4BD8.cmd[1] = 0;