yum-mirror/slang

Making it easier to work with shaders

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

James Helferty (NVIDIA)render-test: Change D3D12 default to sm_6_5 (#8320)f02b08490

master
1.0 KiB36 linesraw
1//DISABLED_TEST(compute, vulkan):COMPARE_COMPUTE_EX():-vk -compute -shaderobj -output-using-type -render-features wave-ops
2//DISABLED_TEST(compute):COMPARE_COMPUTE_EX():-dx12 -profile sm_6_5 -compute -shaderobj -output-using-type -render-features wave-ops
3
4//TEST_INPUT:ubuffer(data=[0 3 2 2], stride=4):out,name=outputBuffer
5RWStructuredBuffer<uint> outputBuffer;
6
7struct Unit{};
8
9static int count = 0;
10
11int cooperate(float x, Unit)
12{
13    count += 1;
14    return int(x) * 2;
15}
16
17int fallback(float x, Unit)
18{
19    count += 100;
20    return int(x) * 3;
21}
22
23// Make sure that we have enough invocations to saturate the first workgroup
24[numthreads(128, 1, 1)]
25void computeMain(uint tig : SV_GroupIndex)
26{
27    // The values we're cooperating over are {0, 2, 3}
28    // We track the number of sets evaluated in the "count" variable, and write
29    // that at index 0
30    let i = tig < 4 ? float(outputBuffer[tig]) : 0;
31    Unit unit;
32    let x = saturated_cooperation(cooperate, fallback, i, unit);
33    if(tig < 4)
34        outputBuffer[tig] = tig == 0 ? count : x;
35
36}