Mesa (main): nir: Don't set writes_memory for reading XFB

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 3 19:32:25 UTC 2022


Module: Mesa
Branch: main
Commit: ca280b2283dacaeef0a43e5585c50ed4f0db6a83
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca280b2283dacaeef0a43e5585c50ed4f0db6a83

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>

---

 src/compiler/nir/nir_gather_info.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index 2ed70e1ad9e..6a138e7124a 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -930,7 +930,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