yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

jarcherNVFix atomic fp16 vector SPIRV emit (#8104)f241b1438

master
824 B22 linesraw
1//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry computeMain -stage compute -emit-spirv-directly
2
3//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
4RWStructuredBuffer<float> outputBuffer;
5
6//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):name=workBuffer
7RWStructuredBuffer<half2> workBuffer;
8
9[numthreads(1, 1, 1)]
10void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
11{
12    half2 originalValue;
13    
14    // Direct atomic operation on half2 should trigger the SPV_NV_shader_atomic_fp16_vector extension
15    originalValue = __atomic_add(workBuffer[0], half2(1.0h, 2.0h));
16    
17    outputBuffer[0] = float(originalValue.x);
18    outputBuffer[1] = float(originalValue.y);
19}
20
21// CHECK: OpCapability AtomicFloat16VectorNV
22// CHECK: OpExtension "SPV_NV_shader_atomic_fp16_vector"