nir: Remove unused nir_assign_linked_io_var_locations.

The only user of this pass was RADV.
Considering that driver locations are deprecated, nobody should
write new code relying on this pass.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29812>
This commit is contained in:
Timur Kristóf 2024-06-20 17:29:29 +02:00 committed by Marge Bot
parent f917b81665
commit 10dcf1fca6
2 changed files with 0 additions and 109 deletions

View file

@ -5510,15 +5510,6 @@ void nir_assign_io_var_locations(nir_shader *shader,
unsigned *size,
gl_shader_stage stage);
typedef struct {
uint8_t num_linked_io_vars;
uint8_t num_linked_patch_io_vars;
} nir_linked_io_var_info;
nir_linked_io_var_info
nir_assign_linked_io_var_locations(nir_shader *producer,
nir_shader *consumer);
typedef enum {
/* If set, this causes all 64-bit IO operations to be lowered on-the-fly
* to 32-bit operations. This is only valid for nir_var_shader_in/out

View file

@ -1621,103 +1621,3 @@ nir_assign_io_var_locations(nir_shader *shader, nir_variable_mode mode,
exec_list_append(&shader->variables, &io_vars);
*size = location;
}
static uint64_t
get_linked_variable_location(unsigned location, bool patch)
{
if (!patch)
return location;
/* Reserve locations 0...3 for special patch variables
* like tess factors and bounding boxes, and the generic patch
* variables will come after them.
*/
if (location >= VARYING_SLOT_PATCH0)
return location - VARYING_SLOT_PATCH0 + 4;
else if (location >= VARYING_SLOT_TESS_LEVEL_OUTER &&
location <= VARYING_SLOT_BOUNDING_BOX1)
return location - VARYING_SLOT_TESS_LEVEL_OUTER;
else
unreachable("Unsupported variable in get_linked_variable_location.");
}
static uint64_t
get_linked_variable_io_mask(nir_variable *variable, gl_shader_stage stage)
{
const struct glsl_type *type = variable->type;
if (nir_is_arrayed_io(variable, stage)) {
assert(glsl_type_is_array(type));
type = glsl_get_array_element(type);
}
unsigned slots = glsl_count_attribute_slots(type, false);
if (variable->data.compact) {
unsigned component_count = variable->data.location_frac + glsl_get_length(type);
slots = DIV_ROUND_UP(component_count, 4);
}
uint64_t mask = u_bit_consecutive64(0, slots);
return mask;
}
nir_linked_io_var_info
nir_assign_linked_io_var_locations(nir_shader *producer, nir_shader *consumer)
{
assert(producer);
assert(consumer);
uint64_t producer_output_mask = 0;
uint64_t producer_patch_output_mask = 0;
nir_foreach_shader_out_variable(variable, producer) {
uint64_t mask = get_linked_variable_io_mask(variable, producer->info.stage);
uint64_t loc = get_linked_variable_location(variable->data.location, variable->data.patch);
if (variable->data.patch)
producer_patch_output_mask |= mask << loc;
else
producer_output_mask |= mask << loc;
}
uint64_t consumer_input_mask = 0;
uint64_t consumer_patch_input_mask = 0;
nir_foreach_shader_in_variable(variable, consumer) {
uint64_t mask = get_linked_variable_io_mask(variable, consumer->info.stage);
uint64_t loc = get_linked_variable_location(variable->data.location, variable->data.patch);
if (variable->data.patch)
consumer_patch_input_mask |= mask << loc;
else
consumer_input_mask |= mask << loc;
}
uint64_t io_mask = producer_output_mask | consumer_input_mask;
uint64_t patch_io_mask = producer_patch_output_mask | consumer_patch_input_mask;
nir_foreach_shader_out_variable(variable, producer) {
uint64_t loc = get_linked_variable_location(variable->data.location, variable->data.patch);
if (variable->data.patch)
variable->data.driver_location = util_bitcount64(patch_io_mask & u_bit_consecutive64(0, loc));
else
variable->data.driver_location = util_bitcount64(io_mask & u_bit_consecutive64(0, loc));
}
nir_foreach_shader_in_variable(variable, consumer) {
uint64_t loc = get_linked_variable_location(variable->data.location, variable->data.patch);
if (variable->data.patch)
variable->data.driver_location = util_bitcount64(patch_io_mask & u_bit_consecutive64(0, loc));
else
variable->data.driver_location = util_bitcount64(io_mask & u_bit_consecutive64(0, loc));
}
nir_linked_io_var_info result = {
.num_linked_io_vars = util_bitcount64(io_mask),
.num_linked_patch_io_vars = util_bitcount64(patch_io_mask),
};
return result;
}