summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-04-19 21:20:26 -0700
committerJason Ekstrand <[email protected]>2016-04-28 15:52:17 -0700
commit261d62de33b6192ec31f034a9897d034a37fa582 (patch)
treeed186d171eea1d3b6faeaaa3eb21c57d0c51561b /src
parentbb65764a4ad5a70a4b48975480cf29e7e274a178 (diff)
anv/lower_push_constants: fixup for nir_foreach_block()
Signed-off-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/intel/vulkan/anv_nir_lower_push_constants.c40
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;
+ }
+ }
}
}