yum-mirror/slang

Making it easier to work with shaders

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

Ellie HermaszewskaSPIR-V WIP (#3064)00bd481e0

master
705 B23 linesraw
1// direct-spirv-compute-simple.slang
2//TESTD:SIMPLE:-target spirv -entry computeMain -stage compute
3//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute
4
5// Test runinng a shader generated from direct SPIR-V emit.
6
7//TEST_INPUT:set resultBuffer = out ubuffer(data=[0 0 0 0], stride=4)
8RWStructuredBuffer<uint> resultBuffer;
9
10[numthreads(4,1,1)]
11void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
12{
13    uint threadId = dispatchThreadID.x;
14    uint result = threadId + 1;
15    result = result - 1;
16    result = result * 2;
17    result = result / 2;
18    result = result % 3;
19    result = (result ^ 7);
20    result = (result & 7);
21    result = (result | 8);
22    resultBuffer[threadId] = result;
23}