diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index 861349ff211..6d2e7d0b0f8 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -1326,9 +1326,6 @@ preprocess_shader(const struct gl_constants *consts, (nir->info.outputs_written & (VARYING_BIT_CLIP_DIST0 | VARYING_BIT_CLIP_DIST1))) NIR_PASS(_, nir, gl_nir_zero_initialize_clip_distance); - NIR_PASS(_, nir, nir_lower_io_vars_to_temporaries, - nir_shader_get_entrypoint(nir), true, false); - NIR_PASS(_, nir, nir_lower_global_vars_to_local); NIR_PASS(_, nir, nir_split_var_copies); NIR_PASS(_, nir, nir_lower_var_copies); diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index 06f11a06a1b..49c8c4b2468 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -1038,6 +1038,18 @@ nir_lower_io_passes(nir_shader *nir, bool renumber_vs_inputs) (nir->options->support_indirect_outputs >> nir->info.stage) & 0x1 && nir->xfb_info == NULL; + /* TODO: This is a hack until a better solution is available. + * For all shaders except TCS, lower all outputs to temps because: + * - there can be output loads (nobody expects those outside of TCS) + * - drivers don't expect when an output is only written in control flow + * + * "has_indirect_outputs = false" causes all outputs to be lowered to temps. + * which lowers indirect stores, eliminates output loads, and moves all + * output stores to the end or GS emits. + */ + if (nir->info.stage != MESA_SHADER_TESS_CTRL) + has_indirect_outputs = false; + /* TODO: Sorting variables by location is required due to some bug * in nir_lower_io_vars_to_temporaries. If variables are not sorted, * dEQP-GLES31.functional.separate_shader.random.0 fails.