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.5 KiB33 linesraw
1//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -output-using-type -shaderobj -render-feature double
2//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -output-using-type -shaderobj -render-feature double
3//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -output-using-type -shaderobj
4//TEST(compute):COMPARE_COMPUTE_EX:-dx12 -compute -output-using-type -shaderobj
5//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-dx12 -compute -output-using-type -shaderobj
6//DISABLE_TEST(compute):COMPARE_COMPUTE:-slang -shaderobj -mtl
7// Not supported in WGSL: Double and other unsupported scalar types
8//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-wgpu
9
10// The problem this test shows is around handling of double with dxbc on D3D12. In that combination
11// this code does not write the correct value into the first element - it appears as 0, where 
12// clearly w * pi_180 where w = 1 means the answer is not zero.
13//
14// To demonstrate the problem, renable the -dx12 -compute -output-using-type test. It will output 0 for the first item.
15
16//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0], stride=4):out, name outputBuffer
17RWStructuredBuffer<double> outputBuffer;
18
19[numthreads(1, 1, 1)]
20void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
21{
22    double w = double(dispatchThreadID.x + 1) * 38.63323592724938038L;
23
24    double pi = 3.14159274101257324L;
25
26    double pi_180 = pi/180;
27    double rad = w * pi_180;            
28            
29    outputBuffer[0] = rad;
30    outputBuffer[1] = pi;
31    outputBuffer[2] = pi_180;
32    outputBuffer[3] = w;
33}