summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2017-10-20 15:16:10 -0700
committerGitHub <noreply@github.com>2017-10-20 15:16:10 -0700
commit624d122a3a110922cd54aab7bbf13f1cac8fbbff (patch)
tree098d3c7eb9e7561088f835c4bcea6efbacaf701c /tests
parent7ba937faa3f72b0f319150c3dde041d8a353c007 (diff)
Fix up emission of shader parameter semantics when using IR (#226)
* Fix up emission of shader parameter semantics when using IR - Make sure to propagate entry point parameter layouts down to IR parameters when doing the initial cloning to form target-specific IR - When layout information is present on an IR node, prefer to use that over the original high-level declaration for outputting semantics in final HLSL - Fix up test runner to generate `.actual` files when running compute tests, in cases where the `render-test` application errors out (e.g., because of a Slang compilation error) - Add a first test of generics functionality, to show that they generate valid code through the IR - Right now this test is *not* using any "interesting" operations on the type parameter, so this is not a test that can confirm that interface constraints work * fixup: skip compute tests when running on Linux
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/generics-simple.slang26
-rw-r--r--tests/compute/generics-simple.slang.expected.txt4
2 files changed, 30 insertions, 0 deletions
diff --git a/tests/compute/generics-simple.slang b/tests/compute/generics-simple.slang
new file mode 100644
index 000000000..0002e444b
--- /dev/null
+++ b/tests/compute/generics-simple.slang
@@ -0,0 +1,26 @@
+//TEST(smoke,compute):COMPARE_COMPUTE:-xslang -use-ir
+
+// Confirm that generics syntax can be used in user
+// code and generates valid output.
+
+RWStructuredBuffer<float> outputBuffer;
+
+
+__generic<T>
+T test(T val)
+{
+ return val;
+}
+
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ uint tid = dispatchThreadID.x;
+
+ float inVal = float(tid);
+
+ float outVal = test<float>(inVal);
+
+ outputBuffer[tid] = outVal;
+} \ No newline at end of file
diff --git a/tests/compute/generics-simple.slang.expected.txt b/tests/compute/generics-simple.slang.expected.txt
new file mode 100644
index 000000000..fdaa30664
--- /dev/null
+++ b/tests/compute/generics-simple.slang.expected.txt
@@ -0,0 +1,4 @@
+0.0
+1.0
+2.0
+3.0 \ No newline at end of file