Mesa (staging/22.0): nir: Don't set writes_memory for reading XFB

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 10 22:28:42 UTC 2022


Module: Mesa
Branch: staging/22.0
Commit: 2981d3fa715ec9a5eb2320dbb441770412a43bc6
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2981d3fa715ec9a5eb2320dbb441770412a43bc6

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Mon May  2 13:59:55 2022 -0400

nir: Don't set writes_memory for reading XFB

That's a read, not a write. Fixes optimizations getting disabled for fragment
shaders when linked with a shader producing transform feedback varyings.

Fixes: 85a723975bb ("nir: add and gather shader_info::writes_memory")
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16285>
(cherry picked from commit ca280b2283dacaeef0a43e5585c50ed4f0db6a83)

---

 .pick_status.json                  | 2 +-
 src/compiler/nir/nir_gather_info.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 3d728b73618..95cf5d10f3d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -716,7 +716,7 @@
         "description": "nir: Don't set writes_memory for reading XFB",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "because_sha": "85a723975bbd651fa6692655b9a4f14b4405d0ae"
     },
     {
diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index 4b19d5f256d..21a7f4fd52f 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -907,7 +907,8 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
       shader->info.tess.tcs_cross_invocation_outputs_read = 0;
    }
 
-   shader->info.writes_memory = shader->info.has_transform_feedback_varyings;
+   if (shader->info.stage != MESA_SHADER_FRAGMENT)
+      shader->info.writes_memory = shader->info.has_transform_feedback_varyings;
 
    void *dead_ctx = ralloc_context(NULL);
    nir_foreach_block(block, entrypoint) {



More information about the mesa-commit mailing list