From 0b05fe33c82ee301c134f5b9a87a596aa47121c8 Mon Sep 17 00:00:00 2001 From: Yong He Date: Thu, 10 Nov 2022 14:19:20 -0800 Subject: Fix inlining pass. (#2506) * Fix inlining pass. * Add more check against corner cases. * Revise comments. * Fixes. * Fix premake script. * Fixes. Co-authored-by: Yong He --- tests/language-feature/simple-inline.slang | 34 ++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/language-feature/simple-inline.slang (limited to 'tests/language-feature/simple-inline.slang') diff --git a/tests/language-feature/simple-inline.slang b/tests/language-feature/simple-inline.slang new file mode 100644 index 000000000..8203f489b --- /dev/null +++ b/tests/language-feature/simple-inline.slang @@ -0,0 +1,34 @@ +// simple-inline.slang + +//TEST(compute):COMPARE_COMPUTE: -shaderobj +//TEST(compute):COMPARE_COMPUTE: -vk -shaderobj +//DISABLE_TEST(compute):COMPARE_COMPUTE:-cpu -shaderobj + +[ForceInline] +int test(int r) +{ + return r+2; +} + +[ForceInline] +void testVoid(int r, out int result) +{ + if (r == 0) + { + result = 2; + return; + } + result = r + 3; +} + +//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer +RWStructuredBuffer outputBuffer; + +[numthreads(1, 1, 1)] +void computeMain(int3 dispatchThreadID: SV_DispatchThreadID) +{ + outputBuffer[0] = test(dispatchThreadID.x); + int rs; + testVoid(dispatchThreadID.x + 2, rs); + outputBuffer[1] = rs; +} -- cgit v1.2.3