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.8 KiB51 linesraw
1
2// Native half not supported on CPU currently
3//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -shaderobj
4// Doesn't work on DX11 currently - locks up on binding
5//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type -shaderobj
6// Produces a different result on DX12 with DXBC than expected(!). So disabled for now
7//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -output-using-type -shaderobj
8//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 -output-using-type -shaderobj
9// TODO(JS): Doesn't currently work on Vulkan - 3rd value in output appears incorrect
10//DISABLE_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -shaderobj
11//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj -render-features half
12
13//TEST_INPUT: RWTexture1D(format=R16Float, size=4, content = one, mipMaps = 1):name rwt1D
14RWTexture1D<half> rwt1D;
15
16//TEST_INPUT: RWTexture2D(format=R16Float, size=4, content = one, mipMaps = 1):name rwt2D
17RWTexture2D<half> rwt2D;
18
19//TEST_INPUT: RWTexture2D(format=RGBA16Float, size=4, content = one, mipMaps = 1):name rwt2D_4
20RWTexture2D<half4> rwt2D_4;
21
22//TEST_INPUT: ubuffer(data=[0 0 0 0], stride=4):out,name outputBuffer
23RWStructuredBuffer<float> outputBuffer;
24
25[numthreads(4, 1, 1)]
26void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
27{
28    uint idx = dispatchThreadID.x;
29    
30    float val = 0.0f;
31 
32    val += rwt1D[idx];
33    
34    half h0 = rwt2D[uint2(idx, idx)];
35
36    val += float(h0);
37    
38    half4 h1 = rwt2D_4[uint2(idx, idx)];
39    float4 f1 = h1;
40   
41    val += f1.x + f1.y + f1.z + f1.w;
42    
43    // rwt1D[idx] = idx;
44    rwt2D[uint2(idx, idx)] = half(idx);    
45    
46    //val += rwt1D[idx];
47    val += rwt2D[uint2(idx, idx)];
48    //val += rwt3D[uint3(idx, idx, idx)];
49 
50    outputBuffer[idx] = val;
51}