SPV: Fix #1258: cache constant structs by id, not opcode.
Constants were generally cached by type opcode, but all structures share the same type opcode (OpTypeStruct), so they need to be cached by type id.
This commit is contained in:
parent
57f6a016f0
commit
46413d5780
5 changed files with 120 additions and 17 deletions
45
Test/baseResults/spv.constStruct.vert.out
Executable file
45
Test/baseResults/spv.constStruct.vert.out
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
spv.constStruct.vert
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80004
|
||||
// Id's are bound by 23
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Vertex 4 "main"
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 9 "T"
|
||||
MemberName 9(T) 0 "m"
|
||||
Name 10 "U"
|
||||
MemberName 10(U) 0 "m"
|
||||
Name 11 "S"
|
||||
MemberName 11(S) 0 "t"
|
||||
MemberName 11(S) 1 "u"
|
||||
Name 13 "s1"
|
||||
Name 22 "s2"
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypeVector 6(float) 2
|
||||
8: TypeMatrix 7(fvec2) 2
|
||||
9(T): TypeStruct 8
|
||||
10(U): TypeStruct 8
|
||||
11(S): TypeStruct 9(T) 10(U)
|
||||
12: TypePointer Function 11(S)
|
||||
14: 6(float) Constant 1065353216
|
||||
15: 6(float) Constant 0
|
||||
16: 7(fvec2) ConstantComposite 14 15
|
||||
17: 7(fvec2) ConstantComposite 15 14
|
||||
18: 8 ConstantComposite 16 17
|
||||
19: 9(T) ConstantComposite 18
|
||||
20: 10(U) ConstantComposite 18
|
||||
21: 11(S) ConstantComposite 19 20
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
13(s1): 12(ptr) Variable Function
|
||||
22(s2): 12(ptr) Variable Function
|
||||
Store 13(s1) 21
|
||||
Store 22(s2) 21
|
||||
Return
|
||||
FunctionEnd
|
||||
22
Test/spv.constStruct.vert
Normal file
22
Test/spv.constStruct.vert
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#version 450
|
||||
|
||||
precision highp float;
|
||||
|
||||
struct U {
|
||||
mat2 m;
|
||||
};
|
||||
|
||||
struct T {
|
||||
mat2 m;
|
||||
};
|
||||
|
||||
struct S {
|
||||
T t;
|
||||
U u;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
S s1 = S(T(mat2(1.0)), U(mat2(1.0)));
|
||||
S s2 = S(T(mat2(1.0)), U(mat2(1.0)));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue