Merge remote branch 'origin/master' into pipe-video
[mesa.git] / src / mesa / drivers / dri / i965 / brw_curbe.c
index c79b0a79e5ca5b5b89f0e972a5365dfd7cb4e964..877b22fec19ad165ae29a67ca8448e698f8aa442 100644 (file)
@@ -35,9 +35,9 @@
 #include "main/context.h"
 #include "main/macros.h"
 #include "main/enums.h"
-#include "shader/prog_parameter.h"
-#include "shader/prog_print.h"
-#include "shader/prog_statevars.h"
+#include "program/prog_parameter.h"
+#include "program/prog_print.h"
+#include "program/prog_statevars.h"
 #include "intel_batchbuffer.h"
 #include "intel_regions.h"
 #include "brw_context.h"
@@ -55,7 +55,7 @@
  */
 static void calculate_curbe_offsets( struct brw_context *brw )
 {
-   GLcontext *ctx = &brw->intel.ctx;
+   struct gl_context *ctx = &brw->intel.ctx;
    /* CACHE_NEW_WM_PROG */
    const GLuint nr_fp_regs = (brw->wm.prog_data->nr_params + 15) / 16;
    
@@ -179,11 +179,9 @@ static GLfloat fixed_plane[6][4] = {
  */
 static void prepare_constant_buffer(struct brw_context *brw)
 {
-   GLcontext *ctx = &brw->intel.ctx;
+   struct gl_context *ctx = &brw->intel.ctx;
    const struct brw_vertex_program *vp =
       brw_vertex_program_const(brw->vertex_program);
-   const struct brw_fragment_program *fp =
-      brw_fragment_program_const(brw->fragment_program);
    const GLuint sz = brw->curbe.total_size;
    const GLuint bufsz = sz * 16 * sizeof(GLfloat);
    GLfloat *buf;
@@ -200,11 +198,11 @@ static void prepare_constant_buffer(struct brw_context *brw)
    if (brw->curbe.wm_size) {
       GLuint offset = brw->curbe.wm_start * 16;
 
-      _mesa_load_state_parameters(ctx, fp->program.Base.Parameters); 
-
       /* copy float constants */
-      for (i = 0; i < brw->wm.prog_data->nr_params; i++) 
-        buf[offset + i] = *brw->wm.prog_data->param[i];
+      for (i = 0; i < brw->wm.prog_data->nr_params; i++) {
+        buf[offset + i] = convert_param(brw->wm.prog_data->param_convert[i],
+                                        *brw->wm.prog_data->param[i]);
+      }
    }
 
 
@@ -244,29 +242,13 @@ static void prepare_constant_buffer(struct brw_context *brw)
       GLuint offset = brw->curbe.vs_start * 16;
       GLuint nr = brw->vs.prog_data->nr_params / 4;
 
-      if (brw->vertex_program->IsNVProgram)
-        _mesa_load_tracked_matrices(ctx);
-
-      /* Updates the ParamaterValues[i] pointers for all parameters of the
-       * basic type of PROGRAM_STATE_VAR.
+      /* Load the subset of push constants that will get used when
+       * we also have a pull constant buffer.
        */
-      _mesa_load_state_parameters(ctx, vp->program.Base.Parameters); 
-
-      if (vp->use_const_buffer) {
-        /* Load the subset of push constants that will get used when
-         * we also have a pull constant buffer.
-         */
-        for (i = 0; i < vp->program.Base.Parameters->NumParameters; i++) {
-           if (brw->vs.constant_map[i] != -1) {
-              assert(brw->vs.constant_map[i] <= nr);
-              memcpy(buf + offset + brw->vs.constant_map[i] * 4,
-                     vp->program.Base.Parameters->ParameterValues[i],
-                     4 * sizeof(float));
-           }
-        }
-      } else {
-        for (i = 0; i < nr; i++) {
-           memcpy(buf + offset + i * 4,
+      for (i = 0; i < vp->program.Base.Parameters->NumParameters; i++) {
+        if (brw->vs.constant_map[i] != -1) {
+           assert(brw->vs.constant_map[i] <= nr);
+           memcpy(buf + offset + brw->vs.constant_map[i] * 4,
                   vp->program.Base.Parameters->ParameterValues[i],
                   4 * sizeof(float));
         }