diff options
-rw-r--r-- | src/intel/vulkan/anv_nir_lower_push_constants.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/src/intel/vulkan/anv_nir_lower_push_constants.c b/src/intel/vulkan/anv_nir_lower_push_constants.c index 7f875eba97c..2d841009c6f 100644 --- a/src/intel/vulkan/anv_nir_lower_push_constants.c +++ b/src/intel/vulkan/anv_nir_lower_push_constants.c @@ -23,34 +23,30 @@ #include "anv_nir.h" -static bool -lower_push_constants_block(nir_block *block, void *void_state) +void +anv_nir_lower_push_constants(nir_shader *shader) { - nir_foreach_instr(block, instr) { - if (instr->type != nir_instr_type_intrinsic) + nir_foreach_function(shader, function) { + if (!function->impl) continue; - nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); + nir_foreach_block(block, function->impl) { + nir_foreach_instr(block, instr) { + if (instr->type != nir_instr_type_intrinsic) + continue; - /* TODO: Handle indirect push constants */ - if (intrin->intrinsic != nir_intrinsic_load_push_constant) - continue; + nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr); - assert(intrin->const_index[0] % 4 == 0); - assert(intrin->const_index[1] == 128); + /* TODO: Handle indirect push constants */ + if (intrin->intrinsic != nir_intrinsic_load_push_constant) + continue; - /* We just turn them into uniform loads with the appropreate offset */ - intrin->intrinsic = nir_intrinsic_load_uniform; - } + assert(intrin->const_index[0] % 4 == 0); + assert(intrin->const_index[1] == 128); - return true; -} - -void -anv_nir_lower_push_constants(nir_shader *shader) -{ - nir_foreach_function(shader, function) { - if (function->impl) - nir_foreach_block_call(function->impl, lower_push_constants_block, NULL); + /* We just turn them into uniform loads */ + intrin->intrinsic = nir_intrinsic_load_uniform; + } + } } } |