summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/half-texture.slang.1.expected2
-rw-r--r--tests/diagnostics/local-line.slang45
-rw-r--r--tests/diagnostics/local-line.slang.expected1
3 files changed, 46 insertions, 2 deletions
diff --git a/tests/compute/half-texture.slang.1.expected b/tests/compute/half-texture.slang.1.expected
index 1e1a282fa..7dd96403f 100644
--- a/tests/compute/half-texture.slang.1.expected
+++ b/tests/compute/half-texture.slang.1.expected
@@ -39,8 +39,6 @@ void computeMain(vector<uint,3> dispatchThreadID_0 : SV_DISPATCHTHREADID)
int index_0 = pos_0.x + pos_0.y * int(4);
outputBuffer_0[(uint) index_0] = index_0;
-
-#line 18
return;
}
diff --git a/tests/diagnostics/local-line.slang b/tests/diagnostics/local-line.slang
new file mode 100644
index 000000000..1cdeba7e4
--- /dev/null
+++ b/tests/diagnostics/local-line.slang
@@ -0,0 +1,45 @@
+//TEST:SIMPLE_LINE:-entry computeMain -target spirv -stage compute
+//TEST:SIMPLE_LINE:-entry computeMain -target dxil -profile cs_6_0
+//TEST:SIMPLE_LINE:-entry computeMain -target dxbc -stage compute
+//TEST:SIMPLE_LINE:-entry computeMain -target dll -stage compute
+//TEST:SIMPLE_LINE:-entry computeMain -target ptx -stage compute
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+int doThing(int a, int b)
+{
+ while (b >= 0)
+ {
+ a
+ +=
+ a;
+ }
+
+ return a;
+}
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ int a = dispatchThreadID.x;
+ int b = dispatchThreadID.y;
+ int c = dispatchThreadID.z;
+ int d = a + b * c;
+ int e = d + c / 2;
+
+ for (int i = 0; i < b; ++i)
+ {
+ if (e > 10 && i & 2)
+ {
+ a += b; b -= c; c += c; d = d + e + a; e = a;
+ }
+ else
+ {
+ a = e; b = c + c; d += d + __SyntaxError(); e = doThing(e, dispatchThreadID.x);
+
+ }
+ }
+
+ outputBuffer[dispatchThreadID.x] = a + b + c + d + e;
+}
diff --git a/tests/diagnostics/local-line.slang.expected b/tests/diagnostics/local-line.slang.expected
new file mode 100644
index 000000000..a2720097d
--- /dev/null
+++ b/tests/diagnostics/local-line.slang.expected
@@ -0,0 +1 @@
+39