Revision b915ae662b2e4bcaaeb6da62eb964356d0a978b4 authored by jsmall-nvidia on 05 May 2022, 19:53:29 UTC, committed by GitHub on 05 May 2022, 19:53:29 UTC
* #include an absolute path didn't work - because paths were taken to always be relative. * Add support for HLSL `export`. * Test for using `export` keyword.
1 parent 3088d90
direct-spirv-control-flow-2.slang
// direct-spirv-control-flow-2.slang
//TESTD:SIMPLE:-target spirv -entry computeMain -stage compute -emit-spirv-directly
//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -emit-spirv-directly
// Test direct SPIR-V emit on control flows.
//TEST_INPUT:set resultBuffer = out ubuffer(data=[0 0 0 0], stride=4)
RWStructuredBuffer<uint> resultBuffer;
uint test(uint p)
{
int result = 0;
for (int i = 0; i < 5; i++)
{
result += i*2;
}
switch (p)
{
case 0:
result = result - 1;
break;
case 1:
result = result + 1;
break;
default:
result = result * 2;
break;
}
if (p > 2)
{
switch (p)
{
case 3:
result++;
break;
}
}
return result;
}
[numthreads(4,1,1)]
void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
{
uint threadId = dispatchThreadID.x;
uint result = test(threadId);
resultBuffer[threadId] = result;
}
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...