yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
f96a3fea6
master
1// array-of-buffers.slang 2 3//TEST:SIMPLE(filecheck=SPIRV):-target spirv-assembly -entry main -stage fragment 4//TEST:SIMPLE(filecheck=DXIL):-target dxil-assembly -entry main -stage fragment -profile sm_6_0 5 6// SPIRV: OpEntryPoint 7// DXIL: define void @main() 8 9// This test ensures that we cross-compile arrays of structured/constant 10// buffers into appropriate GLSL, where these are not first-class types. 11// 12// Note that this test does *not* currently test the case of passing 13// a structured or constant buffer into a subroutine, which requires 14// further work. 15 16struct S { float4 f; }; 17 18cbuffer C 19{ 20 uint index; 21} 22 23ConstantBuffer<S> cb [3]; 24StructuredBuffer<S> sb1[4]; 25RWStructuredBuffer<float4> sb2[5]; 26ByteAddressBuffer bb [6]; 27 28float4 main() : SV_Target 29{ 30 return cb [index] .f 31 + sb1[index][index].f 32 + sb2[index][index] 33 + float4(bb[index].Load(int(index*4))); 34} 35