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 <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5909>
This commit is contained in:
Jason Ekstrand
2020-07-14 15:19:59 -05:00
committed by Marge Bot
parent 9005c9cae4
commit c897cd0278
2 changed files with 23 additions and 14 deletions

View File

@@ -162,13 +162,13 @@ brw_compiler_create(void *mem_ctx, const struct gen_device_info *devinfo)
compiler->glsl_compiler_options[i].MaxIfDepth = compiler->glsl_compiler_options[i].MaxIfDepth =
devinfo->gen < 6 ? 16 : UINT_MAX; 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].EmitNoIndirectUniform = false;
compiler->glsl_compiler_options[i].EmitNoIndirectTemp = false;
bool is_scalar = compiler->scalar_stage[i]; 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; compiler->glsl_compiler_options[i].OptimizeForAOS = !is_scalar;
struct nir_shader_compiler_options *nir_options = 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[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; return compiler;
} }

View File

@@ -472,13 +472,29 @@ static nir_variable_mode
brw_nir_no_indirect_mask(const struct brw_compiler *compiler, brw_nir_no_indirect_mask(const struct brw_compiler *compiler,
gl_shader_stage stage) gl_shader_stage stage)
{ {
const bool is_scalar = compiler->scalar_stage[stage];
nir_variable_mode indirect_mask = 0; 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; 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; indirect_mask |= nir_var_shader_out;
if (compiler->glsl_compiler_options[stage].EmitNoIndirectTemp)
if (is_scalar)
indirect_mask |= nir_var_function_temp; indirect_mask |= nir_var_function_temp;
return indirect_mask; return indirect_mask;