mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-26 21:30:09 +01:00
brw: move helper to brw_nir.c
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Ivan Briano <ivan.briano@intel.com> Reviewed-by: Caio Oliveira <caio.oliveira@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34109>
This commit is contained in:
parent
cbbe7ff66e
commit
b64f237dc4
3 changed files with 26 additions and 22 deletions
|
|
@ -551,28 +551,6 @@ brw_mue_assign_position(const struct attr_desc *attr,
|
|||
}
|
||||
}
|
||||
|
||||
static nir_variable *
|
||||
brw_nir_find_complete_variable_with_location(nir_shader *shader,
|
||||
nir_variable_mode mode,
|
||||
int location)
|
||||
{
|
||||
nir_variable *best_var = NULL;
|
||||
unsigned last_size = 0;
|
||||
|
||||
nir_foreach_variable_with_modes(var, shader, mode) {
|
||||
if (var->data.location != location)
|
||||
continue;
|
||||
|
||||
unsigned new_size = glsl_count_dword_slots(var->type, false);
|
||||
if (new_size > last_size) {
|
||||
best_var = var;
|
||||
last_size = new_size;
|
||||
}
|
||||
}
|
||||
|
||||
return best_var;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
brw_sum_size(const std::list<struct attr_desc> &orders)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2548,3 +2548,25 @@ brw_nir_lower_simd(nir_shader *nir, unsigned dispatch_width)
|
|||
return nir_shader_lower_instructions(nir, filter_simd, lower_simd,
|
||||
(void *)(uintptr_t)dispatch_width);
|
||||
}
|
||||
|
||||
nir_variable *
|
||||
brw_nir_find_complete_variable_with_location(nir_shader *shader,
|
||||
nir_variable_mode mode,
|
||||
int location)
|
||||
{
|
||||
nir_variable *best_var = NULL;
|
||||
unsigned last_size = 0;
|
||||
|
||||
nir_foreach_variable_with_modes(var, shader, mode) {
|
||||
if (var->data.location != location)
|
||||
continue;
|
||||
|
||||
unsigned new_size = glsl_count_dword_slots(var->type, false);
|
||||
if (new_size > last_size) {
|
||||
best_var = var;
|
||||
last_size = new_size;
|
||||
}
|
||||
}
|
||||
|
||||
return best_var;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,6 +318,10 @@ bool brw_nir_uses_inline_data(nir_shader *shader);
|
|||
nir_shader *
|
||||
brw_nir_from_spirv(void *mem_ctx, const uint32_t *spirv, size_t spirv_size);
|
||||
|
||||
nir_variable *
|
||||
brw_nir_find_complete_variable_with_location(nir_shader *shader,
|
||||
nir_variable_mode mode,
|
||||
int location);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue