yum-mirror/slang

Making it easier to work with shaders

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

Tim FoleyIR/Vulkan fixes (#412)1b93da040

master
1.3 KiB54 linesraw
1#version 450
2//TEST_DISABLED(smoke):REFLECTION:-profile ps_4_0 -target glsl
3
4// Note: disabled because we don't support GLSL input any more
5// (kept around so we can replace with an equivalent
6// test that uses HLSL input and tests GLSL layout rules)
7
8// Confirm fix for GitHub issue #55
9
10struct Foo
11{
12	vec2 f;
13};
14
15layout(set = 0, binding = 0)
16buffer SomeBuffer
17{
18	// offset: 0, size: 4, alignment: 4
19    float a;
20
21    // offset: 16, size: 12, alignment: 16
22    //
23    // Note that it can't immediately follow `a`
24    // bcause of its alignment
25    vec3 b;
26
27    // offset: 28, size: 16, alignment: 4, stride: 4
28    //
29    // This array can be densely packed and 4-byte aligned under `std430` rules
30    float c[4];
31
32    // offset: 48, size: 8, alignment: 8
33    //
34    // This nees to be bumped up to a 8-byte aligned boundary
35    vec2 d;
36
37    // offset: 56, size: 8, alignment: 8
38    //
39    // This can come right after `d`, because `struct` types no longer
40    // get an artificial padding out to 16-byte alignment 
41    Foo e;
42
43    // offset: 64, size: 12: alignment: 16
44    vec3 g;
45
46    // offset: 76, size: 4, alignment: 4
47    //
48    // This can fit in the empty space after `g` because we allow
49    // the size of a `vec3` to be smaller than its alignment
50    float h;
51};
52
53void main()
54{}