};
const struct glsl_type *struct_type = glsl_without_array(type);
- if (glsl_type_is_struct(struct_type)) {
+ if (glsl_type_is_struct_or_ifc(struct_type)) {
field->num_fields = glsl_get_length(struct_type),
field->fields = ralloc_array(state->mem_ctx, struct field,
field->num_fields);
var_type = wrap_type_in_array(var_type, f->type);
nir_variable_mode mode = state->base_var->data.mode;
- if (mode == nir_var_function) {
+ if (mode == nir_var_function_temp) {
field->var = nir_local_variable_create(state->impl, var_type, name);
} else {
field->var = nir_variable_create(state->shader, mode, var_type, name);
* pull all of the variables we plan to split off of the list
*/
nir_foreach_variable_safe(var, vars) {
- if (!glsl_type_is_struct(glsl_without_array(var->type)))
+ if (!glsl_type_is_struct_or_ifc(glsl_without_array(var->type)))
continue;
exec_node_remove(&var->node);
continue;
assert(i > 0);
- assert(glsl_type_is_struct(path.path[i - 1]->type));
+ assert(glsl_type_is_struct_or_ifc(path.path[i - 1]->type));
assert(path.path[i - 1]->type ==
glsl_without_array(tail_field->type));
struct hash_table *var_field_map =
_mesa_pointer_hash_table_create(mem_ctx);
- assert((modes & (nir_var_shader_temp | nir_var_function)) == modes);
+ assert((modes & (nir_var_shader_temp | nir_var_function_temp)) == modes);
bool has_global_splits = false;
if (modes & nir_var_shader_temp) {
continue;
bool has_local_splits = false;
- if (modes & nir_var_function) {
+ if (modes & nir_var_function_temp) {
has_local_splits = split_var_list_structs(shader, function->impl,
&function->impl->locals,
var_field_map, mem_ctx);
const struct glsl_type *type = var->type;
for (int i = 0; i < num_levels; i++) {
- assert(glsl_get_explicit_stride(type) == 0);
info->levels[i].array_len = glsl_get_length(type);
type = glsl_get_array_element(type);
name = ralloc_asprintf(mem_ctx, "(%s)", name);
nir_variable_mode mode = var_info->base_var->data.mode;
- if (mode == nir_var_function) {
+ if (mode == nir_var_function_temp) {
split->var = nir_local_variable_create(impl,
var_info->split_var_type, name);
} else {
glsl_get_length(src_path->path[src_level]->type));
unsigned len = glsl_get_length(dst_path->path[dst_level]->type);
for (unsigned i = 0; i < len; i++) {
- nir_ssa_def *idx = nir_imm_int(b, i);
emit_split_copies(b, dst_info, dst_path, dst_level + 1,
- nir_build_deref_array(b, dst, idx),
+ nir_build_deref_array_imm(b, dst, i),
src_info, src_path, src_level + 1,
- nir_build_deref_array(b, src, idx));
+ nir_build_deref_array_imm(b, src, i));
}
} else {
/* Neither side is being split so we just keep going */
void *mem_ctx = ralloc_context(NULL);
struct hash_table *var_info_map = _mesa_pointer_hash_table_create(mem_ctx);
- assert((modes & (nir_var_shader_temp | nir_var_function)) == modes);
+ assert((modes & (nir_var_shader_temp | nir_var_function_temp)) == modes);
bool has_global_array = false;
if (modes & nir_var_shader_temp) {
continue;
bool has_local_array = false;
- if (modes & nir_var_function) {
+ if (modes & nir_var_function_temp) {
has_local_array = init_var_list_array_infos(&function->impl->locals,
var_info_map, mem_ctx);
}
continue;
bool has_local_splits = false;
- if (modes & nir_var_function) {
+ if (modes & nir_var_function_temp) {
has_local_splits = split_var_list_arrays(shader, function->impl,
&function->impl->locals,
var_info_map, mem_ctx);
continue;
}
+ /* If we're not dropping any components, there's no need to
+ * compact vectors.
+ */
+ if (usage->comps_kept == usage->all_comps)
+ continue;
+
if (intrin->intrinsic == nir_intrinsic_load_deref) {
b.cursor = nir_after_instr(&intrin->instr);
if ((modes & nir_var_shader_temp) && !exec_list_is_empty(&shader->globals))
return true;
- if ((modes & nir_var_function) && !exec_list_is_empty(&impl->locals))
+ if ((modes & nir_var_function_temp) && !exec_list_is_empty(&impl->locals))
return true;
return false;
bool
nir_shrink_vec_array_vars(nir_shader *shader, nir_variable_mode modes)
{
- assert((modes & (nir_var_shader_temp | nir_var_function)) == modes);
+ assert((modes & (nir_var_shader_temp | nir_var_function_temp)) == modes);
void *mem_ctx = ralloc_context(NULL);
continue;
bool locals_shrunk = false;
- if (modes & nir_var_function) {
+ if (modes & nir_var_function_temp) {
locals_shrunk = shrink_vec_var_list(&function->impl->locals,
var_usage_map);
}