This maps the nir shader data.location to its final
data.driver_location. In general we are using the driver location as
index (like vattr_sizes on the same struct), so having this map is
useful if what we have is the data.location, and we don't have
available the original nir shader.
v2: use memset instead of for loop, and nir_foreach_shader_in_variable
instead of nir_foreach_variable_with_modes (Iago)
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9403>
/* Value to be programmed in VCM_CACHE_SIZE. */
uint8_t vcm_cache_size;
+
+ /* Maps the nir->data.location to its
+ * nir->data.driver_location. In general we are using the
+ * driver location as index (like vattr_sizes above), so this
+ * map is useful when what we have is the location
+ *
+ * Returns -1 if the location is not used
+ */
+ int32_t driver_location_map[V3D_MAX_VS_INPUTS];
};
struct v3d_gs_prog_data {
prog_data->vpm_input_size += c->vattr_sizes[i];
}
+ memset(prog_data->driver_location_map, -1,
+ sizeof(prog_data->driver_location_map));
+
+ nir_foreach_shader_in_variable(var, c->s) {
+ prog_data->driver_location_map[var->data.location] =
+ var->data.driver_location;
+ }
+
prog_data->uses_vid = BITSET_TEST(c->s->info.system_values_read,
SYSTEM_VALUE_VERTEX_ID) ||
BITSET_TEST(c->s->info.system_values_read,