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.3 KiB42 linesraw
1//TEST_CATEGORY(wave, compute)
2//DISABLE_TEST:COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
3//DISABLE_TEST:COMPARE_COMPUTE_EX:-slang -compute -shaderobj
4TEST:COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 -shaderobj
5// Disabled on VK because glsl can't do WaveReadLaneAt on matrix. 
6//DISABLE_TEST(vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj
7TEST:COMPARE_COMPUTE_EX:-cuda -compute -render-features cuda_sm_7_0 -shaderobj
8
9//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
10RWStructuredBuffer<int> outputBuffer;
11
12[numthreads(4, 1, 1)]
13void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
14{
15    int idx = int(dispatchThreadID.x);
16    
17    int value = 0;
18    
19    // Scalar
20    
21    value += WaveBroadcastLaneAt(idx, 1);
22    
23    // vector
24    
25    {
26        float2 v = float2(idx + 1, idx + 2);
27        float2 readValue = WaveBroadcastLaneAt(v, 2);
28        
29        value += int(readValue[0] + readValue[1]);
30    }
31        
32    // matrix
33    {
34        matrix<int, 2, 2> v = matrix<int, 2, 2>(idx, idx - 1, idx * 3, idx - 2);
35        
36        matrix<int, 2, 2> readValue = WaveBroadcastLaneAt(v, 3);
37        
38        value += int(readValue[0][0] + readValue[0][1] + readValue[1][0] + readValue[1][1]);
39    }
40    
41    outputBuffer[idx] = value;
42}