From 0ded23a552401eabc4149a74ade4561cf6b47726 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Sun, 25 Nov 2018 19:03:43 -0800 Subject: [PATCH] iris: actually flush for storage images --- src/gallium/drivers/iris/iris_context.h | 1 + src/gallium/drivers/iris/iris_resolve.c | 16 ++++++++++++++++ src/gallium/drivers/iris/iris_state.c | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/src/gallium/drivers/iris/iris_context.h b/src/gallium/drivers/iris/iris_context.h index 5bec8c35666..6f0526db55f 100644 --- a/src/gallium/drivers/iris/iris_context.h +++ b/src/gallium/drivers/iris/iris_context.h @@ -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; }; diff --git a/src/gallium/drivers/iris/iris_resolve.c b/src/gallium/drivers/iris/iris_resolve.c index 06f44c022b9..11967016663 100644 --- a/src/gallium/drivers/iris/iris_resolve.c +++ b/src/gallium/drivers/iris/iris_resolve.c @@ -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 diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c index 0b5e1a3aa01..e07bd8919db 100644 --- a/src/gallium/drivers/iris/iris_state.c +++ b/src/gallium/drivers/iris/iris_state.c @@ -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]; -- 2.30.2