From ca280b2283dacaeef0a43e5585c50ed4f0db6a83 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 2 May 2022 13:59:55 -0400 Subject: [PATCH] nir: Don't set writes_memory for reading XFB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jason Ekstrand Reviewed-by: Marek Olšák Part-of: --- 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) {