{
int count = -1;
- nir_foreach_function(shader, function) {
+ nir_foreach_function(function, shader) {
if (!function->impl)
continue;
/* set_vertex_count intrinsics only appear in predecessors of the
* end block. So we don't need to walk all of them.
*/
- struct set_entry *entry;
set_foreach(function->impl->end_block->predecessors, entry) {
nir_block *block = (nir_block *) entry->key;
- nir_foreach_instr_reverse(block, instr) {
+ nir_foreach_instr_reverse(instr, block) {
nir_intrinsic_instr *intrin = as_set_vertex_count(instr);
if (!intrin)
continue;
- nir_const_value *val = nir_src_as_const_value(intrin->src[0]);
/* We've found a non-constant value. Bail. */
- if (!val)
+ if (!nir_src_is_const(intrin->src[0]))
return -1;
if (count == -1)
- count = val->i32[0];
+ count = nir_src_as_int(intrin->src[0]);
/* We've found contradictory set_vertex_count intrinsics.
* This can happen if there are early-returns in main() and
* different paths emit different numbers of vertices.
*/
- if (count != val->i32[0])
+ if (count != nir_src_as_int(intrin->src[0]))
return -1;
}
}