From 1e22971d92c46775ccd45aa3109640136ca20105 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Mon, 9 Jan 2023 11:34:04 -0800 Subject: [PATCH] gallium: Add image volatile/coherent flags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Freedreno needs to know when an image has volatile or coherent access flags in the shader. Signed-off-by: Rob Clark Reviewed-by: Marek Olšák Part-of: --- src/gallium/include/pipe/p_defines.h | 2 ++ src/gallium/include/pipe/p_state.h | 4 ++++ src/mesa/state_tracker/st_atom_image.c | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index c838fa09509..7830a7699c9 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -728,6 +728,8 @@ enum pipe_conservative_raster_mode #define PIPE_IMAGE_ACCESS_WRITE (1 << 1) #define PIPE_IMAGE_ACCESS_READ_WRITE (PIPE_IMAGE_ACCESS_READ | \ PIPE_IMAGE_ACCESS_WRITE) +#define PIPE_IMAGE_ACCESS_COHERENT (1 << 2) +#define PIPE_IMAGE_ACCESS_VOLATILE (1 << 3) /** * Implementation capabilities/limits which are queried through diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index a6121b571a5..5194011d30e 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -510,6 +510,10 @@ struct pipe_sampler_view /** * A description of a buffer or texture image that can be bound to a shader * stage. + * + * Note that pipe_image_view::access comes from the frontend API, while + * shader_access comes from the shader and may contain additional information + * (ie. coherent/volatile may be set on shader_access but not on access) */ struct pipe_image_view { diff --git a/src/mesa/state_tracker/st_atom_image.c b/src/mesa/state_tracker/st_atom_image.c index 5331f903c72..d36b12ab4f0 100644 --- a/src/mesa/state_tracker/st_atom_image.c +++ b/src/mesa/state_tracker/st_atom_image.c @@ -74,6 +74,10 @@ st_convert_image(const struct st_context *st, const struct gl_image_unit *u, img->shader_access |= PIPE_IMAGE_ACCESS_READ; if (!(shader_access & ACCESS_NON_WRITEABLE)) img->shader_access |= PIPE_IMAGE_ACCESS_WRITE; + if (shader_access & ACCESS_COHERENT) + img->shader_access |= PIPE_IMAGE_ACCESS_COHERENT; + if (shader_access & ACCESS_VOLATILE) + img->shader_access |= PIPE_IMAGE_ACCESS_VOLATILE; if (stObj->Target == GL_TEXTURE_BUFFER) { struct gl_buffer_object *stbuf = stObj->BufferObject;