nir: add max_ifc_array_access field to vars

This will be used in following patches by the nir based glsl
linker code.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31137>
This commit is contained in:
Timothy Arceri 2024-05-29 11:10:05 +10:00 committed by Marge Bot
parent 6219275ffe
commit 7a1061e0dd
3 changed files with 29 additions and 0 deletions

View file

@ -597,6 +597,16 @@ nir_visitor::visit(ir_variable *ir)
var->data.explicit_xfb_buffer = ir->data.explicit_xfb_buffer;
var->data.explicit_xfb_stride = ir->data.explicit_xfb_stride;
if (ir->is_interface_instance()) {
int *max_ifc_array_access = ir->get_max_ifc_array_access();
if (max_ifc_array_access) {
var->max_ifc_array_access =
rzalloc_array(var, int, ir->get_interface_type()->length);
memcpy(var->max_ifc_array_access, max_ifc_array_access,
ir->get_interface_type()->length * sizeof(unsigned));
}
}
var->num_state_slots = ir->get_num_state_slots();
if (var->num_state_slots > 0) {
var->state_slots = rzalloc_array(var, nir_state_slot,

View file

@ -837,6 +837,18 @@ typedef struct nir_variable {
/* Number of nir_variable_data members */
uint16_t num_members;
/**
* For variables with non NULL interface_type, this points to an array of
* integers such that if the ith member of the interface block is an array,
* max_ifc_array_access[i] is the maximum array element of that member that
* has been accessed. If the ith member of the interface block is not an
* array, max_ifc_array_access[i] is unused.
*
* For variables whose type is not an interface block, this pointer is
* NULL.
*/
int *max_ifc_array_access;
/**
* Built-in state that backs this uniform
*

View file

@ -163,6 +163,13 @@ nir_variable_clone(const nir_variable *var, nir_shader *shader)
}
nvar->interface_type = var->interface_type;
if (var->max_ifc_array_access) {
nvar->max_ifc_array_access =
rzalloc_array(nvar, int, var->interface_type->length);
memcpy(nvar->max_ifc_array_access, var->max_ifc_array_access,
var->interface_type->length * sizeof(unsigned));
}
nvar->num_members = var->num_members;
if (var->num_members) {
nvar->members = ralloc_array(nvar, struct nir_variable_data,