From f7d54af67e026feb2546af1deaf2513a36f8516e Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Thu, 2 May 2024 11:56:13 -0700 Subject: Fix fmod behavior targetting GLSL and SPIR-V (#4080) * Fix fmod behavior targetting GLSL and SPIR-V The default implementation of fmod was doing "Modulo" operation when "fmod" in HLSL should do "remainder" operation. * Fix a mistake in `fmod` GLSL target When using __intrinsic_asm, the "if" logic wasn't emitted. "__intrinsic_asm" had to be called from a new function and `fmod` had to call it. Alternatively, I am using `operator?()` to workaround. A similar modification is made to `roundEven()` hoping for a better performance. --- tests/cross-compile/fmod.slang | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests/cross-compile') diff --git a/tests/cross-compile/fmod.slang b/tests/cross-compile/fmod.slang index 6efff35b3..16ecf072a 100644 --- a/tests/cross-compile/fmod.slang +++ b/tests/cross-compile/fmod.slang @@ -4,7 +4,8 @@ // expected output on Vulkan/GLSL. //TEST(compute):COMPARE_COMPUTE:-dx11 -compute -shaderobj -//TEST(compute):COMPARE_COMPUTE:-vk -compute -shaderobj +//TEST(compute):COMPARE_COMPUTE:-vk -compute -shaderobj -emit-spirv-via-glsl +//TEST(compute):COMPARE_COMPUTE:-vk -compute -shaderobj -emit-spirv-directly //TEST_INPUT:cbuffer(data=[4 0 0 0]):name=C cbuffer C -- cgit v1.2.3