summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cross-compile/precise-keyword.slang23
-rw-r--r--tests/cross-compile/precise-keyword.slang.glsl26
-rw-r--r--tests/cross-compile/precise-keyword.slang.hlsl18
3 files changed, 67 insertions, 0 deletions
diff --git a/tests/cross-compile/precise-keyword.slang b/tests/cross-compile/precise-keyword.slang
new file mode 100644
index 000000000..5ebfd35ad
--- /dev/null
+++ b/tests/cross-compile/precise-keyword.slang
@@ -0,0 +1,23 @@
+// precise-keyword.slang
+
+//TEST:CROSS_COMPILE:-target spirv-assembly -entry main -stage fragment
+//TEST:CROSS_COMPILE:-target dxbc-assembly -entry main -stage fragment
+//TEST:CROSS_COMPILE:-target dxil-assembly -entry main -stage fragment -profile sm_6_0
+
+// Test handling of the `precise` keyword
+
+float4 main(float2 v : V) : SV_Target
+{
+ precise float z;
+
+ if(v.x > 0)
+ {
+ z = v.x * v.y + v.x;
+ }
+ else
+ {
+ z = v.y * v.x + v.y;
+ }
+
+ return z;
+}
diff --git a/tests/cross-compile/precise-keyword.slang.glsl b/tests/cross-compile/precise-keyword.slang.glsl
new file mode 100644
index 000000000..be541ff94
--- /dev/null
+++ b/tests/cross-compile/precise-keyword.slang.glsl
@@ -0,0 +1,26 @@
+// precise-keyword.slang.glsl
+//TEST_IGNORE_FILE:
+
+#version 450
+
+layout(location = 0)
+out vec4 _S1;
+
+layout(location = 0)
+in vec2 _S2;
+
+void main()
+{
+ precise float z_0;
+
+ if(_S2.x > float(0))
+ {
+ z_0 = _S2.x * _S2.y + _S2.x;
+ }
+ else
+ {
+ z_0 = _S2.y * _S2.x + _S2.y;
+ }
+ _S1 = vec4(z_0);
+ return;
+} \ No newline at end of file
diff --git a/tests/cross-compile/precise-keyword.slang.hlsl b/tests/cross-compile/precise-keyword.slang.hlsl
new file mode 100644
index 000000000..54017868b
--- /dev/null
+++ b/tests/cross-compile/precise-keyword.slang.hlsl
@@ -0,0 +1,18 @@
+// precise-keyword.slang.hlsl
+//TEST_IGNORE_FILE:
+
+float4 main(float2 v_0 : V) : SV_TARGET
+{
+ precise float z_0;
+
+ if(v_0.x > (float) 0)
+ {
+ z_0 = v_0.x * v_0.y + v_0.x;
+ }
+ else
+ {
+ z_0 = v_0.y * v_0.x + v_0.y;
+ }
+
+ return (float4) z_0;
+} \ No newline at end of file