mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 16:00:08 +01:00
nir: add shader_info::disable_input/output_offset_src_constant_folding
and set it where needed to prevent nir_opt_constant_folding from breaking those drivers. Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38277>
This commit is contained in:
parent
7330bca9db
commit
9a56672f56
5 changed files with 13 additions and 0 deletions
|
|
@ -1040,6 +1040,7 @@ v3d_nir_lower_vs_early(struct v3d_compile *c)
|
||||||
NIR_PASS(_, c->s, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
|
NIR_PASS(_, c->s, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
|
||||||
type_size_vec4,
|
type_size_vec4,
|
||||||
(nir_lower_io_options)0);
|
(nir_lower_io_options)0);
|
||||||
|
c->s->info.disable_output_offset_src_constant_folding = true;
|
||||||
|
|
||||||
/* For geometry stages using the same segment for inputs and outputs
|
/* For geometry stages using the same segment for inputs and outputs
|
||||||
* we need to read all inputs before writing any output. If we switch
|
* we need to read all inputs before writing any output. If we switch
|
||||||
|
|
@ -1082,6 +1083,8 @@ v3d_nir_lower_gs_early(struct v3d_compile *c)
|
||||||
NIR_PASS(_, c->s, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
|
NIR_PASS(_, c->s, nir_lower_io, nir_var_shader_in | nir_var_shader_out,
|
||||||
type_size_vec4,
|
type_size_vec4,
|
||||||
(nir_lower_io_options)0);
|
(nir_lower_io_options)0);
|
||||||
|
c->s->info.disable_output_offset_src_constant_folding = true;
|
||||||
|
|
||||||
/* clean up nir_lower_io's deref_var remains and do a constant folding pass
|
/* clean up nir_lower_io's deref_var remains and do a constant folding pass
|
||||||
* on the code it generated.
|
* on the code it generated.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,12 @@ typedef struct shader_info {
|
||||||
/* Whether flrp has been lowered. */
|
/* Whether flrp has been lowered. */
|
||||||
bool flrp_lowered:1;
|
bool flrp_lowered:1;
|
||||||
|
|
||||||
|
/* Whether nir_opt_constant_folding should not fold offset srcs of
|
||||||
|
* IO intrinsics.
|
||||||
|
*/
|
||||||
|
bool disable_input_offset_src_constant_folding:1;
|
||||||
|
bool disable_output_offset_src_constant_folding:1;
|
||||||
|
|
||||||
/* Whether nir_lower_io has been called to lower derefs.
|
/* Whether nir_lower_io has been called to lower derefs.
|
||||||
* nir_variables for inputs and outputs might not be present in the IR.
|
* nir_variables for inputs and outputs might not be present in the IR.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -2514,6 +2514,7 @@ vc4_shader_state_create(struct pipe_context *pctx,
|
||||||
NIR_PASS(_, s, nir_lower_io,
|
NIR_PASS(_, s, nir_lower_io,
|
||||||
nir_var_shader_in | nir_var_shader_out | nir_var_uniform,
|
nir_var_shader_in | nir_var_shader_out | nir_var_uniform,
|
||||||
type_size, (nir_lower_io_options)0);
|
type_size, (nir_lower_io_options)0);
|
||||||
|
s->info.disable_output_offset_src_constant_folding = true;
|
||||||
|
|
||||||
NIR_PASS(_, s, nir_normalize_cubemap_coords);
|
NIR_PASS(_, s, nir_normalize_cubemap_coords);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1165,6 +1165,7 @@ brw_nir_lower_fs_outputs(nir_shader *nir)
|
||||||
}
|
}
|
||||||
|
|
||||||
NIR_PASS(_, nir, nir_lower_io, nir_var_shader_out, type_size_vec4, 0);
|
NIR_PASS(_, nir, nir_lower_io, nir_var_shader_out, type_size_vec4, 0);
|
||||||
|
nir->info.disable_output_offset_src_constant_folding = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
|
||||||
|
|
@ -6636,6 +6636,8 @@ nir_to_dxil(struct nir_shader *s, const struct nir_to_dxil_options *opts,
|
||||||
NIR_PASS(_, s, nir_lower_frexp);
|
NIR_PASS(_, s, nir_lower_frexp);
|
||||||
NIR_PASS(_, s, nir_lower_flrp, 16 | 32 | 64, true);
|
NIR_PASS(_, s, nir_lower_flrp, 16 | 32 | 64, true);
|
||||||
NIR_PASS(_, s, nir_lower_io, nir_var_shader_in | nir_var_shader_out, type_size_vec4, nir_lower_io_lower_64bit_to_32);
|
NIR_PASS(_, s, nir_lower_io, nir_var_shader_in | nir_var_shader_out, type_size_vec4, nir_lower_io_lower_64bit_to_32);
|
||||||
|
s->info.disable_input_offset_src_constant_folding = true;
|
||||||
|
s->info.disable_output_offset_src_constant_folding = true;
|
||||||
NIR_PASS(_, s, dxil_nir_ensure_position_writes);
|
NIR_PASS(_, s, dxil_nir_ensure_position_writes);
|
||||||
NIR_PASS(_, s, dxil_nir_lower_system_values);
|
NIR_PASS(_, s, dxil_nir_lower_system_values);
|
||||||
NIR_PASS(_, s, nir_lower_io_to_scalar, nir_var_shader_in | nir_var_system_value | nir_var_shader_out, NULL, NULL);
|
NIR_PASS(_, s, nir_lower_io_to_scalar, nir_var_shader_in | nir_var_system_value | nir_var_shader_out, NULL, NULL);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue