* correct because of the specific type of transformation we did. Block
* indices are not valid except for block_0's, which is all we care about for
* nir_block_is_unreachable(). */
- impl->valid_metadata =
- (nir_metadata)(impl->valid_metadata | nir_metadata_dominance | nir_metadata_block_index);
+ impl->valid_metadata = impl->valid_metadata | nir_metadata_dominance | nir_metadata_block_index;
return true;
}
/* sanitize control flow */
nir_metadata_require(impl, nir_metadata_dominance);
sanitize_cf_list(impl, &impl->body);
- nir_metadata_preserve(impl, (nir_metadata)~nir_metadata_block_index);
+ nir_metadata_preserve(impl, ~nir_metadata_block_index);
/* we'll need this for isel */
nir_metadata_require(impl, nir_metadata_block_index);
nir_variable_mode robust_modes = (nir_variable_mode)0;
if (ctx->options->robust_buffer_access) {
- robust_modes = (nir_variable_mode)(nir_var_mem_ubo |
- nir_var_mem_ssbo |
- nir_var_mem_global |
- nir_var_mem_push_const);
+ robust_modes = nir_var_mem_ubo |
+ nir_var_mem_ssbo |
+ nir_var_mem_global |
+ nir_var_mem_push_const;
}
if (nir_opt_load_store_vectorize(nir,
- (nir_variable_mode)(nir_var_mem_ssbo | nir_var_mem_ubo |
- nir_var_mem_push_const | nir_var_mem_shared |
- nir_var_mem_global),
+ nir_var_mem_ssbo | nir_var_mem_ubo |
+ nir_var_mem_push_const | nir_var_mem_shared |
+ nir_var_mem_global,
mem_vectorize_callback, robust_modes)) {
lower_to_scalar = true;
lower_pack = true;
}
if (nir->info.stage != MESA_SHADER_COMPUTE)
- nir_lower_io(nir, (nir_variable_mode)(nir_var_shader_in | nir_var_shader_out), type_size, (nir_lower_io_options)0);
+ nir_lower_io(nir, nir_var_shader_in | nir_var_shader_out, type_size, (nir_lower_io_options)0);
lower_to_scalar |= nir_opt_shrink_vectors(nir);
#include "util/set.h"
#include "util/bitscan.h"
#include "util/bitset.h"
+#include "util/enum_operators.h"
#include "util/macros.h"
#include "util/format/u_format.h"
#include "compiler/nir_types.h"
nir_num_variable_modes = 11,
nir_var_all = (1 << nir_num_variable_modes) - 1,
} nir_variable_mode;
+MESA_DEFINE_CPP_ENUM_BITFIELD_OPERATORS(nir_variable_mode)
/**
* Rounding modes.
*/
nir_metadata_all = ~nir_metadata_not_properly_reset,
} nir_metadata;
+MESA_DEFINE_CPP_ENUM_BITFIELD_OPERATORS(nir_metadata)
typedef struct {
nir_cf_node cf_node;
NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_function_temp, nir_address_format_32bit_offset);
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_function_temp, NULL);
- NIR_PASS_V(nir, nir_lower_io,
- (nir_variable_mode)(nir_var_shader_in | nir_var_shader_out),
+ NIR_PASS_V(nir, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
type_size, (nir_lower_io_options)0);
NIR_PASS_V(nir, nir_lower_subgroups, &subgroup_options);
}
if (impl_progress) {
- nir_metadata_preserve(function->impl, (nir_metadata)(nir_metadata_block_index |
- nir_metadata_dominance));
+ nir_metadata_preserve(function->impl, nir_metadata_block_index | nir_metadata_dominance);
progress = true;
}
}
bool progress = vectorize_block(&b, nir_start_block(impl));
if (progress) {
- nir_metadata_preserve(impl, (nir_metadata )
- (nir_metadata_block_index |
- nir_metadata_dominance));
+ nir_metadata_preserve(impl, nir_metadata_block_index | nir_metadata_dominance);
}
return progress;
}
nir_validate_shader(nir, "clover after function inlining");
- NIR_PASS_V(nir, nir_lower_variable_initializers,
- static_cast<nir_variable_mode>(~nir_var_function_temp));
+ NIR_PASS_V(nir, nir_lower_variable_initializers, ~nir_var_function_temp);
// copy propagate to prepare for lower_explicit_io
NIR_PASS_V(nir, nir_split_var_copies);
}
}
}
- nir_metadata_preserve(f->impl, (nir_metadata)
- ((unsigned) nir_metadata_block_index |
- (unsigned) nir_metadata_dominance));
+ nir_metadata_preserve(f->impl, nir_metadata_block_index |
+ nir_metadata_dominance);
}
return progress;
}
}
- nir_metadata_preserve(f->impl, (nir_metadata)
- ((unsigned) nir_metadata_block_index |
- (unsigned) nir_metadata_dominance));
+ nir_metadata_preserve(f->impl, nir_metadata_block_index |
+ nir_metadata_dominance);
}
return progress;
* might be able to make progress after it.
*/
NIR_PASS(progress, nir, nir_remove_dead_variables,
- (nir_variable_mode)(nir_var_function_temp |
- nir_var_shader_temp |
- nir_var_mem_shared),
+ nir_var_function_temp | nir_var_shader_temp |
+ nir_var_mem_shared,
NULL);
NIR_PASS(progress, nir, nir_opt_copy_prop_vars);
* calls below do a little extra work but should otherwise have no impact.
*/
if (!_mesa_is_gles(st->ctx) || !nir->info.separate_shader) {
- nir_variable_mode mask =
- (nir_variable_mode) (nir_var_shader_in | nir_var_shader_out);
+ nir_variable_mode mask = nir_var_shader_in | nir_var_shader_out;
nir_remove_dead_variables(nir, mask, NULL);
}
st_nir_opts(nir);
}
- nir_variable_mode mask = (nir_variable_mode)
- (nir_var_shader_in | nir_var_shader_out | nir_var_function_temp );
+ nir_variable_mode mask =
+ nir_var_shader_in | nir_var_shader_out | nir_var_function_temp;
nir_remove_dead_variables(nir, mask, NULL);
if (!st->has_hw_atomics && !screen->get_param(screen, PIPE_CAP_NIR_ATOMICS_AS_DEREF))