i965/vec4: Make with_writemask() non-static.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_vs.c
index 6a67bc47042eabc9fc7bb820fca285d5ab103def..7c7493f96325e3eb15267af1d4510d5d560c1df4 100644 (file)
@@ -64,6 +64,11 @@ brw_compute_vue_map(struct brw_context *brw, struct brw_vue_map *vue_map,
    vue_map->slots_valid = slots_valid;
    int i;
 
+   /* gl_Layer doesn't get its own varying slot--it's stored in the virst VUE
+    * slot (VARYING_SLOT_PSIZ).
+    */
+   slots_valid &= ~VARYING_BIT_LAYER;
+
    /* Make sure that the values we store in vue_map->varying_to_slot and
     * vue_map->slot_to_varying won't overflow the signed chars that are used
     * to store them.  Note that since vue_map->slot_to_varying sometimes holds
@@ -234,8 +239,10 @@ do_vs_prog(struct brw_context *brw,
    } else {
       param_count = vp->program.Base.Parameters->NumParameters * 4;
    }
-   /* We also upload clip plane data as uniforms */
-   param_count += MAX_CLIP_PLANES * 4;
+   /* vec4_visitor::setup_uniform_clipplane_values() also uploads user clip
+    * planes as uniforms.
+    */
+   param_count += c.key.base.nr_userclip_plane_consts * 4;
 
    prog_data.base.param = rzalloc_array(NULL, const float *, param_count);
    prog_data.base.pull_param = rzalloc_array(NULL, const float *, param_count);
@@ -297,7 +304,7 @@ do_vs_prog(struct brw_context *brw,
       prog_data.base.total_scratch
          = brw_get_scratch_size(c.base.last_scratch*REG_SIZE);
 
-      brw_get_scratch_bo(brw, &brw->vs.scratch_bo,
+      brw_get_scratch_bo(brw, &brw->vs.base.scratch_bo,
                         prog_data.base.total_scratch * brw->max_vs_threads);
    }
 
@@ -305,7 +312,7 @@ do_vs_prog(struct brw_context *brw,
                    &c.key, sizeof(c.key),
                    program, program_size,
                    &prog_data, sizeof(prog_data),
-                   &brw->vs.prog_offset, &brw->vs.prog_data);
+                   &brw->vs.base.prog_offset, &brw->vs.prog_data);
    ralloc_free(mem_ctx);
 
    return true;
@@ -434,7 +441,7 @@ static void brw_upload_vs_prog(struct brw_context *brw)
    }
 
    /* _NEW_TEXTURE */
-   brw_populate_sampler_prog_key_data(ctx, prog, brw->vs.sampler_count,
+   brw_populate_sampler_prog_key_data(ctx, prog, brw->vs.base.sampler_count,
                                       &key.base.tex);
 
    /* BRW_NEW_VERTICES */
@@ -476,22 +483,23 @@ static void brw_upload_vs_prog(struct brw_context *brw)
 
    if (!brw_search_cache(&brw->cache, BRW_VS_PROG,
                         &key, sizeof(key),
-                        &brw->vs.prog_offset, &brw->vs.prog_data)) {
+                        &brw->vs.base.prog_offset, &brw->vs.prog_data)) {
       bool success = do_vs_prog(brw, ctx->Shader.CurrentVertexProgram,
                                vp, &key);
-
+      (void) success;
       assert(success);
    }
    if (memcmp(&brw->vs.prog_data->base.vue_map, &brw->vue_map_geom_out,
               sizeof(brw->vue_map_geom_out)) != 0) {
       brw->vue_map_vs = brw->vs.prog_data->base.vue_map;
       brw->state.dirty.brw |= BRW_NEW_VUE_MAP_VS;
-
-      /* No geometry shader support yet, so the VS VUE map is the VUE map for
-       * the output of the "geometry" portion of the pipeline.
-       */
-      brw->vue_map_geom_out = brw->vue_map_vs;
-      brw->state.dirty.brw |= BRW_NEW_VUE_MAP_GEOM_OUT;
+      if (brw->gen < 7) {
+         /* No geometry shader support, so the VS VUE map is the VUE map for
+          * the output of the "geometry" portion of the pipeline.
+          */
+         brw->vue_map_geom_out = brw->vue_map_vs;
+         brw->state.dirty.brw |= BRW_NEW_VUE_MAP_GEOM_OUT;
+      }
    }
 }
 
@@ -514,7 +522,7 @@ brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
 {
    struct brw_context *brw = brw_context(ctx);
    struct brw_vs_prog_key key;
-   uint32_t old_prog_offset = brw->vs.prog_offset;
+   uint32_t old_prog_offset = brw->vs.base.prog_offset;
    struct brw_vs_prog_data *old_prog_data = brw->vs.prog_data;
    bool success;
 
@@ -544,7 +552,7 @@ brw_vs_precompile(struct gl_context *ctx, struct gl_shader_program *prog)
 
    success = do_vs_prog(brw, prog, bvp, &key);
 
-   brw->vs.prog_offset = old_prog_offset;
+   brw->vs.base.prog_offset = old_prog_offset;
    brw->vs.prog_data = old_prog_data;
 
    return success;