From 261d62de33b6192ec31f034a9897d034a37fa582 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 19 Apr 2016 21:20:26 -0700 Subject: [PATCH] anv/lower_push_constants: fixup for nir_foreach_block() Signed-off-by: Jason Ekstrand --- src/intel/vulkan/anv_nir_lower_push_constants.c | 40 +++++++++++-------------- 1 file 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 7f875eb..2d84100 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; + } + } } } -- 2.7.4