mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 22:30:12 +01:00
nir,clover: Drop nir_lower_mem_constant_vars
We have a more generic helper now so clover doesn't need quite as many special paths. Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565>
This commit is contained in:
parent
2e8e275075
commit
c730ace12b
2 changed files with 11 additions and 34 deletions
|
|
@ -2298,7 +2298,7 @@ nir_lower_vars_to_explicit_types(nir_shader *shader,
|
||||||
* - interface types
|
* - interface types
|
||||||
*/
|
*/
|
||||||
ASSERTED nir_variable_mode supported =
|
ASSERTED nir_variable_mode supported =
|
||||||
nir_var_mem_shared | nir_var_mem_global |
|
nir_var_mem_shared | nir_var_mem_global | nir_var_mem_constant |
|
||||||
nir_var_shader_temp | nir_var_function_temp | nir_var_uniform;
|
nir_var_shader_temp | nir_var_function_temp | nir_var_uniform;
|
||||||
assert(!(modes & ~supported) && "unsupported");
|
assert(!(modes & ~supported) && "unsupported");
|
||||||
|
|
||||||
|
|
@ -2310,6 +2310,8 @@ nir_lower_vars_to_explicit_types(nir_shader *shader,
|
||||||
progress |= lower_vars_to_explicit(shader, &shader->variables, nir_var_mem_shared, type_info);
|
progress |= lower_vars_to_explicit(shader, &shader->variables, nir_var_mem_shared, type_info);
|
||||||
if (modes & nir_var_shader_temp)
|
if (modes & nir_var_shader_temp)
|
||||||
progress |= lower_vars_to_explicit(shader, &shader->variables, nir_var_shader_temp, type_info);
|
progress |= lower_vars_to_explicit(shader, &shader->variables, nir_var_shader_temp, type_info);
|
||||||
|
if (modes & nir_var_mem_constant)
|
||||||
|
progress |= lower_vars_to_explicit(shader, &shader->variables, nir_var_mem_constant, type_info);
|
||||||
|
|
||||||
nir_foreach_function(function, shader) {
|
nir_foreach_function(function, shader) {
|
||||||
if (function->impl) {
|
if (function->impl) {
|
||||||
|
|
@ -2395,38 +2397,6 @@ nir_gather_explicit_io_initializers(nir_shader *shader,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
nir_lower_mem_constant_vars(nir_shader *shader,
|
|
||||||
glsl_type_size_align_func type_info)
|
|
||||||
{
|
|
||||||
bool progress = false;
|
|
||||||
|
|
||||||
unsigned old_constant_data_size = shader->constant_data_size;
|
|
||||||
if (lower_vars_to_explicit(shader, &shader->variables,
|
|
||||||
nir_var_mem_constant, type_info)) {
|
|
||||||
assert(shader->constant_data_size > old_constant_data_size);
|
|
||||||
shader->constant_data = rerzalloc_size(shader, shader->constant_data,
|
|
||||||
old_constant_data_size,
|
|
||||||
shader->constant_data_size);
|
|
||||||
nir_gather_explicit_io_initializers(shader, shader->constant_data,
|
|
||||||
shader->constant_data_size,
|
|
||||||
nir_var_mem_constant);
|
|
||||||
progress = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
nir_foreach_function(function, shader) {
|
|
||||||
if (!function->impl)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (nir_lower_vars_to_explicit_types_impl(function->impl,
|
|
||||||
nir_var_mem_constant,
|
|
||||||
type_info))
|
|
||||||
progress = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return progress;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the offset source for a load/store intrinsic.
|
* Return the offset source for a load/store intrinsic.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -455,8 +455,15 @@ module clover::nir::spirv_to_nir(const module &mod, const device &dev,
|
||||||
NIR_PASS_V(nir, nir_opt_constant_folding);
|
NIR_PASS_V(nir, nir_opt_constant_folding);
|
||||||
|
|
||||||
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_mem_constant, NULL);
|
NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_mem_constant, NULL);
|
||||||
NIR_PASS_V(nir, nir_lower_mem_constant_vars,
|
NIR_PASS_V(nir, nir_lower_vars_to_explicit_types, nir_var_mem_constant,
|
||||||
glsl_get_cl_type_size_align);
|
glsl_get_cl_type_size_align);
|
||||||
|
if (nir->constant_data_size > 0) {
|
||||||
|
assert(nir->constant_data == NULL);
|
||||||
|
nir->constant_data = rzalloc_size(nir, nir->constant_data_size);
|
||||||
|
nir_gather_explicit_io_initializers(nir, nir->constant_data,
|
||||||
|
nir->constant_data_size,
|
||||||
|
nir_var_mem_constant);
|
||||||
|
}
|
||||||
NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_constant,
|
NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_constant,
|
||||||
spirv_options.constant_addr_format);
|
spirv_options.constant_addr_format);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue