yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Theresa FoleyFixes for crash when inlining at global scope (#2593)14fab67c5

master
546 B20 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
2//TEST(compute,vulkan):COMPARE_COMPUTE_EX:-vk -slang -compute -shaderobj
3
4static const float3 CONSTANT = float3(16);
5
6int test(int value)
7{
8    return value*int(CONSTANT.x) + value;
9}
10
11//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
12RWStructuredBuffer<int> outputBuffer;
13
14[numthreads(4, 1, 1)]
15void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
16{
17    let index = int(dispatchThreadID.x);
18    let value = test(index);
19    outputBuffer[index] = value;
20}