Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
glslang
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
glslang
Commits
396de16c
Unverified
Commit
396de16c
authored
Dec 14, 2017
by
John Kessenich
Committed by
GitHub
Dec 14, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1183 from LoopDawg/builtin-output-array-indirect
HLSL: for split output structs, propagate indirection to builtins.
parents
69feabc9
0cff5100
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
91 additions
and
84 deletions
+91
-84
hlsl.hull.4.tesc.out
Test/baseResults/hlsl.hull.4.tesc.out
+70
-71
hlsl.hull.5.tesc.out
Test/baseResults/hlsl.hull.5.tesc.out
+4
-6
hlslParseHelper.cpp
hlsl/hlslParseHelper.cpp
+17
-7
No files found.
Test/baseResults/hlsl.hull.4.tesc.out
View file @
396de16c
...
...
@@ -159,10 +159,9 @@ triangle order = cw
0:? 'cpid' ( in uint InvocationID)
0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float)
0:39 direct index ( out 4-component vector of float Position)
0:39
in
direct index ( out 4-component vector of float Position)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 0 (const int)
0:? 'cpid' ( in uint InvocationID)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 Function Call: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
...
...
@@ -400,10 +399,9 @@ triangle order = cw
0:? 'cpid' ( in uint InvocationID)
0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float)
0:39 direct index ( out 4-component vector of float Position)
0:39
in
direct index ( out 4-component vector of float Position)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 0 (const int)
0:? 'cpid' ( in uint InvocationID)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 Function Call: @main(struct-HS_Input-vf4-vf41[3];u1; ( temp structure{ temp 4-component vector of float m_Position})
0:? 'I' ( temp 3-element array of structure{ temp 4-component vector of float m_Position, temp 4-component vector of float m_Normal})
...
...
@@ -479,12 +477,12 @@ triangle order = cw
// Module Version 10000
// Generated by (magic number): 80002
// Id's are bound by 12
7
// Id's are bound by 12
8
Capability Tessellation
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint TessellationControl 4 "main" 56 64 83 86 11
0 123
EntryPoint TessellationControl 4 "main" 56 64 83 86 11
1 124
ExecutionMode 4 OutputVertices 3
ExecutionMode 4 Triangles
ExecutionMode 4 SpacingFractionalOdd
...
...
@@ -514,20 +512,20 @@ triangle order = cw
Name 81 "cpid"
Name 83 "cpid"
Name 86 "@entryPointOutput.m_Position"
Name 8
7
"param"
Name
89
"param"
Name 10
3
"@patchConstantResult"
Name 10
4
"param"
Name 11
0
"@patchConstantOutput.fTessFactor"
Name 12
3
"@patchConstantOutput.fInsideTessFactor"
Name 8
8
"param"
Name
90
"param"
Name 10
4
"@patchConstantResult"
Name 10
5
"param"
Name 11
1
"@patchConstantOutput.fTessFactor"
Name 12
4
"@patchConstantOutput.fInsideTessFactor"
Decorate 56(I.m_Position) BuiltIn Position
Decorate 64(I) Location 0
Decorate 83(cpid) BuiltIn InvocationId
Decorate 86(@entryPointOutput.m_Position) BuiltIn Position
Decorate 11
0
(@patchConstantOutput.fTessFactor) Patch
Decorate 11
0
(@patchConstantOutput.fTessFactor) BuiltIn TessLevelOuter
Decorate 12
3
(@patchConstantOutput.fInsideTessFactor) Patch
Decorate 12
3
(@patchConstantOutput.fInsideTessFactor) BuiltIn TessLevelInner
Decorate 11
1
(@patchConstantOutput.fTessFactor) Patch
Decorate 11
1
(@patchConstantOutput.fTessFactor) BuiltIn TessLevelOuter
Decorate 12
4
(@patchConstantOutput.fInsideTessFactor) Patch
Decorate 12
4
(@patchConstantOutput.fInsideTessFactor) BuiltIn TessLevelInner
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
...
...
@@ -568,27 +566,27 @@ triangle order = cw
83(cpid): 82(ptr) Variable Input
85: TypePointer Output 54
86(@entryPointOutput.m_Position): 85(ptr) Variable Output
9
3
: TypePointer Output 7(fvec4)
9
5
: 9(int) Constant 2
9
6
: 9(int) Constant 1
9
7
: 9(int) Constant 0
99
: TypeBool
10
7
: 9(int) Constant 4
10
8: TypeArray 6(float) 107
1
09: TypePointer Output 108
11
0(@patchConstantOutput.fTessFactor): 109
(ptr) Variable Output
11
3
: TypePointer Output 6(float)
12
1: TypeArray 6(float) 95
12
2: TypePointer Output 121
12
3(@patchConstantOutput.fInsideTessFactor): 122
(ptr) Variable Output
9
4
: TypePointer Output 7(fvec4)
9
6
: 9(int) Constant 2
9
7
: 9(int) Constant 1
9
8
: 9(int) Constant 0
100
: TypeBool
10
8
: 9(int) Constant 4
10
9: TypeArray 6(float) 108
1
10: TypePointer Output 109
11
1(@patchConstantOutput.fTessFactor): 110
(ptr) Variable Output
11
4
: TypePointer Output 6(float)
12
2: TypeArray 6(float) 96
12
3: TypePointer Output 122
12
4(@patchConstantOutput.fInsideTessFactor): 123
(ptr) Variable Output
4(main): 2 Function None 3
5: Label
53(I): 12(ptr) Variable Function
81(cpid): 19(ptr) Variable Function
8
7
(param): 12(ptr) Variable Function
89
(param): 19(ptr) Variable Function
10
3
(@patchConstantResult): 26(ptr) Variable Function
10
4
(param): 12(ptr) Variable Function
8
8
(param): 12(ptr) Variable Function
90
(param): 19(ptr) Variable Function
10
4
(@patchConstantResult): 26(ptr) Variable Function
10
5
(param): 12(ptr) Variable Function
58: 57(ptr) AccessChain 56(I.m_Position) 33
59: 7(fvec4) Load 58
60: 48(ptr) AccessChain 53(I) 33 33
...
...
@@ -615,42 +613,43 @@ triangle order = cw
Store 80 79
84: 9(int) Load 83(cpid)
Store 81(cpid) 84
88: 11 Load 53(I)
Store 87(param) 88
90: 9(int) Load 81(cpid)
Store 89(param) 90
91:20(HS_Main_Output) FunctionCall 24(@main(struct-HS_Input-vf4-vf41[3];u1;) 87(param) 89(param)
92: 7(fvec4) CompositeExtract 91 0
94: 93(ptr) AccessChain 86(@entryPointOutput.m_Position) 33
Store 94 92
ControlBarrier 95 96 97
98: 9(int) Load 83(cpid)
100: 99(bool) IEqual 98 33
SelectionMerge 102 None
BranchConditional 100 101 102
101: Label
105: 11 Load 53(I)
Store 104(param) 105
106:14(HS_Output) FunctionCall 17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];) 104(param)
Store 103(@patchConstantResult) 106
111: 34(ptr) AccessChain 103(@patchConstantResult) 33 33
112: 6(float) Load 111
114: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 33
Store 114 112
115: 34(ptr) AccessChain 103(@patchConstantResult) 33 32
116: 6(float) Load 115
117: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 32
Store 117 116
118: 34(ptr) AccessChain 103(@patchConstantResult) 33 74
119: 6(float) Load 118
120: 113(ptr) AccessChain 110(@patchConstantOutput.fTessFactor) 74
Store 120 119
124: 34(ptr) AccessChain 103(@patchConstantResult) 32
125: 6(float) Load 124
126: 113(ptr) AccessChain 123(@patchConstantOutput.fInsideTessFactor) 33
Store 126 125
Branch 102
102: Label
87: 9(int) Load 83(cpid)
89: 11 Load 53(I)
Store 88(param) 89
91: 9(int) Load 81(cpid)
Store 90(param) 91
92:20(HS_Main_Output) FunctionCall 24(@main(struct-HS_Input-vf4-vf41[3];u1;) 88(param) 90(param)
93: 7(fvec4) CompositeExtract 92 0
95: 94(ptr) AccessChain 86(@entryPointOutput.m_Position) 87
Store 95 93
ControlBarrier 96 97 98
99: 9(int) Load 83(cpid)
101: 100(bool) IEqual 99 33
SelectionMerge 103 None
BranchConditional 101 102 103
102: Label
106: 11 Load 53(I)
Store 105(param) 106
107:14(HS_Output) FunctionCall 17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];) 105(param)
Store 104(@patchConstantResult) 107
112: 34(ptr) AccessChain 104(@patchConstantResult) 33 33
113: 6(float) Load 112
115: 114(ptr) AccessChain 111(@patchConstantOutput.fTessFactor) 33
Store 115 113
116: 34(ptr) AccessChain 104(@patchConstantResult) 33 32
117: 6(float) Load 116
118: 114(ptr) AccessChain 111(@patchConstantOutput.fTessFactor) 32
Store 118 117
119: 34(ptr) AccessChain 104(@patchConstantResult) 33 74
120: 6(float) Load 119
121: 114(ptr) AccessChain 111(@patchConstantOutput.fTessFactor) 74
Store 121 120
125: 34(ptr) AccessChain 104(@patchConstantResult) 32
126: 6(float) Load 125
127: 114(ptr) AccessChain 124(@patchConstantOutput.fInsideTessFactor) 33
Store 127 126
Branch 103
103: Label
Return
FunctionEnd
17(HS_ConstFunc(struct-HS_Input-vf4-vf41[3];):14(HS_Output) Function None 15
...
...
Test/baseResults/hlsl.hull.5.tesc.out
View file @
396de16c
...
...
@@ -80,10 +80,9 @@ ERROR: node is still EOpNull!
0:? 'cpid' ( in uint InvocationID)
0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float)
0:39 direct index ( out 4-component vector of float Position)
0:39
in
direct index ( out 4-component vector of float Position)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 0 (const int)
0:? 'cpid' ( in uint InvocationID)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
0:? 'cpid' ( temp uint)
...
...
@@ -174,10 +173,9 @@ ERROR: node is still EOpNull!
0:? 'cpid' ( in uint InvocationID)
0:39 Sequence
0:39 move second child to first child ( temp 4-component vector of float)
0:39 direct index ( out 4-component vector of float Position)
0:39
in
direct index ( out 4-component vector of float Position)
0:? '@entryPointOutput.m_Position' ( out 3-element array of 4-component vector of float Position)
0:39 Constant:
0:39 0 (const int)
0:? 'cpid' ( in uint InvocationID)
0:39 m_Position: direct index for structure ( temp 4-component vector of float)
0:39 Function Call: @main(u1; ( temp structure{ temp 4-component vector of float m_Position})
0:? 'cpid' ( temp uint)
...
...
hlsl/hlslParseHelper.cpp
View file @
396de16c
...
...
@@ -2731,13 +2731,23 @@ TIntermTyped* HlslParseContext::handleAssign(const TSourceLoc& loc, TOperator op
// copy from interstage IO built-in if needed
subTree
=
intermediate
.
addSymbol
(
*
builtInVar
);
// Arrayness of builtIn symbols isn't handled by the normal recursion:
// it's been extracted and moved to the built-in.
if
(
subTree
->
getType
().
isArray
()
&&
!
arrayElement
.
empty
())
{
const
TType
splitDerefType
(
subTree
->
getType
(),
arrayElement
.
back
());
subTree
=
intermediate
.
addIndex
(
EOpIndexDirect
,
subTree
,
intermediate
.
addConstantUnion
(
arrayElement
.
back
(),
loc
),
loc
);
subTree
->
setType
(
splitDerefType
);
if
(
subTree
->
getType
().
isArray
())
{
// Arrayness of builtIn symbols isn't handled by the normal recursion:
// it's been extracted and moved to the built-in.
if
(
!
arrayElement
.
empty
())
{
const
TType
splitDerefType
(
subTree
->
getType
(),
arrayElement
.
back
());
subTree
=
intermediate
.
addIndex
(
EOpIndexDirect
,
subTree
,
intermediate
.
addConstantUnion
(
arrayElement
.
back
(),
loc
),
loc
);
subTree
->
setType
(
splitDerefType
);
}
else
if
(
splitNode
->
getAsOperator
()
!=
nullptr
&&
(
splitNode
->
getAsOperator
()
->
getOp
()
==
EOpIndexIndirect
))
{
// This might also be a stage with arrayed outputs, in which case there's an index
// operation we should transfer to the output builtin.
const
TType
splitDerefType
(
subTree
->
getType
(),
0
);
subTree
=
intermediate
.
addIndex
(
splitNode
->
getAsOperator
()
->
getOp
(),
subTree
,
splitNode
->
getAsBinaryNode
()
->
getRight
(),
loc
);
subTree
->
setType
(
splitDerefType
);
}
}
}
else
if
(
flattened
&&
!
shouldFlatten
(
derefType
,
isLeft
?
leftStorage
:
rightStorage
,
false
))
{
if
(
isLeft
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment