drivers: don't include texformat.h
[mesa.git] / src / mesa / drivers / dri / r600 / r700_state.c
index 8571563149e57ee9bf664f2c50cc58ba93dbfe44..65f83b831548049096e4ebc6d27d09da37b205aa 100644 (file)
@@ -46,7 +46,6 @@
 #include "shader/prog_parameter.h"
 #include "shader/prog_statevars.h"
 #include "vbo/vbo.h"
-#include "main/texformat.h"
 
 #include "r600_context.h"
 
@@ -92,7 +91,25 @@ void r700UpdateShaders (GLcontext * ctx)  //----------------------------------
            }
     }
 
-    r700SelectVertexShader(ctx);
+    r700SelectVertexShader(ctx, 1);
+    r700UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
+    context->radeon.NewGLState = 0;
+}
+
+void r700UpdateShaders2(GLcontext * ctx)  
+{
+    context_t *context = R700_CONTEXT(ctx);
+
+    /* should only happenen once, just after context is created */
+    /* TODO: shouldn't we fallback to sw here? */
+    if (!ctx->FragmentProgram._Current) {
+           _mesa_fprintf(stderr, "No ctx->FragmentProgram._Current!!\n");
+           return;
+    }
+
+    r700SelectFragmentShader(ctx);
+
+    r700SelectVertexShader(ctx, 2);
     r700UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS);
     context->radeon.NewGLState = 0;
 }
@@ -171,6 +188,14 @@ static void r700InvalidateState(GLcontext * ctx, GLuint new_state) //-----------
            R600_STATECHANGE(context, db_target);
     }
 
+    if (new_state & (_NEW_LIGHT)) {
+           R600_STATECHANGE(context, su);
+           if (ctx->Light.ProvokingVertex == GL_LAST_VERTEX_CONVENTION)
+                   SETbit(r700->PA_SU_SC_MODE_CNTL.u32All, PROVOKING_VTX_LAST_bit);
+           else
+                   CLEARbit(r700->PA_SU_SC_MODE_CNTL.u32All, PROVOKING_VTX_LAST_bit);
+    }
+
     r700UpdateStateParameters(ctx, new_state);
 
     R600_STATECHANGE(context, cl);
@@ -1269,10 +1294,11 @@ void r700SetScissor(context_t *context) //---------------
                return;
        }
        if (context->radeon.state.scissor.enabled) {
+               /* r600 has exclusive scissors */
                x1 = context->radeon.state.scissor.rect.x1;
                y1 = context->radeon.state.scissor.rect.y1;
-               x2 = context->radeon.state.scissor.rect.x2;
-               y2 = context->radeon.state.scissor.rect.y2;
+               x2 = context->radeon.state.scissor.rect.x2 + 1;
+               y2 = context->radeon.state.scissor.rect.y2 + 1;
        } else {
                if (context->radeon.radeonScreen->driScreen->dri2.enabled) {
                        x1 = 0;