#define nir_foreach_variable_safe(var, var_list) \
foreach_list_typed_safe(nir_variable, var, node, var_list)
+#define nir_foreach_shader_in_variable(var, shader) \
+ nir_foreach_variable(var, &(shader)->inputs)
+
+#define nir_foreach_shader_in_variable_safe(var, shader) \
+ nir_foreach_variable_safe(var, &(shader)->inputs)
+
+#define nir_foreach_shader_out_variable(var, shader) \
+ nir_foreach_variable(var, &(shader)->outputs)
+
+#define nir_foreach_shader_out_variable_safe(var, shader) \
+ nir_foreach_variable_safe(var, &(shader)->outputs)
+
static inline bool
nir_variable_is_global(const nir_variable *var)
{
/* Some helpers to do very simple linking */
bool nir_remove_unused_varyings(nir_shader *producer, nir_shader *consumer);
-bool nir_remove_unused_io_vars(nir_shader *shader, struct exec_list *var_list,
+bool nir_remove_unused_io_vars(nir_shader *shader, nir_variable_mode mode,
uint64_t *used_by_other_stage,
uint64_t *used_by_other_stage_patches);
void nir_compact_varyings(nir_shader *producer, nir_shader *consumer,
bool nir_lower_discard_to_demote(nir_shader *shader);
+bool nir_lower_memory_model(nir_shader *shader);
+
bool nir_normalize_cubemap_coords(nir_shader *shader);
void nir_live_ssa_defs_impl(nir_function_impl *impl);
nir_should_vectorize_mem_func callback,
nir_variable_mode robust_modes);
-typedef struct nir_schedule_options {
- /* On some hardware with some stages the inputs and outputs to the shader
- * share the same memory. In that case scheduler needs to ensure that all
- * output writes are scheduled after all of the input writes to avoid
- * overwriting them. This is a bitmask of stages that need that.
- */
- unsigned stages_with_shared_io_memory;
- /* The approximate amount of register pressure at which point the scheduler
- * will try to reduce register usage.
- */
- int threshold;
-} nir_schedule_options;
-
-void nir_schedule(nir_shader *shader, const nir_schedule_options *options);
-
void nir_strip(nir_shader *shader);
void nir_sweep(nir_shader *shader);
return nir_variable_is_in_ubo(var) || nir_variable_is_in_ssbo(var);
}
+typedef struct nir_unsigned_upper_bound_config {
+ unsigned min_subgroup_size;
+ unsigned max_subgroup_size;
+ unsigned max_work_group_invocations;
+ unsigned max_work_group_count[3];
+ unsigned max_work_group_size[3];
+
+ uint32_t vertex_attrib_max[32];
+} nir_unsigned_upper_bound_config;
+
+uint32_t
+nir_unsigned_upper_bound(nir_shader *shader, struct hash_table *range_ht,
+ nir_ssa_scalar scalar,
+ const nir_unsigned_upper_bound_config *config);
+
+bool
+nir_addition_might_overflow(nir_shader *shader, struct hash_table *range_ht,
+ nir_ssa_scalar ssa, unsigned const_val,
+ const nir_unsigned_upper_bound_config *config);
+
#ifdef __cplusplus
} /* extern "C" */
#endif