i965: Upload required gen6 VS push constants even when using pull constants.
authorEric Anholt <eric@anholt.net>
Thu, 28 Oct 2010 22:30:09 +0000 (15:30 -0700)
committerEric Anholt <eric@anholt.net>
Thu, 28 Oct 2010 22:38:38 +0000 (15:38 -0700)
Matches pre-gen6, and fixes glsl-vs-large-uniform-array.

src/mesa/drivers/dri/i965/gen6_vs_state.c

index 1d5c5701b37156e74d995d41ae0eb19e88eca440..d8da216d15f18c0e6e0228fe522390003fb36387 100644 (file)
@@ -40,12 +40,11 @@ upload_vs_state(struct brw_context *brw)
    struct gl_context *ctx = &intel->ctx;
    const struct brw_vertex_program *vp =
       brw_vertex_program_const(brw->vertex_program);
-   unsigned int nr_params = vp->program.Base.Parameters->NumParameters;
+   unsigned int nr_params = brw->vs.prog_data->nr_params / 4;
    drm_intel_bo *constant_bo;
    int i;
 
-   if (vp->use_const_buffer || (nr_params == 0 &&
-                               !ctx->Transform.ClipPlanesEnabled)) {
+   if (brw->vs.prog_data->nr_params == 0 && !ctx->Transform.ClipPlanesEnabled) {
       /* Disable the push constant buffers. */
       BEGIN_BATCH(5);
       OUT_BATCH(CMD_3D_CONSTANT_VS_STATE << 16 | (5 - 2));
@@ -89,11 +88,22 @@ upload_vs_state(struct brw_context *brw)
         params_uploaded++;
       }
 
-      for (i = 0; i < nr_params; i++) {
-        memcpy(param, vp->program.Base.Parameters->ParameterValues[i],
-               4 * sizeof(float));
-        param += 4;
-        params_uploaded++;
+      if (vp->use_const_buffer) {
+        for (i = 0; i < vp->program.Base.Parameters->NumParameters; i++) {
+           if (brw->vs.constant_map[i] != -1) {
+              memcpy(param + brw->vs.constant_map[i] * 4,
+                     vp->program.Base.Parameters->ParameterValues[i],
+                     4 * sizeof(float));
+              params_uploaded++;
+           }
+        }
+      } else {
+        for (i = 0; i < nr_params; i++) {
+           memcpy(param, vp->program.Base.Parameters->ParameterValues[i],
+                  4 * sizeof(float));
+           param += 4;
+           params_uploaded++;
+        }
       }
 
       if (0) {