yum-mirror/slang

Making it easier to work with shaders

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

ArielG-NVSet `nullptr` to the default value of the target VarDeclBase (#4757)ff6519f0b

master
442 B14 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv -stage compute -entry computeMain -O0
2
3//CHECK: %[[NULLPTR_VAL:[a-zA-Z0-9_]+]] = OpConvertUToPtr %_ptr_PhysicalStorageBuffer_int %{{.*}}
4//CHECK: OpStore %ptr %[[NULLPTR_VAL]]
5
6[vk::push_constant] int* dest;
7[numthreads(1, 1, 1)]
8void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
9{
10    int* ptr = nullptr;
11    if (dispatchThreadID.x % 2 == 0) ptr = dest;
12    if (ptr) *ptr = 123;
13
14}