Commit b68b9a8b by John Kessenich Committed by GitHub

Merge pull request #808 from steve-lunarg/gs-ep-wrap-fix

HLSL: fix GS to work with EP wrapping
parents 2184c2f2 08e0c086
...@@ -43,12 +43,12 @@ output primitive = line_strip ...@@ -43,12 +43,12 @@ output primitive = line_strip
0:20 0 (const int) 0:20 0 (const int)
0:22 Sequence 0:22 Sequence
0:22 move second child to first child ( temp structure{ temp float myfloat, temp int something}) 0:22 move second child to first child ( temp structure{ temp float myfloat, temp int something})
0:22 'OutputStream' ( out structure{ temp float myfloat, temp int something}) 0:22 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
0:22 'Vert' ( temp structure{ temp float myfloat, temp int something}) 0:22 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:22 EmitVertex ( temp void) 0:22 EmitVertex ( temp void)
0:23 Sequence 0:23 Sequence
0:23 move second child to first child ( temp structure{ temp float myfloat, temp int something}) 0:23 move second child to first child ( temp structure{ temp float myfloat, temp int something})
0:23 'OutputStream' ( out structure{ temp float myfloat, temp int something}) 0:23 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
0:23 'Vert' ( temp structure{ temp float myfloat, temp int something}) 0:23 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:23 EmitVertex ( temp void) 0:23 EmitVertex ( temp void)
0:24 EndPrimitive ( temp void) 0:24 EndPrimitive ( temp void)
...@@ -68,6 +68,7 @@ output primitive = line_strip ...@@ -68,6 +68,7 @@ output primitive = line_strip
0:? Linker Objects 0:? Linker Objects
0:? 'VertexID' (layout( location=0) in 3-element array of uint) 0:? 'VertexID' (layout( location=0) in 3-element array of uint)
0:? 'test' (layout( location=1) in 3-element array of uint) 0:? 'test' (layout( location=1) in 3-element array of uint)
0:? 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
Linked geometry stage: Linked geometry stage:
...@@ -117,12 +118,12 @@ output primitive = line_strip ...@@ -117,12 +118,12 @@ output primitive = line_strip
0:20 0 (const int) 0:20 0 (const int)
0:22 Sequence 0:22 Sequence
0:22 move second child to first child ( temp structure{ temp float myfloat, temp int something}) 0:22 move second child to first child ( temp structure{ temp float myfloat, temp int something})
0:22 'OutputStream' ( out structure{ temp float myfloat, temp int something}) 0:22 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
0:22 'Vert' ( temp structure{ temp float myfloat, temp int something}) 0:22 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:22 EmitVertex ( temp void) 0:22 EmitVertex ( temp void)
0:23 Sequence 0:23 Sequence
0:23 move second child to first child ( temp structure{ temp float myfloat, temp int something}) 0:23 move second child to first child ( temp structure{ temp float myfloat, temp int something})
0:23 'OutputStream' ( out structure{ temp float myfloat, temp int something}) 0:23 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
0:23 'Vert' ( temp structure{ temp float myfloat, temp int something}) 0:23 'Vert' ( temp structure{ temp float myfloat, temp int something})
0:23 EmitVertex ( temp void) 0:23 EmitVertex ( temp void)
0:24 EndPrimitive ( temp void) 0:24 EndPrimitive ( temp void)
...@@ -142,15 +143,16 @@ output primitive = line_strip ...@@ -142,15 +143,16 @@ output primitive = line_strip
0:? Linker Objects 0:? Linker Objects
0:? 'VertexID' (layout( location=0) in 3-element array of uint) 0:? 'VertexID' (layout( location=0) in 3-element array of uint)
0:? 'test' (layout( location=1) in 3-element array of uint) 0:? 'test' (layout( location=1) in 3-element array of uint)
0:? 'OutputStream' (layout( location=0) out structure{ temp float myfloat, temp int something})
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 57 // Id's are bound by 60
Capability Geometry Capability Geometry
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 45 48 EntryPoint Geometry 4 "main" 42 47 50
ExecutionMode 4 Triangles ExecutionMode 4 Triangles
ExecutionMode 4 Invocations 1 ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputLineStrip ExecutionMode 4 OutputLineStrip
...@@ -164,16 +166,18 @@ output primitive = line_strip ...@@ -164,16 +166,18 @@ output primitive = line_strip
Name 16 "test" Name 16 "test"
Name 17 "OutputStream" Name 17 "OutputStream"
Name 20 "Vert" Name 20 "Vert"
Name 43 "VertexID" Name 42 "OutputStream"
Name 45 "VertexID" Name 45 "VertexID"
Name 47 "test" Name 47 "VertexID"
Name 48 "test" Name 49 "test"
Name 50 "OutputStream" Name 50 "test"
Name 51 "param" Name 52 "OutputStream"
Name 53 "param" Name 53 "param"
Name 55 "param" Name 55 "param"
Decorate 45(VertexID) Location 0 Name 57 "param"
Decorate 48(test) Location 1 Decorate 42(OutputStream) Location 0
Decorate 47(VertexID) Location 0
Decorate 50(test) Location 1
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 0 6: TypeInt 32 0
...@@ -191,26 +195,30 @@ output primitive = line_strip ...@@ -191,26 +195,30 @@ output primitive = line_strip
29: 11(int) Constant 2 29: 11(int) Constant 2
34: TypePointer Function 10(float) 34: TypePointer Function 10(float)
39: TypePointer Function 11(int) 39: TypePointer Function 11(int)
44: TypePointer Input 8 41: TypePointer Output 12(PSInput)
45(VertexID): 44(ptr) Variable Input 42(OutputStream): 41(ptr) Variable Output
48(test): 44(ptr) Variable Input 46: TypePointer Input 8
47(VertexID): 46(ptr) Variable Input
50(test): 46(ptr) Variable Input
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
43(VertexID): 9(ptr) Variable Function 45(VertexID): 9(ptr) Variable Function
47(test): 9(ptr) Variable Function 49(test): 9(ptr) Variable Function
50(OutputStream): 13(ptr) Variable Function 52(OutputStream): 13(ptr) Variable Function
51(param): 9(ptr) Variable Function
53(param): 9(ptr) Variable Function 53(param): 9(ptr) Variable Function
55(param): 13(ptr) Variable Function 55(param): 9(ptr) Variable Function
46: 8 Load 45(VertexID) 57(param): 13(ptr) Variable Function
Store 43(VertexID) 46 48: 8 Load 47(VertexID)
49: 8 Load 48(test) Store 45(VertexID) 48
Store 47(test) 49 51: 8 Load 50(test)
52: 8 Load 43(VertexID) Store 49(test) 51
Store 51(param) 52 54: 8 Load 45(VertexID)
54: 8 Load 47(test)
Store 53(param) 54 Store 53(param) 54
56: 2 FunctionCall 18(@main(u1[3];u1[3];struct-PSInput-f1-i11;) 51(param) 53(param) 55(param) 56: 8 Load 49(test)
Store 55(param) 56
58: 2 FunctionCall 18(@main(u1[3];u1[3];struct-PSInput-f1-i11;) 53(param) 55(param) 57(param)
59: 12(PSInput) Load 57(param)
Store 52(OutputStream) 59
Return Return
FunctionEnd FunctionEnd
18(@main(u1[3];u1[3];struct-PSInput-f1-i11;): 2 Function None 14 18(@main(u1[3];u1[3];struct-PSInput-f1-i11;): 2 Function None 14
...@@ -235,11 +243,11 @@ output primitive = line_strip ...@@ -235,11 +243,11 @@ output primitive = line_strip
38: 11(int) Bitcast 37 38: 11(int) Bitcast 37
40: 39(ptr) AccessChain 20(Vert) 25 40: 39(ptr) AccessChain 20(Vert) 25
Store 40 38 Store 40 38
41: 12(PSInput) Load 20(Vert) 43: 12(PSInput) Load 20(Vert)
Store 17(OutputStream) 41 Store 42(OutputStream) 43
EmitVertex EmitVertex
42: 12(PSInput) Load 20(Vert) 44: 12(PSInput) Load 20(Vert)
Store 17(OutputStream) 42 Store 42(OutputStream) 44
EmitVertex EmitVertex
EndPrimitive EndPrimitive
Return Return
......
...@@ -72,6 +72,7 @@ output primitive = triangle_strip ...@@ -72,6 +72,7 @@ output primitive = triangle_strip
0:? 'OutputStream' ( temp structure{ temp 4-component vector of float Pos, temp 2-component vector of float TexCoord, temp 3-component vector of float TerrainPos, temp uint VertexID}) 0:? 'OutputStream' ( temp structure{ temp 4-component vector of float Pos, temp 2-component vector of float TexCoord, temp 3-component vector of float TerrainPos, temp uint VertexID})
0:? Linker Objects 0:? Linker Objects
0:? 'v' (layout( location=0) in 1-element array of uint) 0:? 'v' (layout( location=0) in 1-element array of uint)
0:? 'OutputStream' (layout( location=0) out structure{ temp 2-component vector of float TexCoord, temp 3-component vector of float TerrainPos, temp uint VertexID})
Linked geometry stage: Linked geometry stage:
...@@ -150,15 +151,16 @@ output primitive = triangle_strip ...@@ -150,15 +151,16 @@ output primitive = triangle_strip
0:? 'OutputStream' ( temp structure{ temp 4-component vector of float Pos, temp 2-component vector of float TexCoord, temp 3-component vector of float TerrainPos, temp uint VertexID}) 0:? 'OutputStream' ( temp structure{ temp 4-component vector of float Pos, temp 2-component vector of float TexCoord, temp 3-component vector of float TerrainPos, temp uint VertexID})
0:? Linker Objects 0:? Linker Objects
0:? 'v' (layout( location=0) in 1-element array of uint) 0:? 'v' (layout( location=0) in 1-element array of uint)
0:? 'OutputStream' (layout( location=0) out structure{ temp 2-component vector of float TexCoord, temp 3-component vector of float TerrainPos, temp uint VertexID})
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 73 // Id's are bound by 77
Capability Geometry Capability Geometry
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 66 EntryPoint Geometry 4 "main" 66 76
ExecutionMode 4 InputPoints ExecutionMode 4 InputPoints
ExecutionMode 4 Invocations 1 ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputTriangleStrip ExecutionMode 4 OutputTriangleStrip
...@@ -181,7 +183,13 @@ output primitive = triangle_strip ...@@ -181,7 +183,13 @@ output primitive = triangle_strip
Name 68 "OutputStream" Name 68 "OutputStream"
Name 69 "param" Name 69 "param"
Name 71 "param" Name 71 "param"
Name 74 "PSInput"
MemberName 74(PSInput) 0 "TexCoord"
MemberName 74(PSInput) 1 "TerrainPos"
MemberName 74(PSInput) 2 "VertexID"
Name 76 "OutputStream"
Decorate 66(v) Location 0 Decorate 66(v) Location 0
Decorate 76(OutputStream) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeInt 32 0 6: TypeInt 32 0
...@@ -214,6 +222,9 @@ output primitive = triangle_strip ...@@ -214,6 +222,9 @@ output primitive = triangle_strip
60: 28(int) Constant 1 60: 28(int) Constant 1
65: TypePointer Input 8 65: TypePointer Input 8
66(v): 65(ptr) Variable Input 66(v): 65(ptr) Variable Input
74(PSInput): TypeStruct 12(fvec2) 13(fvec3) 6(int)
75: TypePointer Output 74(PSInput)
76(OutputStream): 75(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
64(v): 9(ptr) Variable Function 64(v): 9(ptr) Variable Function
...@@ -225,6 +236,8 @@ output primitive = triangle_strip ...@@ -225,6 +236,8 @@ output primitive = triangle_strip
70: 8 Load 64(v) 70: 8 Load 64(v)
Store 69(param) 70 Store 69(param) 70
72: 2 FunctionCall 19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;) 69(param) 71(param) 72: 2 FunctionCall 19(@main(u1[1];struct-PSInput-vf4-vf2-vf3-u11;) 69(param) 71(param)
73: 14(PSInput) Load 71(param)
Store 68(OutputStream) 73
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
......
...@@ -35,9 +35,13 @@ output primitive = triangle_strip ...@@ -35,9 +35,13 @@ output primitive = triangle_strip
0:18 Constant: 0:18 Constant:
0:18 0 (const int) 0:18 0 (const int)
0:19 Sequence 0:19 Sequence
0:19 move second child to first child ( temp structure{ temp 4-component vector of float pos}) 0:19 Sequence
0:19 'ts' ( out structure{ temp 4-component vector of float pos}) 0:19 move second child to first child ( temp 4-component vector of float)
0:19 'o' ( temp structure{ temp 4-component vector of float pos}) 0:? 'ts_pos' ( out 4-component vector of float Position)
0:19 pos: direct index for structure ( temp 4-component vector of float)
0:19 'o' ( temp structure{ temp 4-component vector of float pos})
0:19 Constant:
0:19 0 (const int)
0:19 EmitVertex ( temp void) 0:19 EmitVertex ( temp void)
0:17 Loop Terminal Expression 0:17 Loop Terminal Expression
0:17 Pre-Increment ( temp int) 0:17 Pre-Increment ( temp int)
...@@ -87,6 +91,7 @@ output primitive = triangle_strip ...@@ -87,6 +91,7 @@ output primitive = triangle_strip
0:? 'ts' ( temp structure{ temp 4-component vector of float pos}) 0:? 'ts' ( temp structure{ temp 4-component vector of float pos})
0:? Linker Objects 0:? Linker Objects
0:? 'i' (layout( location=0) in 3-element array of structure{}) 0:? 'i' (layout( location=0) in 3-element array of structure{})
0:? 'ts' (layout( location=0) out structure{})
Linked geometry stage: Linked geometry stage:
...@@ -128,9 +133,13 @@ output primitive = triangle_strip ...@@ -128,9 +133,13 @@ output primitive = triangle_strip
0:18 Constant: 0:18 Constant:
0:18 0 (const int) 0:18 0 (const int)
0:19 Sequence 0:19 Sequence
0:19 move second child to first child ( temp structure{ temp 4-component vector of float pos}) 0:19 Sequence
0:19 'ts' ( out structure{ temp 4-component vector of float pos}) 0:19 move second child to first child ( temp 4-component vector of float)
0:19 'o' ( temp structure{ temp 4-component vector of float pos}) 0:? 'ts_pos' ( out 4-component vector of float Position)
0:19 pos: direct index for structure ( temp 4-component vector of float)
0:19 'o' ( temp structure{ temp 4-component vector of float pos})
0:19 Constant:
0:19 0 (const int)
0:19 EmitVertex ( temp void) 0:19 EmitVertex ( temp void)
0:17 Loop Terminal Expression 0:17 Loop Terminal Expression
0:17 Pre-Increment ( temp int) 0:17 Pre-Increment ( temp int)
...@@ -180,15 +189,16 @@ output primitive = triangle_strip ...@@ -180,15 +189,16 @@ output primitive = triangle_strip
0:? 'ts' ( temp structure{ temp 4-component vector of float pos}) 0:? 'ts' ( temp structure{ temp 4-component vector of float pos})
0:? Linker Objects 0:? Linker Objects
0:? 'i' (layout( location=0) in 3-element array of structure{}) 0:? 'i' (layout( location=0) in 3-element array of structure{})
0:? 'ts' (layout( location=0) out structure{})
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 67 // Id's are bound by 74
Capability Geometry Capability Geometry
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450 MemoryModel Logical GLSL450
EntryPoint Geometry 4 "main" 46 66 EntryPoint Geometry 4 "main" 40 49 70 73
ExecutionMode 4 Triangles ExecutionMode 4 Triangles
ExecutionMode 4 Invocations 1 ExecutionMode 4 Invocations 1
ExecutionMode 4 OutputTriangleStrip ExecutionMode 4 OutputTriangleStrip
...@@ -203,15 +213,20 @@ output primitive = triangle_strip ...@@ -203,15 +213,20 @@ output primitive = triangle_strip
Name 17 "ts" Name 17 "ts"
Name 22 "x" Name 22 "x"
Name 33 "o" Name 33 "o"
Name 43 "i" Name 40 "ts_pos"
Name 46 "i_pos" Name 46 "i"
Name 58 "ts" Name 49 "i_pos"
Name 59 "param" Name 61 "ts"
Name 61 "param" Name 62 "param"
Name 63 "PS_IN" Name 64 "param"
Name 66 "i" Name 67 "PS_IN"
Decorate 46(i_pos) BuiltIn Position Name 70 "i"
Decorate 66(i) Location 0 Name 71 "GS_OUT"
Name 73 "ts"
Decorate 40(ts_pos) BuiltIn Position
Decorate 49(i_pos) BuiltIn Position
Decorate 70(i) Location 0
Decorate 73(ts) Location 0
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
...@@ -230,37 +245,44 @@ output primitive = triangle_strip ...@@ -230,37 +245,44 @@ output primitive = triangle_strip
30: 20(int) Constant 3 30: 20(int) Constant 3
31: TypeBool 31: TypeBool
35: TypePointer Function 7(fvec4) 35: TypePointer Function 7(fvec4)
41: 20(int) Constant 1 39: TypePointer Output 7(fvec4)
44: TypeArray 7(fvec4) 10 40(ts_pos): 39(ptr) Variable Output
45: TypePointer Input 44 44: 20(int) Constant 1
46(i_pos): 45(ptr) Variable Input 47: TypeArray 7(fvec4) 10
47: TypePointer Input 7(fvec4) 48: TypePointer Input 47
54: 20(int) Constant 2 49(i_pos): 48(ptr) Variable Input
63(PS_IN): TypeStruct 50: TypePointer Input 7(fvec4)
64: TypeArray 63(PS_IN) 10 57: 20(int) Constant 2
65: TypePointer Input 64 67(PS_IN): TypeStruct
66(i): 65(ptr) Variable Input 68: TypeArray 67(PS_IN) 10
69: TypePointer Input 68
70(i): 69(ptr) Variable Input
71(GS_OUT): TypeStruct
72: TypePointer Output 71(GS_OUT)
73(ts): 72(ptr) Variable Output
4(main): 2 Function None 3 4(main): 2 Function None 3
5: Label 5: Label
43(i): 12(ptr) Variable Function 46(i): 12(ptr) Variable Function
58(ts): 14(ptr) Variable Function 61(ts): 14(ptr) Variable Function
59(param): 12(ptr) Variable Function 62(param): 12(ptr) Variable Function
61(param): 14(ptr) Variable Function 64(param): 14(ptr) Variable Function
48: 47(ptr) AccessChain 46(i_pos) 23 51: 50(ptr) AccessChain 49(i_pos) 23
49: 7(fvec4) Load 48
50: 35(ptr) AccessChain 43(i) 23 23
Store 50 49
51: 47(ptr) AccessChain 46(i_pos) 41
52: 7(fvec4) Load 51 52: 7(fvec4) Load 51
53: 35(ptr) AccessChain 43(i) 41 23 53: 35(ptr) AccessChain 46(i) 23 23
Store 53 52 Store 53 52
55: 47(ptr) AccessChain 46(i_pos) 54 54: 50(ptr) AccessChain 49(i_pos) 44
56: 7(fvec4) Load 55 55: 7(fvec4) Load 54
57: 35(ptr) AccessChain 43(i) 54 23 56: 35(ptr) AccessChain 46(i) 44 23
Store 57 56 Store 56 55
60: 11 Load 43(i) 58: 50(ptr) AccessChain 49(i_pos) 57
Store 59(param) 60 59: 7(fvec4) Load 58
62: 2 FunctionCall 18(@main(struct-PS_IN-vf41[3];struct-GS_OUT-vf41;) 59(param) 61(param) 60: 35(ptr) AccessChain 46(i) 57 23
Store 60 59
63: 11 Load 46(i)
Store 62(param) 63
65: 2 FunctionCall 18(@main(struct-PS_IN-vf41[3];struct-GS_OUT-vf41;) 62(param) 64(param)
66: 13(GS_OUT) Load 64(param)
Store 61(ts) 66
Return Return
FunctionEnd FunctionEnd
18(@main(struct-PS_IN-vf41[3];struct-GS_OUT-vf41;): 2 Function None 15 18(@main(struct-PS_IN-vf41[3];struct-GS_OUT-vf41;): 2 Function None 15
...@@ -284,14 +306,15 @@ output primitive = triangle_strip ...@@ -284,14 +306,15 @@ output primitive = triangle_strip
37: 7(fvec4) Load 36 37: 7(fvec4) Load 36
38: 35(ptr) AccessChain 33(o) 23 38: 35(ptr) AccessChain 33(o) 23
Store 38 37 Store 38 37
39: 13(GS_OUT) Load 33(o) 41: 35(ptr) AccessChain 33(o) 23
Store 17(ts) 39 42: 7(fvec4) Load 41
Store 40(ts_pos) 42
EmitVertex EmitVertex
Branch 27 Branch 27
27: Label 27: Label
40: 20(int) Load 22(x) 43: 20(int) Load 22(x)
42: 20(int) IAdd 40 41 45: 20(int) IAdd 43 44
Store 22(x) 42 Store 22(x) 45
Branch 24 Branch 24
26: Label 26: Label
Return Return
......
...@@ -219,6 +219,7 @@ enum TBuiltInVariable { ...@@ -219,6 +219,7 @@ enum TBuiltInVariable {
EbvFragDepthGreater, EbvFragDepthGreater,
EbvFragDepthLesser, EbvFragDepthLesser,
EbvStencilRef, EbvStencilRef,
EbvGsOutputStream,
EbvLast EbvLast
}; };
......
...@@ -611,12 +611,15 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList) ...@@ -611,12 +611,15 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList)
qualifier.layoutFormat = type.getQualifier().layoutFormat; qualifier.layoutFormat = type.getQualifier().layoutFormat;
qualifier.precision = type.getQualifier().precision; qualifier.precision = type.getQualifier().precision;
if (type.getQualifier().storage == EvqVaryingOut || if (type.getQualifier().storage == EvqOut ||
type.getQualifier().storage == EvqBuffer) { type.getQualifier().storage == EvqBuffer) {
qualifier.storage = type.getQualifier().storage; qualifier.storage = type.getQualifier().storage;
qualifier.readonly = type.getQualifier().readonly; qualifier.readonly = type.getQualifier().readonly;
} }
if (type.getQualifier().builtIn != EbvNone)
qualifier.builtIn = type.getQualifier().builtIn;
type.getQualifier() = qualifier; type.getQualifier() = qualifier;
} }
...@@ -1035,7 +1038,8 @@ bool HlslGrammar::acceptStreamOutTemplateType(TType& type, TLayoutGeometry& geom ...@@ -1035,7 +1038,8 @@ bool HlslGrammar::acceptStreamOutTemplateType(TType& type, TLayoutGeometry& geom
return false; return false;
} }
type.getQualifier().storage = EvqVaryingOut; type.getQualifier().storage = EvqOut;
type.getQualifier().builtIn = EbvGsOutputStream;
if (! acceptTokenClass(EHTokRightAngle)) { if (! acceptTokenClass(EHTokRightAngle)) {
expected("right angle bracket"); expected("right angle bracket");
......
...@@ -66,7 +66,8 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int ...@@ -66,7 +66,8 @@ HlslParseContext::HlslParseContext(TSymbolTable& symbolTable, TIntermediate& int
nextInLocation(0), nextOutLocation(0), nextInLocation(0), nextOutLocation(0),
sourceEntryPointName(sourceEntryPointName), sourceEntryPointName(sourceEntryPointName),
entryPointFunction(nullptr), entryPointFunction(nullptr),
entryPointFunctionBody(nullptr) entryPointFunctionBody(nullptr),
gsStreamOutput(nullptr)
{ {
globalUniformDefaults.clear(); globalUniformDefaults.clear();
globalUniformDefaults.layoutMatrix = ElmRowMajor; globalUniformDefaults.layoutMatrix = ElmRowMajor;
...@@ -1852,11 +1853,15 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct ...@@ -1852,11 +1853,15 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
TIntermAggregate* synthBody = new TIntermAggregate(); TIntermAggregate* synthBody = new TIntermAggregate();
auto inputIt = inputs.begin(); auto inputIt = inputs.begin();
TIntermTyped* callingArgs = nullptr; TIntermTyped* callingArgs = nullptr;
for (int i = 0; i < userFunction.getParamCount(); i++) { for (int i = 0; i < userFunction.getParamCount(); i++) {
TParameter& param = userFunction[i]; TParameter& param = userFunction[i];
argVars.push_back(makeInternalVariable(*param.name, *param.type)); argVars.push_back(makeInternalVariable(*param.name, *param.type));
argVars.back()->getWritableType().getQualifier().makeTemporary(); argVars.back()->getWritableType().getQualifier().makeTemporary();
TIntermSymbol* arg = intermediate.addSymbol(*argVars.back()); TIntermSymbol* arg = intermediate.addSymbol(*argVars.back());
handleFunctionArgument(&callee, callingArgs, arg); handleFunctionArgument(&callee, callingArgs, arg);
if (param.type->getQualifier().isParamInput()) { if (param.type->getQualifier().isParamInput()) {
intermediate.growAggregate(synthBody, handleAssign(loc, EOpAssign, arg, intermediate.growAggregate(synthBody, handleAssign(loc, EOpAssign, arg,
...@@ -1911,10 +1916,20 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct ...@@ -1911,10 +1916,20 @@ TIntermNode* HlslParseContext::transformEntryPoint(const TSourceLoc& loc, TFunct
auto outputIt = outputs.begin(); auto outputIt = outputs.begin();
for (int i = 0; i < userFunction.getParamCount(); i++) { for (int i = 0; i < userFunction.getParamCount(); i++) {
TParameter& param = userFunction[i]; TParameter& param = userFunction[i];
// GS outputs are via emit, so we do not copy them here.
if (param.type->getQualifier().isParamOutput()) { if (param.type->getQualifier().isParamOutput()) {
intermediate.growAggregate(synthBody, handleAssign(loc, EOpAssign, if (param.declaredBuiltIn == EbvGsOutputStream) {
intermediate.addSymbol(**outputIt), // GS output stream does not assign outputs here: it's the Append() method
intermediate.addSymbol(*argVars[i]))); // which writes to the output, probably multiple times separated by Emit.
// We merely remember the output to use, here.
gsStreamOutput = *outputIt;
} else {
intermediate.growAggregate(synthBody, handleAssign(loc, EOpAssign,
intermediate.addSymbol(**outputIt),
intermediate.addSymbol(*argVars[i])));
}
outputIt++; outputIt++;
} }
} }
...@@ -3301,9 +3316,15 @@ void HlslParseContext::decomposeGeometryMethods(const TSourceLoc& loc, TIntermTy ...@@ -3301,9 +3316,15 @@ void HlslParseContext::decomposeGeometryMethods(const TSourceLoc& loc, TIntermTy
emit->setLoc(loc); emit->setLoc(loc);
emit->setType(TType(EbtVoid)); emit->setType(TType(EbtVoid));
// find the matching output
if (gsStreamOutput == nullptr) {
error(loc, "unable to find output symbol for Append()", "", "");
return;
}
sequence = intermediate.growAggregate(sequence, sequence = intermediate.growAggregate(sequence,
handleAssign(loc, EOpAssign, handleAssign(loc, EOpAssign,
argAggregate->getSequence()[0]->getAsTyped(), intermediate.addSymbol(*gsStreamOutput, loc),
argAggregate->getSequence()[1]->getAsTyped()), argAggregate->getSequence()[1]->getAsTyped()),
loc); loc);
......
...@@ -405,6 +405,8 @@ protected: ...@@ -405,6 +405,8 @@ protected:
TVector<TString> currentTypePrefix; // current scoping prefix for nested structures TVector<TString> currentTypePrefix; // current scoping prefix for nested structures
TVector<TVariable*> implicitThisStack; // currently active 'this' variables for nested structures TVector<TVariable*> implicitThisStack; // currently active 'this' variables for nested structures
TVariable* gsStreamOutput; // geometry shader stream outputs, for emit (Append method)
}; };
// This is the prefix we use for builtin methods to avoid namespace collisions with // This is the prefix we use for builtin methods to avoid namespace collisions with
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment