unsigned derefs_size = 0;
nir_foreach_function_impl(impl, shader) {
- {
- nir_foreach_block(block, impl) {
- nir_foreach_instr(instr, block) {
- if (instr->type == nir_instr_type_intrinsic) {
- nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
- switch (intr->intrinsic) {
- case nir_intrinsic_atomic_counter_read_deref:
- case nir_intrinsic_atomic_counter_inc_deref:
- case nir_intrinsic_atomic_counter_pre_dec_deref:
- case nir_intrinsic_atomic_counter_post_dec_deref:
- case nir_intrinsic_atomic_counter_add_deref:
- case nir_intrinsic_atomic_counter_min_deref:
- case nir_intrinsic_atomic_counter_max_deref:
- case nir_intrinsic_atomic_counter_and_deref:
- case nir_intrinsic_atomic_counter_or_deref:
- case nir_intrinsic_atomic_counter_xor_deref:
- case nir_intrinsic_atomic_counter_exchange_deref:
- case nir_intrinsic_atomic_counter_comp_swap_deref:
- case nir_intrinsic_image_deref_load:
- case nir_intrinsic_image_deref_store:
- case nir_intrinsic_image_deref_atomic:
- case nir_intrinsic_image_deref_atomic_swap:
- case nir_intrinsic_image_deref_size:
- case nir_intrinsic_image_deref_samples:
- case nir_intrinsic_load_deref:
- case nir_intrinsic_store_deref:
- add_var_use_deref(nir_src_as_deref(intr->src[0]), live,
- &derefs, &derefs_size);
- break;
+ nir_foreach_block(block, impl) {
+ nir_foreach_instr(instr, block) {
+ if (instr->type == nir_instr_type_intrinsic) {
+ nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
+ switch (intr->intrinsic) {
+ case nir_intrinsic_atomic_counter_read_deref:
+ case nir_intrinsic_atomic_counter_inc_deref:
+ case nir_intrinsic_atomic_counter_pre_dec_deref:
+ case nir_intrinsic_atomic_counter_post_dec_deref:
+ case nir_intrinsic_atomic_counter_add_deref:
+ case nir_intrinsic_atomic_counter_min_deref:
+ case nir_intrinsic_atomic_counter_max_deref:
+ case nir_intrinsic_atomic_counter_and_deref:
+ case nir_intrinsic_atomic_counter_or_deref:
+ case nir_intrinsic_atomic_counter_xor_deref:
+ case nir_intrinsic_atomic_counter_exchange_deref:
+ case nir_intrinsic_atomic_counter_comp_swap_deref:
+ case nir_intrinsic_image_deref_load:
+ case nir_intrinsic_image_deref_store:
+ case nir_intrinsic_image_deref_atomic:
+ case nir_intrinsic_image_deref_atomic_swap:
+ case nir_intrinsic_image_deref_size:
+ case nir_intrinsic_image_deref_samples:
+ case nir_intrinsic_load_deref:
+ case nir_intrinsic_store_deref:
+ add_var_use_deref(nir_src_as_deref(intr->src[0]), live,
+ &derefs, &derefs_size);
+ break;
- default:
- /* Nothing to do */
- break;
- }
- } else if (instr->type == nir_instr_type_tex) {
- nir_tex_instr *tex_instr = nir_instr_as_tex(instr);
- int sampler_idx =
- nir_tex_instr_src_index(tex_instr,
- nir_tex_src_sampler_deref);
- int texture_idx =
- nir_tex_instr_src_index(tex_instr,
- nir_tex_src_texture_deref);
-
- if (sampler_idx >= 0) {
- nir_deref_instr *deref =
- nir_src_as_deref(tex_instr->src[sampler_idx].src);
- add_var_use_deref(deref, live, &derefs, &derefs_size);
- }
+ default:
+ /* Nothing to do */
+ break;
+ }
+ } else if (instr->type == nir_instr_type_tex) {
+ nir_tex_instr *tex_instr = nir_instr_as_tex(instr);
+ int sampler_idx =
+ nir_tex_instr_src_index(tex_instr,
+ nir_tex_src_sampler_deref);
+ int texture_idx =
+ nir_tex_instr_src_index(tex_instr,
+ nir_tex_src_texture_deref);
+
+ if (sampler_idx >= 0) {
+ nir_deref_instr *deref =
+ nir_src_as_deref(tex_instr->src[sampler_idx].src);
+ add_var_use_deref(deref, live, &derefs, &derefs_size);
+ }
- if (texture_idx >= 0) {
- nir_deref_instr *deref =
- nir_src_as_deref(tex_instr->src[texture_idx].src);
- add_var_use_deref(deref, live, &derefs, &derefs_size);
- }
+ if (texture_idx >= 0) {
+ nir_deref_instr *deref =
+ nir_src_as_deref(tex_instr->src[texture_idx].src);
+ add_var_use_deref(deref, live, &derefs, &derefs_size);
}
}
}