[PATCH vkd3d] vkd3d-shader: Decorate "precise" arithmetic instructions with SpvDecorationNoContraction.

Henri Verbeet hverbeet at codeweavers.com
Tue Jan 12 06:12:52 CST 2021


Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
For Wine bug 45046. I'm unable to reproduce the issue myself, but the patch is
reported as working by Matteo on IRC.

 libs/vkd3d-shader/spirv.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c
index 61d0d472..27bf40bd 100644
--- a/libs/vkd3d-shader/spirv.c
+++ b/libs/vkd3d-shader/spirv.c
@@ -6368,6 +6368,8 @@ static void vkd3d_dxbc_compiler_emit_alu_instruction(struct vkd3d_dxbc_compiler
 
     val_id = vkd3d_spirv_build_op_trv(builder, &builder->function_stream, op, type_id,
             src_ids, instruction->src_count);
+    if (instruction->flags & VKD3DSI_PRECISE_XYZW)
+        vkd3d_spirv_build_op_decorate(builder, val_id, SpvDecorationNoContraction, NULL, 0);
 
     vkd3d_dxbc_compiler_emit_store_dst(compiler, dst, val_id);
 }
@@ -6600,6 +6602,8 @@ static void vkd3d_dxbc_compiler_emit_dot(struct vkd3d_dxbc_compiler *compiler,
         val_id = vkd3d_dxbc_compiler_emit_construct_vector(compiler,
                 component_type, component_count, val_id, 0, 1);
     }
+    if (instruction->flags & VKD3DSI_PRECISE_XYZW)
+        vkd3d_spirv_build_op_decorate(builder, val_id, SpvDecorationNoContraction, NULL, 0);
 
     vkd3d_dxbc_compiler_emit_store_dst(compiler, dst, val_id);
 }
-- 
2.11.0




More information about the wine-devel mailing list