broadcom/compiler: add driver_location_map at vs prog data
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>
This commit is contained in:

committed by
Marge Bot

parent
2be0c36775
commit
b71fd5587e
@@ -834,6 +834,15 @@ struct v3d_vs_prog_data {
|
||||
|
||||
/* 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 {
|
||||
|
@@ -651,6 +651,14 @@ v3d_vs_set_prog_data(struct v3d_compile *c,
|
||||
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,
|
||||
|
Reference in New Issue
Block a user