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.6 KiB45 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -shaderobj
2// On dx11 this causes a crash on CI (not currently not repeatable on test systems)
3//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type -shaderobj
4// This is disabled because Dx12/DXBC doing double writes to a structured buffer can fail
5//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -output-using-type -shaderobj
6//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile sm_6_0 -output-using-type -shaderobj -render-feature hardware-device
7//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -shaderobj -render-feature double
8//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -output-using-type -shaderobj
9
10//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name outputBuffer
11RWStructuredBuffer<double> outputBuffer;
12
13[numthreads(4, 1, 1)]
14void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
15{
16    int idx = int(dispatchThreadID.x);
17    
18    double f = idx * (1.0f / (4.0f));
19
20    int it = 0;
21    double ft = 0.0l;
22    
23    // We known fmod is NOT supported on double on DX - only float is supported
24    // ft += int(((f % 0.11l) * 100) + 0.5l);
25    
26    ft += rcp(1.0l + f);
27    ft += sign(f - 0.5l);
28    
29    ft += saturate(f * 4 - 2.0l);
30       
31    ft += abs(f * 4 - 2.0l);
32           
33    ft += min(0.5l, f);
34    ft += max(f, 0.75l);
35
36    ft += clamp(f, 0.1l, 0.3l);
37    
38    {
39        uint low, high;
40        asuint(f * 2.0l, low, high);
41        ft += asdouble(low, high);
42    }
43    
44    outputBuffer[idx] = ft;
45}