i965: Upload atomic buffer state for compute shaders
authorJordan Justen <jordan.l.justen@intel.com>
Wed, 27 Aug 2014 18:10:35 +0000 (11:10 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Sat, 2 May 2015 07:50:00 +0000 (00:50 -0700)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
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/brw_wm_surface_state.c

index 542ec3d030f33f92b04aa8cf984d405f8fc828e7..2fcdcfadc9ac05e29c239e93f790f1c08852f292 100644 (file)
@@ -1447,7 +1447,7 @@ struct brw_context
 
    int num_atoms[BRW_NUM_PIPELINES];
    const struct brw_tracked_state render_atoms[57];
-   const struct brw_tracked_state compute_atoms[2];
+   const struct brw_tracked_state compute_atoms[3];
 
    /* If (INTEL_DEBUG & DEBUG_BATCH) */
    struct {
index 5c27b3d367e5a9a37f876eb08bea8e3893c8ec18..adfbd22c3591b0fd995fc7a878330e62933a68f8 100644 (file)
@@ -84,6 +84,7 @@ extern const struct brw_tracked_state brw_gs_binding_table;
 extern const struct brw_tracked_state brw_vs_binding_table;
 extern const struct brw_tracked_state brw_wm_ubo_surfaces;
 extern const struct brw_tracked_state brw_wm_abo_surfaces;
+extern const struct brw_tracked_state brw_cs_abo_surfaces;
 extern const struct brw_tracked_state brw_wm_unit;
 extern const struct brw_tracked_state brw_interpolation_map;
 
index 686a3da795ab41fd1f6d22572bc375b9733a08d8..84b0861aaad9276d4b090da21c6a89e5eb6d3a22 100644 (file)
@@ -250,6 +250,7 @@ static const struct brw_tracked_state *gen7_render_atoms[] =
 static const struct brw_tracked_state *gen7_compute_atoms[] =
 {
    &brw_state_base_address,
+   &brw_cs_abo_surfaces,
    &brw_cs_state,
 };
 
@@ -332,6 +333,7 @@ static const struct brw_tracked_state *gen8_render_atoms[] =
 static const struct brw_tracked_state *gen8_compute_atoms[] =
 {
    &gen8_state_base_address,
+   &brw_cs_abo_surfaces,
    &brw_cs_state,
 };
 
index 25fb5430413ddf52ca84916a337246391dd200ad..160dd2f6c624a7054523b2ad19f08ec5f893a373 100644 (file)
@@ -997,6 +997,31 @@ const struct brw_tracked_state brw_wm_abo_surfaces = {
    .emit = brw_upload_wm_abo_surfaces,
 };
 
+static void
+brw_upload_cs_abo_surfaces(struct brw_context *brw)
+{
+   struct gl_context *ctx = &brw->ctx;
+   /* _NEW_PROGRAM */
+   struct gl_shader_program *prog =
+      ctx->_Shader->CurrentProgram[MESA_SHADER_COMPUTE];
+
+   if (prog) {
+      /* BRW_NEW_CS_PROG_DATA */
+      brw_upload_abo_surfaces(brw, prog, &brw->cs.base,
+                              &brw->cs.prog_data->base);
+   }
+}
+
+const struct brw_tracked_state brw_cs_abo_surfaces = {
+   .dirty = {
+      .mesa = _NEW_PROGRAM,
+      .brw = BRW_NEW_ATOMIC_BUFFER |
+             BRW_NEW_BATCH |
+             BRW_NEW_CS_PROG_DATA,
+   },
+   .emit = brw_upload_cs_abo_surfaces,
+};
+
 void
 gen4_init_vtable_surface_functions(struct brw_context *brw)
 {