diff options
author | Jason Ekstrand <[email protected]> | 2017-10-28 08:57:23 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-11-08 14:09:51 -0800 |
commit | 3e63cf893f096a7263eb1856d58417dd2d170d4b (patch) | |
tree | 196e225c63562cf1caf28df53adfb5ef4e3f8b4f /src/mesa | |
parent | 7364f080f9a272323ed3491f278a1eed3eb9b1a7 (diff) |
intel/nir: Break the linking code into a helper in brw_nir.c
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Cc: [email protected]
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_link.cpp | 38 |
1 files changed, 4 insertions, 34 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index 6ac4ecc0d8e..24545d52ecb 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -282,40 +282,10 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) if (shProg->_LinkedShaders[i] == NULL) continue; - nir_shader *producer = shProg->_LinkedShaders[i]->Program->nir; - nir_shader *consumer = shProg->_LinkedShaders[next]->Program->nir; - - NIR_PASS_V(producer, nir_remove_dead_variables, nir_var_shader_out); - NIR_PASS_V(consumer, nir_remove_dead_variables, nir_var_shader_in); - - if (nir_remove_unused_varyings(producer, consumer)) { - NIR_PASS_V(producer, nir_lower_global_vars_to_local); - NIR_PASS_V(consumer, nir_lower_global_vars_to_local); - - nir_variable_mode indirect_mask = (nir_variable_mode) 0; - if (compiler->glsl_compiler_options[i].EmitNoIndirectTemp) - indirect_mask = (nir_variable_mode) nir_var_local; - - /* The backend might not be able to handle indirects on - * temporaries so we need to lower indirects on any of the - * varyings we have demoted here. - */ - NIR_PASS_V(producer, nir_lower_indirect_derefs, indirect_mask); - NIR_PASS_V(consumer, nir_lower_indirect_derefs, indirect_mask); - - const bool p_is_scalar = - compiler->scalar_stage[producer->info.stage]; - producer = brw_nir_optimize(producer, compiler, p_is_scalar); - - const bool c_is_scalar = - compiler->scalar_stage[producer->info.stage]; - consumer = brw_nir_optimize(consumer, compiler, c_is_scalar); - } - - shProg->_LinkedShaders[i]->Program->nir = producer; - shProg->_LinkedShaders[next]->Program->nir = consumer; - - next = i; + brw_nir_link_shaders(compiler, + &shProg->_LinkedShaders[i]->Program->nir, + &shProg->_LinkedShaders[next]->Program->nir); + next = i; } } |