mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-28 14:40:10 +01:00
nir/algebraic: disable inexact optimizations depending on float controls execution mode
If FLOAT_CONTROLS_SIGNED_ZERO_INF_NAN_PRESERVE or FLOAT_CONTROLS_DENORM_FLUSH_TO_ZERO are enabled, do not apply the inexact optimizations so the VK_KHR_shader_float_controls execution mode is respected. v2: - Do not apply inexact optimizations if SHADER_DENORM_FLUSH_TO_ZERO is enabled (Andres). v3: - Updated to renamed shader info member (Andres). v4: - Directly access execution mode instead of dragging it by parameter (Caio). Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> Signed-off-by: Andres Gomez <agomez@igalia.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> [v1]
This commit is contained in:
parent
3f782cdd25
commit
f097247dd8
1 changed files with 5 additions and 0 deletions
|
|
@ -1158,6 +1158,7 @@ ${pass_name}_block(nir_builder *build, nir_block *block,
|
|||
const uint16_t *states, const bool *condition_flags)
|
||||
{
|
||||
bool progress = false;
|
||||
const unsigned execution_mode = build->shader->info.float_controls_execution_mode;
|
||||
|
||||
nir_foreach_instr_reverse_safe(instr, block) {
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
|
|
@ -1167,6 +1168,7 @@ ${pass_name}_block(nir_builder *build, nir_block *block,
|
|||
if (!alu->dest.dest.is_ssa)
|
||||
continue;
|
||||
|
||||
unsigned bit_size = alu->dest.dest.ssa.bit_size;
|
||||
switch (states[alu->dest.dest.ssa.index]) {
|
||||
% for i in range(len(automaton.state_patterns)):
|
||||
case ${i}:
|
||||
|
|
@ -1174,6 +1176,9 @@ ${pass_name}_block(nir_builder *build, nir_block *block,
|
|||
for (unsigned i = 0; i < ARRAY_SIZE(${pass_name}_state${i}_xforms); i++) {
|
||||
const struct transform *xform = &${pass_name}_state${i}_xforms[i];
|
||||
if (condition_flags[xform->condition_offset] &&
|
||||
!(xform->search->inexact &&
|
||||
(nir_is_float_control_signed_zero_inf_nan_preserve(execution_mode, bit_size) ||
|
||||
nir_is_denorm_flush_to_zero(execution_mode, bit_size))) &&
|
||||
nir_replace_instr(build, alu, xform->search, xform->replace)) {
|
||||
progress = true;
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue