i965: Setup pull constant state for compute programs
authorJordan Justen <jordan.l.justen@intel.com>
Thu, 15 Oct 2015 17:27:00 +0000 (10:27 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Sun, 1 Nov 2015 07:35:12 +0000 (00:35 -0700)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/gen7_cs_state.c

index e075395ef497b3cde82ea4cfca3330f32d18bdf2..c83f47bdff7eee4d3f7b851281c3e55810ea9871 100644 (file)
@@ -1172,7 +1172,7 @@ struct brw_context
 
    int num_atoms[BRW_NUM_PIPELINES];
    const struct brw_tracked_state render_atoms[60];
-   const struct brw_tracked_state compute_atoms[8];
+   const struct brw_tracked_state compute_atoms[9];
 
    /* If (INTEL_DEBUG & DEBUG_BATCH) */
    struct {
index 78389011015ba473f2595c490f6bc152f1a121da..2aa1248fea66cea2068a9c6f5348d6fc3d8cd580 100644 (file)
@@ -49,6 +49,7 @@ extern const struct brw_tracked_state brw_clip_unit;
 extern const struct brw_tracked_state brw_vs_pull_constants;
 extern const struct brw_tracked_state brw_gs_pull_constants;
 extern const struct brw_tracked_state brw_wm_pull_constants;
+extern const struct brw_tracked_state brw_cs_pull_constants;
 extern const struct brw_tracked_state brw_constant_buffer;
 extern const struct brw_tracked_state brw_curbe_offsets;
 extern const struct brw_tracked_state brw_invariant_state;
index 79b8301954e4164e5edb8efd6515b8cf9497fc7b..0344b8a7fb077f191b5e75b87dce4806e3ceec90 100644 (file)
@@ -259,6 +259,7 @@ static const struct brw_tracked_state *gen7_compute_atoms[] =
    &brw_state_base_address,
    &brw_cs_image_surfaces,
    &gen7_cs_push_constants,
+   &brw_cs_pull_constants,
    &brw_cs_ubo_surfaces,
    &brw_cs_abo_surfaces,
    &brw_texture_surfaces,
@@ -353,6 +354,7 @@ static const struct brw_tracked_state *gen8_compute_atoms[] =
    &gen8_state_base_address,
    &brw_cs_image_surfaces,
    &gen7_cs_push_constants,
+   &brw_cs_pull_constants,
    &brw_cs_ubo_surfaces,
    &brw_cs_abo_surfaces,
    &brw_texture_surfaces,
index 6aeb0cb243fec4f89b55aa8c30cdcb052320896c..2d7c04f4ad27f405c461df551dd9eea0ab4722e2 100644 (file)
@@ -285,3 +285,34 @@ const struct brw_tracked_state gen7_cs_push_constants = {
    },
    .emit = gen7_upload_cs_push_constants,
 };
+
+/**
+ * Creates a new CS constant buffer reflecting the current CS program's
+ * constants, if needed by the CS program.
+ */
+static void
+brw_upload_cs_pull_constants(struct brw_context *brw)
+{
+   struct brw_stage_state *stage_state = &brw->cs.base;
+
+   /* BRW_NEW_COMPUTE_PROGRAM */
+   struct brw_compute_program *cp =
+      (struct brw_compute_program *) brw->compute_program;
+
+   /* BRW_NEW_CS_PROG_DATA */
+   const struct brw_stage_prog_data *prog_data = &brw->cs.prog_data->base;
+
+   /* _NEW_PROGRAM_CONSTANTS */
+   brw_upload_pull_constants(brw, BRW_NEW_SURFACES, &cp->program.Base,
+                             stage_state, prog_data, true);
+}
+
+const struct brw_tracked_state brw_cs_pull_constants = {
+   .dirty = {
+      .mesa = _NEW_PROGRAM_CONSTANTS,
+      .brw = BRW_NEW_BATCH |
+             BRW_NEW_COMPUTE_PROGRAM |
+             BRW_NEW_CS_PROG_DATA,
+   },
+   .emit = brw_upload_cs_pull_constants,
+};