iris: actually flush for storage images
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 26 Nov 2018 03:03:43 +0000 (19:03 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Thu, 21 Feb 2019 18:26:10 +0000 (10:26 -0800)
src/gallium/drivers/iris/iris_context.h
src/gallium/drivers/iris/iris_resolve.c
src/gallium/drivers/iris/iris_state.c

index 5bec8c356662e82aee46c872e2d0d655f50803d0..6f0526db55f25b04fc5a62a75ffaf6e289078f47 100644 (file)
@@ -282,6 +282,7 @@ struct iris_shader_state {
    struct iris_state_ref sampler_table;
    struct iris_sampler_state *samplers[IRIS_MAX_TEXTURE_SAMPLERS];
    struct iris_sampler_view *textures[IRIS_MAX_TEXTURE_SAMPLERS];
+   unsigned num_images;
    unsigned num_samplers;
    unsigned num_textures;
 };
index 06f44c022b9d660cd5d8b25cf3c182422433b20b..11967016663c59c79d3ce611c6d5a605cb4b707c 100644 (file)
@@ -51,6 +51,21 @@ resolve_sampler_views(struct iris_batch *batch,
    }
 }
 
+static void
+resolve_image_views(struct iris_batch *batch,
+                    struct iris_shader_state *shs)
+{
+   for (int i = 0; i < shs->num_images; i++) {
+      struct pipe_resource *res = shs->image[i].res;
+      if (!res)
+         continue;
+
+      // XXX: aux tracking
+      iris_cache_flush_for_read(batch, iris_resource_bo(res));
+   }
+}
+
+
 /**
  * \brief Resolve buffers before drawing.
  *
@@ -64,6 +79,7 @@ iris_predraw_resolve_inputs(struct iris_context *ice,
    for (gl_shader_stage stage = 0; stage < MESA_SHADER_STAGES; stage++) {
       struct iris_shader_state *shs = &ice->state.shaders[stage];
       resolve_sampler_views(batch, shs);
+      resolve_image_views(batch, shs);
    }
 
    // XXX: storage images
index 0b5e1a3aa011906f18b852ff9aa25b7862187123..e07bd8919db0c130d6baae8e120c0e37ee55045c 100644 (file)
@@ -1371,6 +1371,8 @@ iris_bind_sampler_states(struct pipe_context *ctx,
       shs->samplers[start + i] = states[i];
    }
 
+   // XXX: count may include NULLs
+
    /* Assemble the SAMPLER_STATEs into a contiguous table that lives
     * in the dynamic state memory zone, so we can point to it via the
     * 3DSTATE_SAMPLER_STATE_POINTERS_* commands.
@@ -1666,6 +1668,8 @@ iris_set_shader_images(struct pipe_context *ctx,
    gl_shader_stage stage = stage_from_pipe(p_stage);
    struct iris_shader_state *shs = &ice->state.shaders[stage];
 
+   shs->num_images = MAX2(shs->num_images, start_slot + count);
+
    for (unsigned i = 0; i < count; i++) {
       if (p_images && p_images[i].resource) {
          const struct pipe_image_view *img = &p_images[i];