mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 03:50:13 +01:00
nir: track if var copies lowering was called
In general we should only call it once, and then we should avoid to call any lowering that introduce back copies. So far we were tracking that manually out of the nir shader on several places. Ideally we would like to add a nir_validate rule, but right now there are some exceptions to this rule. For example right now the Intel compiler calls nir_lower_io_to_temporaries as part of linking tess_ctrl/mesh/task sahders. One option would be to allow drivers to reset the value, but for now let's not add that validation rule. Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19338>
This commit is contained in:
parent
27a89a0903
commit
3685528c1e
3 changed files with 13 additions and 0 deletions
|
|
@ -164,6 +164,8 @@ nir_lower_var_copies(nir_shader *shader)
|
|||
{
|
||||
bool progress = false;
|
||||
|
||||
shader->info.var_copies_lowered = true;
|
||||
|
||||
nir_foreach_function(function, shader) {
|
||||
if (function->impl)
|
||||
progress |= lower_var_copies_impl(function->impl);
|
||||
|
|
|
|||
|
|
@ -643,6 +643,12 @@ validate_intrinsic_instr(nir_intrinsic_instr *instr, validate_state *state)
|
|||
validate_assert(state, glsl_get_bare_type(dst->type) ==
|
||||
glsl_get_bare_type(src->type));
|
||||
validate_assert(state, !nir_deref_mode_may_be(dst, nir_var_read_only_modes));
|
||||
/* FIXME: now that we track if the var copies were lowered, it would be
|
||||
* good to validate here that no new copy derefs were added. Right now
|
||||
* we can't as there are some specific cases where copies are added even
|
||||
* after the lowering. One example is the Intel compiler, that calls
|
||||
* nir_lower_io_to_temporaries when linking some shader stages.
|
||||
*/
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -297,6 +297,11 @@ typedef struct shader_info {
|
|||
*/
|
||||
bool io_lowered:1;
|
||||
|
||||
/** Has nir_lower_var_copies called. To avoid calling any
|
||||
* lowering/optimization that would introduce any copy_deref later.
|
||||
*/
|
||||
bool var_copies_lowered:1;
|
||||
|
||||
/* Whether the shader writes memory, including transform feedback. */
|
||||
bool writes_memory:1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue