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
932 B33 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
2//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
3//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -shaderobj
4//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
5//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj
6
7//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
8RWStructuredBuffer<int> outputBuffer;
9
10[numthreads(4, 1, 1)]
11void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
12{
13    int idx = int(dispatchThreadID.x);
14
15    int3 a = { idx + 10, idx - 9, idx + 3};
16    int3 b = { idx * 2, idx * 3, idx * 10};
17    
18    int3 t = { 0, 0, 0};
19    
20    t += max(a, b);
21    t += min(a, b);
22    t += abs(a);
23    t += b % 5;
24    
25    t += clamp(a, int3(10), int3(23));
26   
27    // Swizzle
28    t += a.zyx;
29    // Swizzle from scalar
30    t += idx.xxx;
31       
32    outputBuffer[idx] = t.x + t.y + t.z;
33}