* indirect indexing.
*/
static void
-create_indirects_mask(nir_shader *shader, uint64_t *indirects,
- uint64_t *patch_indirects, nir_variable_mode mode)
+create_indirects_mask(nir_shader *shader,
+ BITSET_WORD *indirects, nir_variable_mode mode)
{
nir_foreach_function(function, shader) {
if (function->impl) {
nir_deref_path path;
nir_deref_path_init(&path, deref, NULL);
- uint64_t loc_mask = ((uint64_t)1) << var->data.location;
- if (var->data.patch) {
- if (deref_has_indirect(&b, var, &path))
- patch_indirects[var->data.location_frac] |= loc_mask;
- } else {
- if (deref_has_indirect(&b, var, &path))
- indirects[var->data.location_frac] |= loc_mask;
- }
+ int loc = var->data.location * 4 + var->data.location_frac;
+ if (deref_has_indirect(&b, var, &path))
+ BITSET_SET(indirects, loc);
nir_deref_path_finish(&path);
}
static void
lower_io_arrays_to_elements(nir_shader *shader, nir_variable_mode mask,
- uint64_t *indirects, uint64_t *patch_indirects,
+ BITSET_WORD *indirects,
struct hash_table *varyings,
bool after_cross_stage_opts)
{
continue;
/* Skip indirects */
- uint64_t loc_mask = ((uint64_t)1) << var->data.location;
- if (var->data.patch) {
- if (patch_indirects[var->data.location_frac] & loc_mask)
- continue;
- } else {
- if (indirects[var->data.location_frac] & loc_mask)
- continue;
- }
+ int loc = var->data.location * 4 + var->data.location_frac;
+ if (BITSET_TEST(indirects, loc))
+ continue;
nir_variable_mode mode = var->data.mode;
struct hash_table *split_inputs = _mesa_pointer_hash_table_create(NULL);
struct hash_table *split_outputs = _mesa_pointer_hash_table_create(NULL);
- uint64_t indirects[4] = {0}, patch_indirects[4] = {0};
+ BITSET_DECLARE(indirects, 4 * MAX_VARYINGS_INCL_PATCH) = {};
- lower_io_arrays_to_elements(shader, nir_var_shader_out, indirects,
- patch_indirects, split_outputs, true);
+ lower_io_arrays_to_elements(shader, nir_var_shader_out,
+ indirects, split_outputs, true);
if (!outputs_only) {
- lower_io_arrays_to_elements(shader, nir_var_shader_in, indirects,
- patch_indirects, split_inputs, true);
+ lower_io_arrays_to_elements(shader, nir_var_shader_in,
+ indirects, split_inputs, true);
/* Remove old input from the shaders inputs list */
hash_table_foreach(split_inputs, entry) {
struct hash_table *split_inputs = _mesa_pointer_hash_table_create(NULL);
struct hash_table *split_outputs = _mesa_pointer_hash_table_create(NULL);
- uint64_t indirects[4] = {0}, patch_indirects[4] = {0};
- create_indirects_mask(producer, indirects, patch_indirects,
- nir_var_shader_out);
- create_indirects_mask(consumer, indirects, patch_indirects,
- nir_var_shader_in);
+ BITSET_DECLARE(indirects, 4 * MAX_VARYINGS_INCL_PATCH) = {};
+
+ create_indirects_mask(producer, indirects, nir_var_shader_out);
+ create_indirects_mask(consumer, indirects, nir_var_shader_in);
- lower_io_arrays_to_elements(producer, nir_var_shader_out, indirects,
- patch_indirects, split_outputs, false);
+ lower_io_arrays_to_elements(producer, nir_var_shader_out,
+ indirects, split_outputs, false);
- lower_io_arrays_to_elements(consumer, nir_var_shader_in, indirects,
- patch_indirects, split_inputs, false);
+ lower_io_arrays_to_elements(consumer, nir_var_shader_in,
+ indirects, split_inputs, false);
/* Remove old input from the shaders inputs list */
hash_table_foreach(split_inputs, entry) {