From c897cd02785bec45596d1c43b906bb4a2e9b06a6 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 14 Jul 2020 15:19:59 -0500 Subject: [PATCH] intel/compiler: Handle all indirect lowering choices in brw_nir.c Since everything flows through NIR and we're doing all of our indirect deref lowering there now, there's no reason to keep making those decisions in brw_compiler and stuffing them in the GLSL compiler structs. Reviewed-by: Kenneth Graunke Part-of: --- src/intel/compiler/brw_compiler.c | 15 ++++----------- src/intel/compiler/brw_nir.c | 22 +++++++++++++++++++--- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/intel/compiler/brw_compiler.c b/src/intel/compiler/brw_compiler.c index a5b90e9b3c9..4393e5dcd2a 100644 --- a/src/intel/compiler/brw_compiler.c +++ b/src/intel/compiler/brw_compiler.c @@ -162,13 +162,13 @@ brw_compiler_create(void *mem_ctx, const struct gen_device_info *devinfo) compiler->glsl_compiler_options[i].MaxIfDepth = devinfo->gen < 6 ? 16 : UINT_MAX; - compiler->glsl_compiler_options[i].EmitNoIndirectInput = true; + /* We handle this in NIR */ + compiler->glsl_compiler_options[i].EmitNoIndirectInput = false; + compiler->glsl_compiler_options[i].EmitNoIndirectOutput = false; compiler->glsl_compiler_options[i].EmitNoIndirectUniform = false; + compiler->glsl_compiler_options[i].EmitNoIndirectTemp = false; bool is_scalar = compiler->scalar_stage[i]; - - compiler->glsl_compiler_options[i].EmitNoIndirectOutput = is_scalar; - compiler->glsl_compiler_options[i].EmitNoIndirectTemp = is_scalar; compiler->glsl_compiler_options[i].OptimizeForAOS = !is_scalar; struct nir_shader_compiler_options *nir_options = @@ -199,13 +199,6 @@ brw_compiler_create(void *mem_ctx, const struct gen_device_info *devinfo) compiler->glsl_compiler_options[i].ClampBlockIndicesToArrayBounds = true; } - compiler->glsl_compiler_options[MESA_SHADER_TESS_CTRL].EmitNoIndirectInput = false; - compiler->glsl_compiler_options[MESA_SHADER_TESS_EVAL].EmitNoIndirectInput = false; - compiler->glsl_compiler_options[MESA_SHADER_TESS_CTRL].EmitNoIndirectOutput = false; - - if (compiler->scalar_stage[MESA_SHADER_GEOMETRY]) - compiler->glsl_compiler_options[MESA_SHADER_GEOMETRY].EmitNoIndirectInput = false; - return compiler; } diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 4f1b56289c7..ea71eb499e1 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -472,13 +472,29 @@ static nir_variable_mode brw_nir_no_indirect_mask(const struct brw_compiler *compiler, gl_shader_stage stage) { + const bool is_scalar = compiler->scalar_stage[stage]; nir_variable_mode indirect_mask = 0; - if (compiler->glsl_compiler_options[stage].EmitNoIndirectInput) + switch (stage) { + case MESA_SHADER_VERTEX: + case MESA_SHADER_FRAGMENT: indirect_mask |= nir_var_shader_in; - if (compiler->glsl_compiler_options[stage].EmitNoIndirectOutput) + break; + + case MESA_SHADER_GEOMETRY: + if (!is_scalar) + indirect_mask |= nir_var_shader_in; + break; + + default: + /* Everything else can handle indirect inputs */ + break; + } + + if (is_scalar && stage != MESA_SHADER_TESS_CTRL) indirect_mask |= nir_var_shader_out; - if (compiler->glsl_compiler_options[stage].EmitNoIndirectTemp) + + if (is_scalar) indirect_mask |= nir_var_function_temp; return indirect_mask; -- 2.30.2