yum-mirror/slang

Making it easier to work with shaders

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

Yong HeAllow pointers to existential values. (#5793)09a9d6733

master
688 B26 linesraw
1
2// Emit 0xFFFF as the stride value for the unsized array
3
4//TEST:SIMPLE(filecheck=CHECK): -entry fragment -stage fragment -emit-spirv-directly -target spirv-assembly -emit-spirv-directly
5struct Descriptors {
6  uint count;
7  uint4 array[];
8}
9
10struct Context {
11  Descriptors *descriptors;
12}
13
14[[vk::binding(0)]] ConstantBuffer<Context> context;
15
16// Dummy entry point.
17[shader("fragment")]
18float4 fragment(): SV_Target
19{
20  return float4(float(context.descriptors->array[0].x), 1., 1., 1.);
21}
22
23// CHECK: OpDecorate %_ptr_PhysicalStorageBuffer_Descriptors_natural ArrayStride 4
24// CHECK: OpBitcast %ulong
25// CHECK: OpIAdd %ulong %{{.*}} %ulong_4
26// CHECK: OpBitcast %_ptr_PhysicalStorageBuffer