i965/cs: Upload UBO/SSBO surfaces
authorJordan Justen <jordan.l.justen@intel.com>
Wed, 30 Sep 2015 00:04:03 +0000 (17:04 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Wed, 30 Sep 2015 18:28:12 +0000 (11:28 -0700)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@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/brw_wm_surface_state.c

index 1dd48f6d9b7d2a7864b925f6e56a473ce55d31c6..19a511710da8ce72b8e2fed8f8f71d0a9d782e7e 100644 (file)
@@ -1516,7 +1516,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[7];
+   const struct brw_tracked_state compute_atoms[8];
 
    /* If (INTEL_DEBUG & DEBUG_BATCH) */
    struct {
index 3b7a4330c7aea86a8f7b39ae995fe09900a4e7ea..dc2b94156730c50b99cbffaeadb0724cf563cae8 100644 (file)
@@ -87,6 +87,7 @@ 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_wm_image_surfaces;
+extern const struct brw_tracked_state brw_cs_ubo_surfaces;
 extern const struct brw_tracked_state brw_cs_abo_surfaces;
 extern const struct brw_tracked_state brw_cs_image_surfaces;
 extern const struct brw_tracked_state brw_wm_unit;
index 46687e342d3fbbb8fc86bb4dbe4bdf5dad87baba..79b8301954e4164e5edb8efd6515b8cf9497fc7b 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_ubo_surfaces,
    &brw_cs_abo_surfaces,
    &brw_texture_surfaces,
    &brw_cs_work_groups_surface,
@@ -352,6 +353,7 @@ static const struct brw_tracked_state *gen8_compute_atoms[] =
    &gen8_state_base_address,
    &brw_cs_image_surfaces,
    &gen7_cs_push_constants,
+   &brw_cs_ubo_surfaces,
    &brw_cs_abo_surfaces,
    &brw_texture_surfaces,
    &brw_cs_work_groups_surface,
index c9316963840f9675f097becda12dba3f77d6b8ad..4e70caec4ece3e1ea09f14e7586b2c0cba81b952 100644 (file)
@@ -1001,6 +1001,32 @@ const struct brw_tracked_state brw_wm_ubo_surfaces = {
    .emit = brw_upload_wm_ubo_surfaces,
 };
 
+static void
+brw_upload_cs_ubo_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)
+      return;
+
+   /* BRW_NEW_CS_PROG_DATA */
+   brw_upload_ubo_surfaces(brw, prog->_LinkedShaders[MESA_SHADER_COMPUTE],
+                           &brw->cs.base, &brw->cs.prog_data->base, true);
+}
+
+const struct brw_tracked_state brw_cs_ubo_surfaces = {
+   .dirty = {
+      .mesa = _NEW_PROGRAM,
+      .brw = BRW_NEW_BATCH |
+             BRW_NEW_CS_PROG_DATA |
+             BRW_NEW_UNIFORM_BUFFER,
+   },
+   .emit = brw_upload_cs_ubo_surfaces,
+};
+
 void
 brw_upload_abo_surfaces(struct brw_context *brw,
                        struct gl_shader_program *prog,