yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
e0c20a076
master
1// byte-address-half-atomics.slang 2// test the atomics on half types. 3 4// Disabled because validation layer doesn't like vector atomics, although nv driver does allow it. 5//DISABLED_TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -compute -profile cs_6_2 -render-features half -shaderobj -emit-spirv-directly -output-using-type 6//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cuda -compute -profile cs_6_2 -render-features half -shaderobj -emit-spirv-directly -output-using-type 7//TEST:SIMPLE(filecheck=SPIRV):-target spirv -entry computeMain -stage compute -emit-spirv-directly -skip-spirv-validation 8//TEST:SIMPLE(filecheck=HLSL):-target hlsl -entry computeMain -profile cs_6_3 9//TEST_INPUT:set tmpBuffer = ubuffer(data=[0 0 0 0], stride=4) 10RWByteAddressBuffer tmpBuffer; 11 12//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer 13RWStructuredBuffer<float> outputBuffer; 14 15[numthreads(1, 1, 1)] 16void computeMain(int3 dispatchThreadID : SV_DispatchThreadID) 17{ 18 half originalValue; 19 20 // SPIRV: OpAtomicFAddEXT 21 // HLSL: NvInterlockedAddFp16x2 22 tmpBuffer.InterlockedAddF16(0, 1.0h, originalValue); 23 tmpBuffer.InterlockedAddF16(2, 2.0h, originalValue); 24 25 half2 v = tmpBuffer.Load<half2>(0); 26 27 // CHECK: 1.0 28 outputBuffer[0] = v.x; 29 // CHECK: 2.0 30 outputBuffer[1] = v.y; 31 // CHECK: 0.0 32 outputBuffer[3] = originalValue; 33}