diff options
author | Jason Ekstrand <[email protected]> | 2017-10-28 08:50:54 -0700 |
---|---|---|
committer | Emil Velikov <[email protected]> | 2017-11-10 19:17:20 +0000 |
commit | c40cf117eef688f6a629ebfeb802bac257986559 (patch) | |
tree | 57e127b5990040616a3e849287bd03a3a5c1d31f | |
parent | 1b206e3b5846e181296e11a9fc5418fd7140ab34 (diff) |
intel/nir: Add a helper for getting the NoIndirect mask
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Cc: [email protected]
(cherry picked from commit 7364f080f9a272323ed3491f278a1eed3eb9b1a7)
-rw-r--r-- | src/intel/compiler/brw_nir.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c index 327216eaaa7..192249363d9 100644 --- a/src/intel/compiler/brw_nir.c +++ b/src/intel/compiler/brw_nir.c @@ -521,18 +521,29 @@ brw_nir_lower_cs_shared(nir_shader *nir) this_progress; \ }) -nir_shader * -brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler, - bool is_scalar) +static nir_variable_mode +brw_nir_no_indirect_mask(const struct brw_compiler *compiler, + gl_shader_stage stage) { nir_variable_mode indirect_mask = 0; - if (compiler->glsl_compiler_options[nir->info.stage].EmitNoIndirectInput) + + if (compiler->glsl_compiler_options[stage].EmitNoIndirectInput) indirect_mask |= nir_var_shader_in; - if (compiler->glsl_compiler_options[nir->info.stage].EmitNoIndirectOutput) + if (compiler->glsl_compiler_options[stage].EmitNoIndirectOutput) indirect_mask |= nir_var_shader_out; - if (compiler->glsl_compiler_options[nir->info.stage].EmitNoIndirectTemp) + if (compiler->glsl_compiler_options[stage].EmitNoIndirectTemp) indirect_mask |= nir_var_local; + return indirect_mask; +} + +nir_shader * +brw_nir_optimize(nir_shader *nir, const struct brw_compiler *compiler, + bool is_scalar) +{ + nir_variable_mode indirect_mask = + brw_nir_no_indirect_mask(compiler, nir->info.stage); + bool progress; do { progress = false; @@ -637,14 +648,8 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir) OPT(nir_lower_clip_cull_distance_arrays); - nir_variable_mode indirect_mask = 0; - if (compiler->glsl_compiler_options[nir->info.stage].EmitNoIndirectInput) - indirect_mask |= nir_var_shader_in; - if (compiler->glsl_compiler_options[nir->info.stage].EmitNoIndirectOutput) - indirect_mask |= nir_var_shader_out; - if (compiler->glsl_compiler_options[nir->info.stage].EmitNoIndirectTemp) - indirect_mask |= nir_var_local; - + nir_variable_mode indirect_mask = + brw_nir_no_indirect_mask(compiler, nir->info.stage); nir_lower_indirect_derefs(nir, indirect_mask); nir_lower_int64(nir, nir_lower_imul64 | |