iris: Drop disable_rb_aux_buffer handling for image views
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 31 Oct 2022 23:58:28 +0000 (16:58 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 14 Dec 2022 13:01:27 +0000 (13:01 +0000)
The goal here is to support OpenGL 4.6 section 9.3, "Feedback Loops
Between Textures and the Framebuffer" (from GL_ARB_texture_barrier)
where you can bind an image as both a framebuffer attachment and a
texture, and simultaneously sample-from and render-to it.

I'm not aware of any spec language that requires us to handle
simultaneously accessing something as a framebuffer attachment and an
image load/store resource.  GL_ARB_shader_image_load_store tends to
make flushing and synchronization something the app has to handle
explicitly rather than something the driver needs to do implicitly.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19060>

src/gallium/drivers/iris/iris_resolve.c

index 789d197..454d493 100644 (file)
 #include "compiler/nir/nir.h"
 
 /**
- * Disable auxiliary buffers if a renderbuffer is also bound as a texture
- * or shader image.  This causes a self-dependency, where both rendering
- * and sampling may concurrently read or write the CCS buffer, causing
- * incorrect pixels.
+ * Disable auxiliary buffers if a renderbuffer is also bound as a texture.
+ * This causes a self-dependency, where both rendering and sampling may
+ * concurrently read or write the CCS buffer, causing incorrect pixels.
  */
 static bool
 disable_rb_aux_buffer(struct iris_context *ice,
@@ -121,9 +120,7 @@ static void
 resolve_image_views(struct iris_context *ice,
                     struct iris_batch *batch,
                     struct iris_shader_state *shs,
-                    const struct shader_info *info,
-                    bool *draw_aux_buffer_disabled,
-                    bool consider_framebuffer)
+                    const struct shader_info *info)
 {
    if (info == NULL)
       return;
@@ -138,12 +135,6 @@ resolve_image_views(struct iris_context *ice,
       struct iris_resource *res = (void *) pview->resource;
 
       if (res->base.b.target != PIPE_BUFFER) {
-         if (consider_framebuffer) {
-            disable_rb_aux_buffer(ice, draw_aux_buffer_disabled,
-                                  res, pview->u.tex.level, 1,
-                                  "as a shader image");
-         }
-
          unsigned num_layers =
             pview->u.tex.last_layer - pview->u.tex.first_layer + 1;
 
@@ -182,8 +173,7 @@ iris_predraw_resolve_inputs(struct iris_context *ice,
    if (ice->state.stage_dirty & stage_dirty) {
       resolve_sampler_views(ice, batch, shs, info, draw_aux_buffer_disabled,
                             consider_framebuffer);
-      resolve_image_views(ice, batch, shs, info, draw_aux_buffer_disabled,
-                          consider_framebuffer);
+      resolve_image_views(ice, batch, shs, info);
    }
 }