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
42d00d0c
Commit
42d00d0c
authored
Apr 02, 2018
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nonuniform: Propagate through GLSL expressions.
parent
c873c705
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
167 additions
and
3 deletions
+167
-3
nonuniform.frag.out
Test/baseResults/nonuniform.frag.out
+2
-2
spv.nonuniform.frag.out
Test/baseResults/spv.nonuniform.frag.out
+79
-1
spv.nonuniform.frag
Test/spv.nonuniform.frag
+10
-0
Intermediate.cpp
glslang/MachineIndependent/Intermediate.cpp
+67
-0
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+8
-0
localintermediate.h
glslang/MachineIndependent/localintermediate.h
+1
-0
No files found.
Test/baseResults/nonuniform.frag.out
View file @
42d00d0c
...
@@ -29,7 +29,7 @@ ERROR: node is still EOpNull!
...
@@ -29,7 +29,7 @@ ERROR: node is still EOpNull!
0:20 'nu_li' ( nonuniform temp int)
0:20 'nu_li' ( nonuniform temp int)
0:23 move second child to first child ( temp int)
0:23 move second child to first child ( temp int)
0:23 'nu_li' ( nonuniform temp int)
0:23 'nu_li' ( nonuniform temp int)
0:23 add ( temp int)
0:23 add (
nonuniform
temp int)
0:23 'a' ( nonuniform temp int)
0:23 'a' ( nonuniform temp int)
0:23 component-wise multiply ( nonuniform temp int)
0:23 component-wise multiply ( nonuniform temp int)
0:23 'a' ( temp int)
0:23 'a' ( temp int)
...
@@ -68,7 +68,7 @@ ERROR: node is still EOpNull!
...
@@ -68,7 +68,7 @@ ERROR: node is still EOpNull!
0:20 'nu_li' ( nonuniform temp int)
0:20 'nu_li' ( nonuniform temp int)
0:23 move second child to first child ( temp int)
0:23 move second child to first child ( temp int)
0:23 'nu_li' ( nonuniform temp int)
0:23 'nu_li' ( nonuniform temp int)
0:23 add ( temp int)
0:23 add (
nonuniform
temp int)
0:23 'a' ( nonuniform temp int)
0:23 'a' ( nonuniform temp int)
0:23 component-wise multiply ( nonuniform temp int)
0:23 component-wise multiply ( nonuniform temp int)
0:23 'a' ( temp int)
0:23 'a' ( temp int)
...
...
Test/baseResults/spv.nonuniform.frag.out
View file @
42d00d0c
spv.nonuniform.frag
spv.nonuniform.frag
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80006
// Generated by (magic number): 80006
// Id's are bound by
166
// Id's are bound by
210
Capability Shader
Capability Shader
Capability InputAttachment
Capability InputAttachment
...
@@ -53,15 +53,24 @@ spv.nonuniform.frag
...
@@ -53,15 +53,24 @@ spv.nonuniform.frag
Name 137 "inputAttachment"
Name 137 "inputAttachment"
Name 147 "uniformTexelBuffer"
Name 147 "uniformTexelBuffer"
Name 158 "storageTexelBuffer"
Name 158 "storageTexelBuffer"
Name 168 "v"
Name 183 "uv"
Name 193 "m"
Name 201 "S"
MemberName 201(S) 0 "a"
Name 203 "s"
Decorate 13 DecorationNonUniformEXT
Decorate 13 DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 17(nu_li) DecorationNonUniformEXT
Decorate 19 DecorationNonUniformEXT
Decorate 19 DecorationNonUniformEXT
Decorate 23 DecorationNonUniformEXT
Decorate 23 DecorationNonUniformEXT
Decorate 26 DecorationNonUniformEXT
Decorate 26 DecorationNonUniformEXT
Decorate 27 DecorationNonUniformEXT
Decorate 33(nu_inv4) Location 0
Decorate 33(nu_inv4) Location 0
Decorate 33(nu_inv4) DecorationNonUniformEXT
Decorate 33(nu_inv4) DecorationNonUniformEXT
Decorate 38 DecorationNonUniformEXT
Decorate 39(nu_gf) DecorationNonUniformEXT
Decorate 39(nu_gf) DecorationNonUniformEXT
Decorate 40 DecorationNonUniformEXT
Decorate 40 DecorationNonUniformEXT
Decorate 41 DecorationNonUniformEXT
Decorate 45(inputAttachmentDyn) DescriptorSet 0
Decorate 45(inputAttachmentDyn) DescriptorSet 0
Decorate 45(inputAttachmentDyn) Binding 0
Decorate 45(inputAttachmentDyn) Binding 0
Decorate 45(inputAttachmentDyn) InputAttachmentIndex 0
Decorate 45(inputAttachmentDyn) InputAttachmentIndex 0
...
@@ -77,27 +86,47 @@ spv.nonuniform.frag
...
@@ -77,27 +86,47 @@ spv.nonuniform.frag
Decorate 90(nu_ii) Location 1
Decorate 90(nu_ii) Location 1
Decorate 90(nu_ii) DecorationNonUniformEXT
Decorate 90(nu_ii) DecorationNonUniformEXT
Decorate 91 DecorationNonUniformEXT
Decorate 91 DecorationNonUniformEXT
Decorate 94 DecorationNonUniformEXT
MemberDecorate 97(bname) 0 Offset 0
MemberDecorate 97(bname) 0 Offset 0
Decorate 97(bname) BufferBlock
Decorate 97(bname) BufferBlock
Decorate 100(storageBuffer) DescriptorSet 0
Decorate 100(storageBuffer) DescriptorSet 0
Decorate 100(storageBuffer) Binding 4
Decorate 100(storageBuffer) Binding 4
Decorate 101 DecorationNonUniformEXT
Decorate 101 DecorationNonUniformEXT
Decorate 103 DecorationNonUniformEXT
Decorate 111(sampledImage) DescriptorSet 0
Decorate 111(sampledImage) DescriptorSet 0
Decorate 111(sampledImage) Binding 5
Decorate 111(sampledImage) Binding 5
Decorate 112 DecorationNonUniformEXT
Decorate 112 DecorationNonUniformEXT
Decorate 115 DecorationNonUniformEXT
Decorate 125(storageImage) DescriptorSet 0
Decorate 125(storageImage) DescriptorSet 0
Decorate 125(storageImage) Binding 6
Decorate 125(storageImage) Binding 6
Decorate 126 DecorationNonUniformEXT
Decorate 126 DecorationNonUniformEXT
Decorate 129 DecorationNonUniformEXT
Decorate 137(inputAttachment) DescriptorSet 0
Decorate 137(inputAttachment) DescriptorSet 0
Decorate 137(inputAttachment) Binding 7
Decorate 137(inputAttachment) Binding 7
Decorate 137(inputAttachment) InputAttachmentIndex 1
Decorate 137(inputAttachment) InputAttachmentIndex 1
Decorate 138 DecorationNonUniformEXT
Decorate 138 DecorationNonUniformEXT
Decorate 140 DecorationNonUniformEXT
Decorate 147(uniformTexelBuffer) DescriptorSet 0
Decorate 147(uniformTexelBuffer) DescriptorSet 0
Decorate 147(uniformTexelBuffer) Binding 8
Decorate 147(uniformTexelBuffer) Binding 8
Decorate 148 DecorationNonUniformEXT
Decorate 148 DecorationNonUniformEXT
Decorate 150 DecorationNonUniformEXT
Decorate 158(storageTexelBuffer) DescriptorSet 0
Decorate 158(storageTexelBuffer) DescriptorSet 0
Decorate 158(storageTexelBuffer) Binding 9
Decorate 158(storageTexelBuffer) Binding 9
Decorate 159 DecorationNonUniformEXT
Decorate 159 DecorationNonUniformEXT
Decorate 161 DecorationNonUniformEXT
Decorate 168(v) DecorationNonUniformEXT
Decorate 171 DecorationNonUniformEXT
Decorate 173 DecorationNonUniformEXT
Decorate 178 DecorationNonUniformEXT
Decorate 180 DecorationNonUniformEXT
Decorate 184 DecorationNonUniformEXT
Decorate 186 DecorationNonUniformEXT
Decorate 188 DecorationNonUniformEXT
Decorate 193(m) DecorationNonUniformEXT
Decorate 195 DecorationNonUniformEXT
Decorate 203(s) DecorationNonUniformEXT
Decorate 205 DecorationNonUniformEXT
Decorate 207 DecorationNonUniformEXT
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeInt 32 1
6: TypeInt 32 1
...
@@ -167,6 +196,14 @@ spv.nonuniform.frag
...
@@ -167,6 +196,14 @@ spv.nonuniform.frag
156: TypeRuntimeArray 73
156: TypeRuntimeArray 73
157: TypePointer UniformConstant 156
157: TypePointer UniformConstant 156
158(storageTexelBuffer): 157(ptr) Variable UniformConstant
158(storageTexelBuffer): 157(ptr) Variable UniformConstant
166: TypeVector 6(int) 4
167: TypePointer Function 166(ivec4)
169: 34(int) Constant 1
176: 34(int) Constant 2
191: TypeMatrix 31(fvec4) 4
192: TypePointer Function 191
201(S): TypeStruct 6(int)
202: TypePointer Function 201(S)
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
16(a): 7(ptr) Variable Function
16(a): 7(ptr) Variable Function
...
@@ -176,6 +213,10 @@ spv.nonuniform.frag
...
@@ -176,6 +213,10 @@ spv.nonuniform.frag
30(b): 29(ptr) Variable Function
30(b): 29(ptr) Variable Function
39(nu_gf): 29(ptr) Variable Function
39(nu_gf): 29(ptr) Variable Function
46(dyn_i): 7(ptr) Variable Function
46(dyn_i): 7(ptr) Variable Function
168(v): 167(ptr) Variable Function
183(uv): 167(ptr) Variable Function
193(m): 192(ptr) Variable Function
203(s): 202(ptr) Variable Function
19: 6(int) Load 17(nu_li)
19: 6(int) Load 17(nu_li)
Store 18(param) 19
Store 18(param) 19
21: 6(int) FunctionCall 11(foo(i1;i1;) 18(param) 20(param)
21: 6(int) FunctionCall 11(foo(i1;i1;) 18(param) 20(param)
...
@@ -269,6 +310,43 @@ spv.nonuniform.frag
...
@@ -269,6 +310,43 @@ spv.nonuniform.frag
164: 28(float) Load 30(b)
164: 28(float) Load 30(b)
165: 28(float) FAdd 164 163
165: 28(float) FAdd 164 163
Store 30(b) 165
Store 30(b) 165
170: 7(ptr) AccessChain 168(v) 169
171: 6(int) Load 170
172: 92(ptr) AccessChain 88(uniformBuffer) 171 51
173: 28(float) Load 172
174: 28(float) Load 30(b)
175: 28(float) FAdd 174 173
Store 30(b) 175
177: 7(ptr) AccessChain 168(v) 176
178: 6(int) Load 177
179: 92(ptr) AccessChain 88(uniformBuffer) 178 51
180: 28(float) Load 179
181: 28(float) Load 30(b)
182: 28(float) FAdd 181 180
Store 30(b) 182
184: 6(int) Load 90(nu_ii)
185: 7(ptr) AccessChain 183(uv) 184
186: 6(int) Load 185
187: 92(ptr) AccessChain 88(uniformBuffer) 186 51
188: 28(float) Load 187
189: 28(float) Load 30(b)
190: 28(float) FAdd 189 188
Store 30(b) 190
194: 29(ptr) AccessChain 193(m) 25 176
195: 28(float) Load 194
196: 6(int) ConvertFToS 195
197: 92(ptr) AccessChain 88(uniformBuffer) 196 51
198: 28(float) Load 197
199: 28(float) Load 30(b)
200: 28(float) FAdd 199 198
Store 30(b) 200
204: 7(ptr) AccessChain 203(s) 51
205: 6(int) Load 204
206: 92(ptr) AccessChain 88(uniformBuffer) 205 51
207: 28(float) Load 206
208: 28(float) Load 30(b)
209: 28(float) FAdd 208 207
Store 30(b) 209
Return
Return
FunctionEnd
FunctionEnd
11(foo(i1;i1;): 6(int) Function None 8
11(foo(i1;i1;): 6(int) Function None 8
...
...
Test/spv.nonuniform.frag
View file @
42d00d0c
...
@@ -42,4 +42,14 @@ void main()
...
@@ -42,4 +42,14 @@ void main()
b
+=
subpassLoad
(
inputAttachment
[
nu_ii
]).
x
;
b
+=
subpassLoad
(
inputAttachment
[
nu_ii
]).
x
;
b
+=
texelFetch
(
uniformTexelBuffer
[
nu_ii
],
1
).
x
;
b
+=
texelFetch
(
uniformTexelBuffer
[
nu_ii
],
1
).
x
;
b
+=
imageLoad
(
storageTexelBuffer
[
nu_ii
],
1
).
x
;
b
+=
imageLoad
(
storageTexelBuffer
[
nu_ii
],
1
).
x
;
nonuniformEXT
ivec4
v
;
nonuniformEXT
mat4
m
;
nonuniformEXT
struct
S
{
int
a
;
}
s
;
ivec4
uv
;
b
+=
uniformBuffer
[
v
.
y
].
a
;
b
+=
uniformBuffer
[
v
[
2
]].
a
;
b
+=
uniformBuffer
[
uv
[
nu_ii
]].
a
;
b
+=
uniformBuffer
[
int
(
m
[
2
].
z
)].
a
;
b
+=
uniformBuffer
[
s
.
a
].
a
;
}
}
glslang/MachineIndependent/Intermediate.cpp
View file @
42d00d0c
...
@@ -158,6 +158,11 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
...
@@ -158,6 +158,11 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
if
(
specConstantPropagates
(
*
node
->
getLeft
(),
*
node
->
getRight
())
&&
isSpecializationOperation
(
*
node
))
if
(
specConstantPropagates
(
*
node
->
getLeft
(),
*
node
->
getRight
())
&&
isSpecializationOperation
(
*
node
))
node
->
getWritableType
().
getQualifier
().
makeSpecConstant
();
node
->
getWritableType
().
getQualifier
().
makeSpecConstant
();
// If must propagate nonuniform, make a nonuniform.
if
((
node
->
getLeft
()
->
getQualifier
().
nonUniform
||
node
->
getRight
()
->
getQualifier
().
nonUniform
)
&&
isNonuniformPropagating
(
node
->
getOp
()))
node
->
getWritableType
().
getQualifier
().
nonUniform
=
true
;
return
node
;
return
node
;
}
}
...
@@ -366,6 +371,10 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
...
@@ -366,6 +371,10 @@ TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, TSo
if
(
node
->
getOperand
()
->
getType
().
getQualifier
().
isSpecConstant
()
&&
isSpecializationOperation
(
*
node
))
if
(
node
->
getOperand
()
->
getType
().
getQualifier
().
isSpecConstant
()
&&
isSpecializationOperation
(
*
node
))
node
->
getWritableType
().
getQualifier
().
makeSpecConstant
();
node
->
getWritableType
().
getQualifier
().
makeSpecConstant
();
// If must propagate nonuniform, make a nonuniform.
if
(
node
->
getOperand
()
->
getQualifier
().
nonUniform
&&
isNonuniformPropagating
(
node
->
getOp
()))
node
->
getWritableType
().
getQualifier
().
nonUniform
=
true
;
return
node
;
return
node
;
}
}
...
@@ -2803,6 +2812,64 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
...
@@ -2803,6 +2812,64 @@ bool TIntermediate::isSpecializationOperation(const TIntermOperator& node) const
}
}
}
}
// Is the operation one that must propagate nonuniform?
bool
TIntermediate
::
isNonuniformPropagating
(
TOperator
op
)
const
{
// "* All Operators in Section 5.1 (Operators), except for assignment,
// arithmetic assignment, and sequence
// * Component selection in Section 5.5
// * Matrix components in Section 5.6
// * Structure and Array Operations in Section 5.7, except for the length
// method."
switch
(
op
)
{
case
EOpPostIncrement
:
case
EOpPostDecrement
:
case
EOpPreIncrement
:
case
EOpPreDecrement
:
case
EOpNegative
:
case
EOpLogicalNot
:
case
EOpVectorLogicalNot
:
case
EOpBitwiseNot
:
case
EOpAdd
:
case
EOpSub
:
case
EOpMul
:
case
EOpDiv
:
case
EOpMod
:
case
EOpRightShift
:
case
EOpLeftShift
:
case
EOpAnd
:
case
EOpInclusiveOr
:
case
EOpExclusiveOr
:
case
EOpEqual
:
case
EOpNotEqual
:
case
EOpLessThan
:
case
EOpGreaterThan
:
case
EOpLessThanEqual
:
case
EOpGreaterThanEqual
:
case
EOpVectorTimesScalar
:
case
EOpVectorTimesMatrix
:
case
EOpMatrixTimesVector
:
case
EOpMatrixTimesScalar
:
case
EOpLogicalOr
:
case
EOpLogicalXor
:
case
EOpLogicalAnd
:
case
EOpIndexDirect
:
case
EOpIndexIndirect
:
case
EOpIndexDirectStruct
:
case
EOpVectorSwizzle
:
return
true
;
default
:
break
;
}
return
false
;
}
////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////
//
//
// Member functions of the nodes used for building the tree.
// Member functions of the nodes used for building the tree.
...
...
glslang/MachineIndependent/ParseHelper.cpp
View file @
42d00d0c
...
@@ -443,6 +443,10 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
...
@@ -443,6 +443,10 @@ TIntermTyped* TParseContext::handleBracketDereference(const TSourceLoc& loc, TIn
}
}
result
->
setType
(
newType
);
result
->
setType
(
newType
);
// Propagate nonuniform
if
(
base
->
getQualifier
().
isNonUniform
()
||
index
->
getQualifier
().
isNonUniform
())
result
->
getWritableType
().
getQualifier
().
nonUniform
=
true
;
if
(
anyIndexLimits
)
if
(
anyIndexLimits
)
handleIndexLimits
(
loc
,
base
,
index
);
handleIndexLimits
(
loc
,
base
,
index
);
}
}
...
@@ -751,6 +755,10 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
...
@@ -751,6 +755,10 @@ TIntermTyped* TParseContext::handleDotDereference(const TSourceLoc& loc, TInterm
if
(
base
->
getQualifier
().
noContraction
)
if
(
base
->
getQualifier
().
noContraction
)
result
->
getWritableType
().
getQualifier
().
noContraction
=
true
;
result
->
getWritableType
().
getQualifier
().
noContraction
=
true
;
// Propagate nonuniform
if
(
base
->
getQualifier
().
isNonUniform
())
result
->
getWritableType
().
getQualifier
().
nonUniform
=
true
;
return
result
;
return
result
;
}
}
...
...
glslang/MachineIndependent/localintermediate.h
View file @
42d00d0c
...
@@ -651,6 +651,7 @@ protected:
...
@@ -651,6 +651,7 @@ protected:
TIntermSequence
&
findLinkerObjects
()
const
;
TIntermSequence
&
findLinkerObjects
()
const
;
bool
userOutputUsed
()
const
;
bool
userOutputUsed
()
const
;
bool
isSpecializationOperation
(
const
TIntermOperator
&
)
const
;
bool
isSpecializationOperation
(
const
TIntermOperator
&
)
const
;
bool
isNonuniformPropagating
(
TOperator
)
const
;
bool
promoteUnary
(
TIntermUnary
&
);
bool
promoteUnary
(
TIntermUnary
&
);
bool
promoteBinary
(
TIntermBinary
&
);
bool
promoteBinary
(
TIntermBinary
&
);
void
addSymbolLinkageNode
(
TIntermAggregate
*&
linkage
,
TSymbolTable
&
,
const
TString
&
);
void
addSymbolLinkageNode
(
TIntermAggregate
*&
linkage
,
TSymbolTable
&
,
const
TString
&
);
...
...
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