gallium: Add image volatile/coherent flags
authorRob Clark <robdclark@chromium.org>
Mon, 9 Jan 2023 19:34:04 +0000 (11:34 -0800)
committerMarge Bot <emma+marge@anholt.net>
Wed, 11 Jan 2023 20:09:01 +0000 (20:09 +0000)
Freedreno needs to know when an image has volatile or coherent access
flags in the shader.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20612>

src/gallium/include/pipe/p_defines.h
src/gallium/include/pipe/p_state.h
src/mesa/state_tracker/st_atom_image.c

index c838fa0..7830a76 100644 (file)
@@ -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
index a6121b5..5194011 100644 (file)
@@ -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
 {
index 5331f90..d36b12a 100644 (file)
@@ -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;