asahi: Use nir_lower_robust_access
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Tue, 27 Jun 2023 22:33:57 +0000 (18:33 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 20 Jul 2023 15:33:28 +0000 (15:33 +0000)
This makes images robust as required by the OpenGL ES spec.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24258>

src/gallium/drivers/asahi/agx_state.c

index 9924c3a..5adf890 100644 (file)
@@ -1696,6 +1696,20 @@ agx_shader_initialize(struct agx_uncompiled_shader *so, nir_shader *nir)
 {
    so->type = pipe_shader_type_from_mesa(nir->info.stage);
 
+   nir_lower_robust_access_options robustness = {
+      /* Images accessed through the texture or PBE hardware are robust, so we
+       * don't set lower_image. However, buffer images and image atomics are
+       * lowered so require robustness lowering.
+       */
+      .lower_buffer_image = true,
+      .lower_image_atomic = true,
+   };
+
+   /* We need to lower robustness before bindings, since robustness lowering
+    * affects the bindings used.
+    */
+   NIR_PASS_V(nir, nir_lower_robust_access, &robustness);
+
    /* We need to lower binding tables before calling agx_preprocess_nir, since
     * that does texture lowering that needs to know the binding model.
     */