HLSL: don't do a deepCopy() for typedef, as we still want to share the type graph.

This enables the IO type mapping to work transparently for typedefs.
This commit is contained in:
John Kessenich 2017-02-08 13:59:30 -07:00
parent 65ee230f1c
commit dd40260b63
4 changed files with 43 additions and 69 deletions

View File

@ -153,12 +153,12 @@ output primitive = triangle_strip
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 88 // Id's are bound by 73
Capability Geometry Capability Geometry
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 81 EntryPoint Geometry 4 "main" 66
ExecutionMode 4 InputPoints ExecutionMode 4 InputPoints
ExecutionMode 4 Invocations 1 ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputTriangleStrip ExecutionMode 4 OutputTriangleStrip
@ -175,18 +175,13 @@ output primitive = triangle_strip
Name 21 "Out" Name 21 "Out"
Name 30 "x" Name 30 "x"
Name 41 "y" Name 41 "y"
Name 49 "PSInput" Name 54 "Verts"
MemberName 49(PSInput) 0 "Pos" Name 64 "v"
MemberName 49(PSInput) 1 "TexCoord" Name 66 "v"
MemberName 49(PSInput) 2 "TerrainPos" Name 68 "OutputStream"
MemberName 49(PSInput) 3 "VertexID" Name 69 "param"
Name 55 "Verts" Name 71 "param"
Name 79 "v" Decorate 66(v) Location 0
Name 81 "v"
Name 83 "OutputStream"
Name 84 "param"
Name 86 "param"
Decorate 81(v) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 0 6: TypeInt 32 0
@ -211,32 +206,25 @@ output primitive = triangle_strip
31: 28(int) Constant 0 31: 28(int) Constant 0
38: 28(int) Constant 2 38: 28(int) Constant 2
39: TypeBool 39: TypeBool
49(PSInput): TypeStruct 11(fvec4) 12(fvec2) 13(fvec3) 6(int) 49: 6(int) Constant 3
50: 6(int) Constant 3 50: TypeArray 14(PSInput) 49
51: TypeArray 49(PSInput) 50 51: 6(int) Constant 2
52: 6(int) Constant 2 52: TypeArray 50 51
53: TypeArray 51 52 53: TypePointer Function 52
54: TypePointer Function 53 60: 28(int) Constant 1
59: TypePointer Function 49(PSInput) 65: TypePointer Input 8
62: TypePointer Function 11(fvec4) 66(v): 65(ptr) Variable Input
65: 28(int) Constant 1
66: TypePointer Function 12(fvec2)
69: TypePointer Function 13(fvec3)
72: 28(int) Constant 3
73: TypePointer Function 6(int)
80: TypePointer Input 8
81(v): 80(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
79(v): 9(ptr) Variable Function 64(v): 9(ptr) Variable Function
83(OutputStream): 15(ptr) Variable Function 68(OutputStream): 15(ptr) Variable Function
84(param): 9(ptr) Variable Function 69(param): 9(ptr) Variable Function
86(param): 15(ptr) Variable Function 71(param): 15(ptr) Variable Function
82: 8 Load 81(v) 67: 8 Load 66(v)
Store 79(v) 82 Store 64(v) 67
85: 8 Load 79(v) 70: 8 Load 64(v)
Store 84(param) 85 Store 69(param) 70
87: 2 FunctionCall 19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;) 84(param) 86(param) 72: 2 FunctionCall 19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;) 69(param) 71(param)
Return Return
FunctionEnd FunctionEnd
19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;): 2 Function None 16 19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;): 2 Function None 16
@ -246,7 +234,7 @@ output primitive = triangle_strip
21(Out): 15(ptr) Variable Function 21(Out): 15(ptr) Variable Function
30(x): 29(ptr) Variable Function 30(x): 29(ptr) Variable Function
41(y): 29(ptr) Variable Function 41(y): 29(ptr) Variable Function
55(Verts): 54(ptr) Variable Function 54(Verts): 53(ptr) Variable Function
Store 21(Out) 27 Store 21(Out) 27
Store 30(x) 31 Store 30(x) 31
Branch 32 Branch 32
@ -268,34 +256,23 @@ output primitive = triangle_strip
48: 39(bool) SLessThan 47 38 48: 39(bool) SLessThan 47 38
BranchConditional 48 43 44 BranchConditional 48 43 44
43: Label 43: Label
56: 28(int) Load 30(x) 55: 28(int) Load 30(x)
57: 28(int) Load 41(y) 56: 28(int) Load 41(y)
58: 14(PSInput) Load 21(Out) 57: 14(PSInput) Load 21(Out)
60: 59(ptr) AccessChain 55(Verts) 56 57 58: 15(ptr) AccessChain 54(Verts) 55 56
61: 11(fvec4) CompositeExtract 58 0 Store 58 57
63: 62(ptr) AccessChain 60 31
Store 63 61
64: 12(fvec2) CompositeExtract 58 1
67: 66(ptr) AccessChain 60 65
Store 67 64
68: 13(fvec3) CompositeExtract 58 2
70: 69(ptr) AccessChain 60 38
Store 70 68
71: 6(int) CompositeExtract 58 3
74: 73(ptr) AccessChain 60 72
Store 74 71
Branch 45 Branch 45
45: Label 45: Label
75: 28(int) Load 41(y) 59: 28(int) Load 41(y)
76: 28(int) IAdd 75 65 61: 28(int) IAdd 59 60
Store 41(y) 76 Store 41(y) 61
Branch 42 Branch 42
44: Label 44: Label
Branch 35 Branch 35
35: Label 35: Label
77: 28(int) Load 30(x) 62: 28(int) Load 30(x)
78: 28(int) IAdd 77 65 63: 28(int) IAdd 62 60
Store 30(x) 78 Store 30(x) 63
Branch 32 Branch 32
34: Label 34: Label
Return Return

View File

@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits. // For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run). // For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1792" #define GLSLANG_REVISION "Overload400-PrecQual.1817"
#define GLSLANG_DATE "06-Feb-2017" #define GLSLANG_DATE "08-Feb-2017"

View File

@ -5336,12 +5336,9 @@ const TFunction* HlslParseContext::findFunction(const TSourceLoc& loc, TFunction
// 'parseType' is the type part of the declaration (to the left) // 'parseType' is the type part of the declaration (to the left)
// 'arraySizes' is the arrayness tagged on the identifier (to the right) // 'arraySizes' is the arrayness tagged on the identifier (to the right)
// //
void HlslParseContext::declareTypedef(const TSourceLoc& loc, TString& identifier, const TType& parseType, TArraySizes* /*arraySizes*/) void HlslParseContext::declareTypedef(const TSourceLoc& loc, TString& identifier, const TType& parseType)
{ {
TType type; TVariable* typeSymbol = new TVariable(&identifier, parseType, true);
type.deepCopy(parseType);
TVariable* typeSymbol = new TVariable(&identifier, type, true);
if (! symbolTable.insert(*typeSymbol)) if (! symbolTable.insert(*typeSymbol))
error(loc, "name already defined", "typedef", identifier.c_str()); error(loc, "name already defined", "typedef", identifier.c_str());
} }

View File

@ -130,7 +130,7 @@ public:
void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&); void checkNoShaderLayouts(const TSourceLoc&, const TShaderQualifiers&);
const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, TIntermTyped*& args); const TFunction* findFunction(const TSourceLoc& loc, TFunction& call, bool& builtIn, TIntermTyped*& args);
void declareTypedef(const TSourceLoc&, TString& identifier, const TType&, TArraySizes* typeArray = 0); void declareTypedef(const TSourceLoc&, TString& identifier, const TType&);
void declareStruct(const TSourceLoc&, TString& structName, TType&); void declareStruct(const TSourceLoc&, TString& structName, TType&);
TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, TType&, TIntermTyped* initializer = 0); TIntermNode* declareVariable(const TSourceLoc&, TString& identifier, TType&, TIntermTyped* initializer = 0);
void lengthenList(const TSourceLoc&, TIntermSequence& list, int size); void lengthenList(const TSourceLoc&, TIntermSequence& list, int size);