SPV: recursively propagate row/col majorness through nested structures.

This includes doing structure uniqueness modulo majorness, for shared nested structures.
This commit is contained in:
John Kessenich
2015-12-20 11:29:16 -07:00
parent f85e806e44
commit 3ac051e41d
9 changed files with 313 additions and 163 deletions

View File

@@ -7,132 +7,217 @@ Linked vertex stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 54
// Id's are bound by 63
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 38 52 53
EntryPoint Vertex 4 "main" 61 62
Source GLSL 450
Name 4 "main"
Name 13 "S"
MemberName 13(S) 0 "a"
MemberName 13(S) 1 "b"
MemberName 13(S) 2 "c"
Name 15 "s"
Name 18 "S"
MemberName 18(S) 0 "a"
MemberName 18(S) 1 "b"
MemberName 18(S) 2 "c"
Name 23 "Block140"
MemberName 23(Block140) 0 "u"
MemberName 23(Block140) 1 "s"
MemberName 23(Block140) 2 "v"
Name 25 "inst140"
Name 36 "gl_PerVertex"
MemberName 36(gl_PerVertex) 0 "gl_Position"
MemberName 36(gl_PerVertex) 1 "gl_PointSize"
MemberName 36(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 36(gl_PerVertex) 3 "gl_CullDistance"
Name 38 ""
Name 45 "S"
MemberName 45(S) 0 "a"
MemberName 45(S) 1 "b"
MemberName 45(S) 2 "c"
Name 48 "Block430"
MemberName 48(Block430) 0 "u"
MemberName 48(Block430) 1 "s"
MemberName 48(Block430) 2 "v"
Name 50 "inst430"
Name 52 "gl_VertexID"
Name 53 "gl_InstanceID"
MemberDecorate 13(S) 1 ColMajor
Decorate 12 ArrayStride 32
MemberDecorate 18(S) 0 Offset 0
MemberDecorate 18(S) 1 ColMajor
MemberDecorate 18(S) 1 Offset 16
MemberDecorate 18(S) 1 MatrixStride 16
MemberDecorate 18(S) 2 Offset 144
Decorate 22 ArrayStride 16
MemberDecorate 23(Block140) 0 Offset 0
MemberDecorate 23(Block140) 1 Offset 16
MemberDecorate 23(Block140) 2 Offset 976
Decorate 23(Block140) Block
Decorate 25(inst140) DescriptorSet 0
Decorate 25(inst140) Binding 0
MemberDecorate 36(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 36(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 36(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 36(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 36(gl_PerVertex) Block
Decorate 12 ArrayStride 16
MemberDecorate 45(S) 0 Offset 0
MemberDecorate 45(S) 1 ColMajor
MemberDecorate 45(S) 1 Offset 16
MemberDecorate 45(S) 1 MatrixStride 8
MemberDecorate 45(S) 2 Offset 80
Decorate 47 ArrayStride 16
MemberDecorate 48(Block430) 0 Offset 0
MemberDecorate 48(Block430) 1 Offset 16
MemberDecorate 48(Block430) 2 Offset 592
Decorate 48(Block430) BufferBlock
Decorate 50(inst430) DescriptorSet 0
Decorate 50(inst430) Binding 1
Decorate 52(gl_VertexID) BuiltIn VertexId
Decorate 53(gl_InstanceID) BuiltIn InstanceId
Name 14 "S"
MemberName 14(S) 0 "a"
MemberName 14(S) 1 "b"
MemberName 14(S) 2 "c"
Name 19 "Block140"
MemberName 19(Block140) 0 "u"
MemberName 19(Block140) 1 "s"
MemberName 19(Block140) 2 "v"
Name 21 "inst140"
Name 22 "S"
MemberName 22(S) 0 "a"
MemberName 22(S) 1 "b"
MemberName 22(S) 2 "c"
Name 25 "Block430"
MemberName 25(Block430) 0 "u"
MemberName 25(Block430) 1 "s"
MemberName 25(Block430) 2 "v"
Name 27 "inst430"
Name 28 "S"
MemberName 28(S) 0 "a"
MemberName 28(S) 1 "b"
MemberName 28(S) 2 "c"
Name 30 "s"
Name 31 "T"
MemberName 31(T) 0 "m"
MemberName 31(T) 1 "a"
Name 33 "t"
Name 34 "T"
MemberName 34(T) 0 "m"
MemberName 34(T) 1 "a"
Name 35 "Nestor"
MemberName 35(Nestor) 0 "nestorT"
Name 36 "Bt1"
MemberName 36(Bt1) 0 "nt"
Name 38 "Btn1"
Name 39 "T"
MemberName 39(T) 0 "m"
MemberName 39(T) 1 "a"
Name 40 "Nestor"
MemberName 40(Nestor) 0 "nestorT"
Name 41 "Bt2"
MemberName 41(Bt2) 0 "nt"
Name 43 "Btn2"
Name 44 "Bt3"
MemberName 44(Bt3) 0 "ntcol"
MemberName 44(Bt3) 1 "ntrow"
Name 46 "Btn3"
Name 47 "T"
MemberName 47(T) 0 "m"
MemberName 47(T) 1 "a"
Name 48 "Nestor"
MemberName 48(Nestor) 0 "nestorT"
Name 49 "bBt1"
MemberName 49(bBt1) 0 "nt"
Name 51 "bBtn1"
Name 52 "T"
MemberName 52(T) 0 "m"
MemberName 52(T) 1 "a"
Name 53 "Nestor"
MemberName 53(Nestor) 0 "nestorT"
Name 54 "bBt2"
MemberName 54(bBt2) 0 "nt"
Name 56 "bBtn2"
Name 57 "bBt3"
MemberName 57(bBt3) 0 "ntcol"
MemberName 57(bBt3) 1 "ntrow"
Name 59 "bBtn3"
Name 61 "gl_VertexID"
Name 62 "gl_InstanceID"
Decorate 13 ArrayStride 32
MemberDecorate 14(S) 0 Offset 0
MemberDecorate 14(S) 1 ColMajor
MemberDecorate 14(S) 1 Offset 16
MemberDecorate 14(S) 1 MatrixStride 16
MemberDecorate 14(S) 2 Offset 144
Decorate 18 ArrayStride 16
MemberDecorate 19(Block140) 0 Offset 0
MemberDecorate 19(Block140) 1 Offset 16
MemberDecorate 19(Block140) 2 Offset 976
Decorate 19(Block140) Block
Decorate 21(inst140) DescriptorSet 0
Decorate 21(inst140) Binding 0
Decorate 13 ArrayStride 16
MemberDecorate 22(S) 0 Offset 0
MemberDecorate 22(S) 1 ColMajor
MemberDecorate 22(S) 1 Offset 16
MemberDecorate 22(S) 1 MatrixStride 8
MemberDecorate 22(S) 2 Offset 80
Decorate 24 ArrayStride 16
MemberDecorate 25(Block430) 0 Offset 0
MemberDecorate 25(Block430) 1 Offset 16
MemberDecorate 25(Block430) 2 Offset 592
Decorate 25(Block430) BufferBlock
Decorate 27(inst430) DescriptorSet 0
Decorate 27(inst430) Binding 1
MemberDecorate 34(T) 0 RowMajor
MemberDecorate 34(T) 0 Offset 0
MemberDecorate 34(T) 0 MatrixStride 16
MemberDecorate 34(T) 1 Offset 32
MemberDecorate 35(Nestor) 0 Offset 0
MemberDecorate 36(Bt1) 0 Offset 0
Decorate 36(Bt1) Block
Decorate 38(Btn1) DescriptorSet 1
Decorate 38(Btn1) Binding 0
MemberDecorate 39(T) 0 ColMajor
MemberDecorate 39(T) 0 Offset 0
MemberDecorate 39(T) 0 MatrixStride 16
MemberDecorate 39(T) 1 Offset 32
MemberDecorate 40(Nestor) 0 Offset 0
MemberDecorate 41(Bt2) 0 Offset 0
Decorate 41(Bt2) Block
Decorate 43(Btn2) DescriptorSet 1
Decorate 43(Btn2) Binding 0
MemberDecorate 44(Bt3) 0 Offset 0
MemberDecorate 44(Bt3) 1 Offset 48
Decorate 44(Bt3) Block
Decorate 46(Btn3) DescriptorSet 1
Decorate 46(Btn3) Binding 0
MemberDecorate 47(T) 0 RowMajor
MemberDecorate 47(T) 0 Offset 0
MemberDecorate 47(T) 0 MatrixStride 8
MemberDecorate 47(T) 1 Offset 16
MemberDecorate 48(Nestor) 0 Offset 0
MemberDecorate 49(bBt1) 0 Offset 0
Decorate 49(bBt1) BufferBlock
Decorate 51(bBtn1) DescriptorSet 1
Decorate 51(bBtn1) Binding 0
MemberDecorate 52(T) 0 ColMajor
MemberDecorate 52(T) 0 Offset 0
MemberDecorate 52(T) 0 MatrixStride 8
MemberDecorate 52(T) 1 Offset 16
MemberDecorate 53(Nestor) 0 Offset 0
MemberDecorate 54(bBt2) 0 Offset 0
Decorate 54(bBt2) BufferBlock
Decorate 56(bBtn2) DescriptorSet 1
Decorate 56(bBtn2) Binding 0
MemberDecorate 57(bBt3) 0 Offset 0
MemberDecorate 57(bBt3) 1 Offset 24
Decorate 57(bBt3) BufferBlock
Decorate 59(bBtn3) DescriptorSet 1
Decorate 59(bBtn3) Binding 0
Decorate 61(gl_VertexID) BuiltIn VertexId
Decorate 62(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 0
7: TypeVector 6(int) 3
8: TypeFloat 32
9: TypeVector 8(float) 2
10: TypeMatrix 9(fvec2) 2
11: 6(int) Constant 4
12: TypeArray 10 11
13(S): TypeStruct 7(ivec3) 12 6(int)
14: TypePointer Private 13(S)
15(s): 14(ptr) Variable Private
16: TypeInt 32 1
17: 16(int) Constant 2
18(S): TypeStruct 7(ivec3) 12 6(int)
19: 6(int) Constant 3
20: TypeArray 18(S) 19
21: 6(int) Constant 2
22: TypeArray 20 21
23(Block140): TypeStruct 16(int) 22 9(fvec2)
24: TypePointer Uniform 23(Block140)
25(inst140): 24(ptr) Variable Uniform
26: 16(int) Constant 0
27: TypePointer Uniform 16(int)
31: TypePointer Private 6(int)
33: TypeVector 8(float) 4
34: 6(int) Constant 1
35: TypeArray 8(float) 34
36(gl_PerVertex): TypeStruct 33(fvec4) 8(float) 35 35
37: TypePointer Output 36(gl_PerVertex)
38: 37(ptr) Variable Output
43: TypePointer Output 33(fvec4)
45(S): TypeStruct 7(ivec3) 12 6(int)
46: TypeArray 45(S) 19
47: TypeArray 46 21
48(Block430): TypeStruct 16(int) 47 9(fvec2)
49: TypePointer Uniform 48(Block430)
50(inst430): 49(ptr) Variable Uniform
51: TypePointer Input 16(int)
52(gl_VertexID): 51(ptr) Variable Input
53(gl_InstanceID): 51(ptr) Variable Input
6: TypeInt 32 1
7: TypeInt 32 0
8: TypeVector 7(int) 3
9: TypeFloat 32
10: TypeVector 9(float) 2
11: TypeMatrix 10(fvec2) 2
12: 7(int) Constant 4
13: TypeArray 11 12
14(S): TypeStruct 8(ivec3) 13 7(int)
15: 7(int) Constant 3
16: TypeArray 14(S) 15
17: 7(int) Constant 2
18: TypeArray 16 17
19(Block140): TypeStruct 6(int) 18 10(fvec2)
20: TypePointer Uniform 19(Block140)
21(inst140): 20(ptr) Variable Uniform
22(S): TypeStruct 8(ivec3) 13 7(int)
23: TypeArray 22(S) 15
24: TypeArray 23 17
25(Block430): TypeStruct 6(int) 24 10(fvec2)
26: TypePointer Uniform 25(Block430)
27(inst430): 26(ptr) Variable Uniform
28(S): TypeStruct 8(ivec3) 13 7(int)
29: TypePointer Private 28(S)
30(s): 29(ptr) Variable Private
31(T): TypeStruct 11 6(int)
32: TypePointer Private 31(T)
33(t): 32(ptr) Variable Private
34(T): TypeStruct 11 6(int)
35(Nestor): TypeStruct 34(T)
36(Bt1): TypeStruct 35(Nestor)
37: TypePointer Uniform 36(Bt1)
38(Btn1): 37(ptr) Variable Uniform
39(T): TypeStruct 11 6(int)
40(Nestor): TypeStruct 39(T)
41(Bt2): TypeStruct 40(Nestor)
42: TypePointer Uniform 41(Bt2)
43(Btn2): 42(ptr) Variable Uniform
44(Bt3): TypeStruct 40(Nestor) 35(Nestor)
45: TypePointer Uniform 44(Bt3)
46(Btn3): 45(ptr) Variable Uniform
47(T): TypeStruct 11 6(int)
48(Nestor): TypeStruct 47(T)
49(bBt1): TypeStruct 48(Nestor)
50: TypePointer Uniform 49(bBt1)
51(bBtn1): 50(ptr) Variable Uniform
52(T): TypeStruct 11 6(int)
53(Nestor): TypeStruct 52(T)
54(bBt2): TypeStruct 53(Nestor)
55: TypePointer Uniform 54(bBt2)
56(bBtn2): 55(ptr) Variable Uniform
57(bBt3): TypeStruct 48(Nestor) 53(Nestor)
58: TypePointer Uniform 57(bBt3)
59(bBtn3): 58(ptr) Variable Uniform
60: TypePointer Input 6(int)
61(gl_VertexID): 60(ptr) Variable Input
62(gl_InstanceID): 60(ptr) Variable Input
4(main): 2 Function None 3
5: Label
28: 27(ptr) AccessChain 25(inst140) 26
29: 16(int) Load 28
30: 6(int) Bitcast 29
32: 31(ptr) AccessChain 15(s) 17
Store 32 30
39: 31(ptr) AccessChain 15(s) 17
40: 6(int) Load 39
41: 8(float) ConvertUToF 40
42: 33(fvec4) CompositeConstruct 41 41 41 41
44: 43(ptr) AccessChain 38 26
Store 44 42
Return
FunctionEnd

View File

@@ -1,6 +1,6 @@
#version 450
// should get 3 SPV types: no layout, 140, and 430
// should get 3 SPV types for S: no layout, 140, and 430
struct S
{
highp uvec3 a;
@@ -24,8 +24,50 @@ layout(set = 0, binding = 1, std430) buffer Block430
S s;
// should get 5 SPV types for T: no layout, 140/row, 140/col, 430/row, and 430/col
struct T {
mat2 m;
int a;
};
T t;
struct Nestor {
T nestorT;
};
layout(set = 1, binding = 0, std140) uniform Bt1
{
layout(row_major) Nestor nt;
} Btn1;
layout(set = 1, binding = 0, std140) uniform Bt2
{
layout(column_major) Nestor nt;
} Btn2;
layout(row_major, set = 1, binding = 0, std140) uniform Bt3
{
layout(column_major) Nestor ntcol;
Nestor ntrow; // should be row major decoration version of Nestor
} Btn3;
layout(set = 1, binding = 0, std430) buffer bBt1
{
layout(row_major) Nestor nt;
} bBtn1;
layout(set = 1, binding = 0, std430) buffer bBt2
{
layout(column_major) Nestor nt;
} bBtn2;
layout(set = 1, binding = 0, std430) buffer bBt3
{
layout(row_major) Nestor ntcol;
Nestor ntrow; // should be col major decoration version of Nestor
} bBtn3;
void main()
{
s.c = inst140.u;
gl_Position = vec4(s.c);
}