r300: move fragment program selection before vertex program selection
authorMaciej Cencora <m.cencora@gmail.com>
Sat, 4 Jul 2009 11:17:35 +0000 (13:17 +0200)
committerMaciej Cencora <m.cencora@gmail.com>
Mon, 13 Jul 2009 17:25:58 +0000 (19:25 +0200)
Prepare for wpos and fogc handling rewrite.

src/mesa/drivers/dri/r300/r300_state.c

index 8c228ab5e7bfb0a5e3c384e8a303c2ed6d3dd64b..344f021acf6a601a2605f961f814e3444bafd2e0 100644 (file)
@@ -2035,7 +2035,6 @@ static void r300ResetHwState(r300ContextPtr r300)
 void r300UpdateShaders(r300ContextPtr rmesa)
 {
        GLcontext *ctx = rmesa->radeon.glCtx;
-       struct r300_fragment_program *fp;
 
        /* should only happenen once, just after context is created */
        /* TODO: shouldn't we fallback to sw here? */
@@ -2044,21 +2043,34 @@ void r300UpdateShaders(r300ContextPtr rmesa)
                return;
        }
 
-       if (rmesa->radeon.NewGLState && rmesa->options.hw_tcl_enabled) {
+       {
+               struct r300_fragment_program *fp;
+
+               fp = r300SelectFragmentShader(ctx);
+               if (!fp->translated)
+                       r300TranslateFragmentShader(ctx, fp);
+
+               r300SwitchFallback(ctx, R300_FALLBACK_FRAGMENT_PROGRAM, fp->error);
+       }
+
+       if (rmesa->options.hw_tcl_enabled) {
                struct r300_vertex_program *vp;
-               int i;
-               for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
-                       rmesa->temp_attrib[i] =
-                           TNL_CONTEXT(ctx)->vb.AttribPtr[i];
-                       TNL_CONTEXT(ctx)->vb.AttribPtr[i] =
-                           &rmesa->dummy_attrib[i];
-               }
 
-               _tnl_UpdateFixedFunctionProgram(ctx);
+               if (rmesa->radeon.NewGLState) {
+                       int i;
+                       for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
+                               rmesa->temp_attrib[i] =
+                                   TNL_CONTEXT(ctx)->vb.AttribPtr[i];
+                               TNL_CONTEXT(ctx)->vb.AttribPtr[i] =
+                                   &rmesa->dummy_attrib[i];
+                       }
+
+                       _tnl_UpdateFixedFunctionProgram(ctx);
 
-               for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
-                       TNL_CONTEXT(ctx)->vb.AttribPtr[i] =
-                           rmesa->temp_attrib[i];
+                       for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) {
+                               TNL_CONTEXT(ctx)->vb.AttribPtr[i] =
+                                   rmesa->temp_attrib[i];
+                       }
                }
 
                vp = r300SelectVertexShader(ctx);
@@ -2068,12 +2080,6 @@ void r300UpdateShaders(r300ContextPtr rmesa)
                r300SwitchFallback(ctx, R300_FALLBACK_VERTEX_PROGRAM, vp->error);
        }
 
-       fp = r300SelectFragmentShader(ctx);
-       if (!fp->translated)
-               r300TranslateFragmentShader(ctx, fp);
-
-       r300SwitchFallback(ctx, R300_FALLBACK_FRAGMENT_PROGRAM, fp->error);
-
        r300UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
        rmesa->radeon.NewGLState = 0;
 }