mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 06:50:11 +01:00
spirv: Don't remove dead variables in create_library mode
The issues fixed by the removal happen when a module has multiple entry points and conflicting global variables. Neither conditions are expected in a library. Reviewed-by: Jesse Natalie <jenatali@microsoft.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8786>
This commit is contained in:
parent
fd44bcf9a8
commit
a0d73ca65c
1 changed files with 10 additions and 8 deletions
|
|
@ -5976,6 +5976,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
|
||||||
* initializers on outputs so nir_remove_dead_variables sees that they're
|
* initializers on outputs so nir_remove_dead_variables sees that they're
|
||||||
* written to.
|
* written to.
|
||||||
*/
|
*/
|
||||||
|
if (!options->create_library) {
|
||||||
nir_lower_variable_initializers(b->shader, nir_var_shader_out |
|
nir_lower_variable_initializers(b->shader, nir_var_shader_out |
|
||||||
nir_var_system_value);
|
nir_var_system_value);
|
||||||
const nir_remove_dead_variables_options dead_opts = {
|
const nir_remove_dead_variables_options dead_opts = {
|
||||||
|
|
@ -5984,6 +5985,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
|
||||||
};
|
};
|
||||||
nir_remove_dead_variables(b->shader, ~nir_var_function_temp,
|
nir_remove_dead_variables(b->shader, ~nir_var_function_temp,
|
||||||
b->vars_used_indirectly ? &dead_opts : NULL);
|
b->vars_used_indirectly ? &dead_opts : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* We sometimes generate bogus derefs that, while never used, give the
|
/* We sometimes generate bogus derefs that, while never used, give the
|
||||||
* validator a bit of heartburn. Run dead code to get rid of them.
|
* validator a bit of heartburn. Run dead code to get rid of them.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue