summaryrefslogtreecommitdiff
path: root/tests/cross-compile
diff options
context:
space:
mode:
Diffstat (limited to 'tests/cross-compile')
-rw-r--r--tests/cross-compile/fmod.slang28
-rw-r--r--tests/cross-compile/fmod.slang.expected.txt4
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/cross-compile/fmod.slang b/tests/cross-compile/fmod.slang
new file mode 100644
index 000000000..94d733e66
--- /dev/null
+++ b/tests/cross-compile/fmod.slang
@@ -0,0 +1,28 @@
+// fmod.slang
+
+// Ensure that HLSL `fmod` works and produces
+// expected output on Vulkan/GLSL.
+
+//TEST(compute):COMPARE_COMPUTE:-dx11 -compute
+//TEST(compute):COMPARE_COMPUTE:-vk -compute
+
+//TEST_INPUT:cbuffer(data=[4 0 0 0]):name=C
+cbuffer C
+{
+ int y;
+}
+
+int test(int x)
+{
+ return int(fmod(float(x), float(y)));
+}
+
+//TEST_INPUT:ubuffer(data=[-7 -2 2 7], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+ outputBuffer[tid] = test(outputBuffer[tid]);
+}
diff --git a/tests/cross-compile/fmod.slang.expected.txt b/tests/cross-compile/fmod.slang.expected.txt
new file mode 100644
index 000000000..02a433b0b
--- /dev/null
+++ b/tests/cross-compile/fmod.slang.expected.txt
@@ -0,0 +1,4 @@
+FFFFFFFD
+FFFFFFFE
+2
+3