From 767ea18517a05f9d4ecc4fdca0217cd0faf89b88 Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Thu, 19 Oct 2023 14:58:00 +0100 Subject: [PATCH] glsl: always lower non-TCS outputs to temporaries It seems only radeonsi and v3d sets CAN_READ_OUTPUTS/SupportsReadingOutputs, and v3d has lower_all_io_to_temps=true. It looks like radeonsi basically lowers the outputs to temporaries in the backend. Signed-off-by: Rhys Perry Reviewed-by: Timothy Arceri Reviewed-by: Alyssa Rosenzweig Part-of: --- src/compiler/glsl/gl_nir_linker.c | 3 ++- src/gallium/drivers/freedreno/ir3/ir3_cmdline.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 4c23f1435fc..98e1b75b244 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -1249,7 +1249,8 @@ preprocess_shader(const struct gl_constants *consts, NIR_PASS(_, nir, nir_lower_io_to_temporaries, nir_shader_get_entrypoint(nir), true, true); - } else if (nir->info.stage == MESA_SHADER_FRAGMENT || + } else if (nir->info.stage == MESA_SHADER_TESS_EVAL || + nir->info.stage == MESA_SHADER_FRAGMENT || !consts->SupportsReadingOutputs) { NIR_PASS(_, nir, nir_lower_io_to_temporaries, nir_shader_get_entrypoint(nir), diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c index 4fa8b5a5db7..e11aa60cddc 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c @@ -143,7 +143,8 @@ load_glsl(unsigned num_files, char *const *files, gl_shader_stage stage) nir->info.stage == MESA_SHADER_GEOMETRY) { NIR_PASS_V(nir, nir_lower_io_to_temporaries, nir_shader_get_entrypoint(nir), true, true); - } else if (nir->info.stage == MESA_SHADER_FRAGMENT) { + } else if (nir->info.stage == MESA_SHADER_TESS_EVAL || + nir->info.stage == MESA_SHADER_FRAGMENT) { NIR_PASS_V(nir, nir_lower_io_to_temporaries, nir_shader_get_entrypoint(nir), true, false); }