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
1010 B37 linesraw
1//DISABLE_TEST(compute):COMPARE_COMPUTE:-dx12 -compute -profile cs_6_2 -render-features half -shaderobj
2//TEST(compute):COMPARE_COMPUTE:-vk -compute -profile cs_6_2 -render-features half -shaderobj
3//TEST(compute):COMPARE_COMPUTE:-cuda -compute -render-features half -shaderobj
4
5// Test for doing a calculation using half
6
7//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
8RWStructuredBuffer<float> outputBuffer;
9
10[numthreads(4, 1, 1)]
11void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
12{
13    uint tid = dispatchThreadID.x;
14    
15    //half2 v0 = { 1, -2 };
16    //half2 v1 = { -2, 4 };
17    
18    //half2 v2 = (v0 * 2.0f + v1);
19    
20    // This should work (it compiles on dxc, but slang doesn't seem to have overloads yet)
21    //half offset = length(v2);
22    
23    //half offset = v2.x + v2.y;
24    
25    half offset = half(0.0f);
26    
27    half v = half(tid);
28    v *= half(3.0f);
29    v += half(1.0f);
30    v += offset;
31    
32    v++;
33    --v;
34    v--;
35    
36    outputBuffer[tid] = v;
37}