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 KiB29 linesraw
1// No atomic support on CPU
2//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute -shaderobj
3// No support for int64_t on DX11
4//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj
5//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile cs_6_0 -render-features atomic-int64 -compile-arg -O2 -shaderobj
6//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -render-features atomic-int64 -shaderobj
7//TEST(compute):COMPARE_COMPUTE_EX:-cuda -compute -shaderobj
8
9// The test doesn't directly use this, but having this defined makes the 0 slot available if NVAPI is going to be used
10// Only strictly necessary on the D3D12 path
11//TEST_INPUT:ubuffer(data=[0 0 0 0 ], stride=4):name=nvapiBuffer
12RWStructuredBuffer<int> nvapiBuffer;
13
14//TEST_INPUT:ubuffer(data=[0 1 2 3 4 5 6 7]):out,name=outputBuffer
15RWByteAddressBuffer outputBuffer;
16
17// With only 4 threads there is no contention - which makes for a simple test
18// but doesn't actually test for the exchange atomicity
19[numthreads(4, 1, 1)]
20void computeMain(int3 dispatchThreadID : SV_DispatchThreadID)
21{    
22    int idx = dispatchThreadID.x;
23    
24    // Try directly reading
25    uint2 currentValue2 = outputBuffer.Load2(idx << 3);
26    uint64_t currentValue = uint64_t(currentValue2.y) | currentValue2.x;    
27    
28    uint64_t readValue = outputBuffer.InterlockedExchangeU64(idx << 3, currentValue + 1);
29}