From 624d122a3a110922cd54aab7bbf13f1cac8fbbff Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 20 Oct 2017 15:16:10 -0700 Subject: 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 --- tests/compute/generics-simple.slang | 26 ++++++++++++++++++++++++ tests/compute/generics-simple.slang.expected.txt | 4 ++++ 2 files changed, 30 insertions(+) create mode 100644 tests/compute/generics-simple.slang create mode 100644 tests/compute/generics-simple.slang.expected.txt (limited to 'tests') 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 outputBuffer; + + +__generic +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(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 -- cgit v1.2.3