yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
9a16700e8
master
1// byte-address-buffer-align-error.slang 2 3//TEST:SIMPLE(filecheck=CHECK):-target glsl -entry computeMain -stage compute 4//TEST:SIMPLE(filecheck=CHECK):-target hlsl -entry computeMain -stage compute 5//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry computeMain -stage compute 6//TEST:SIMPLE(filecheck=CHECK):-target spirv -emit-spirv-directly -entry computeMain -stage compute 7//TEST:SIMPLE(filecheck=CHECK):-target cuda -entry computeMain -stage compute 8 9// Confirm compilation of `(RW)ByteAddressBuffer` with aligned load / stores to wider data types. 10 11[vk::binding(2, 3)] RWByteAddressBuffer buffer; 12struct Block { 13 float4 val[2]; 14}; 15[shader("compute")] 16[numthreads(1,1,1)] 17void computeMain(uint3 threadId : SV_DispatchThreadID) 18{ 19 // CHECK: error 41300: invalid alignment `{{.*}}` specified for the byte address buffer resource with the element size of `{{.*}}` 20 // CHECK: error 41300: invalid alignment `{{.*}}` specified for the byte address buffer resource with the element size of `{{.*}}` 21 buffer.Store<Block>(0, buffer.LoadAligned<Block>(1, 5)); 22 buffer.Store<Block>(1, buffer.Load<Block>(0), 3); 23 24} 25