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
b6cabc4f
Commit
b6cabc4f
authored
May 19, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix C++ portability, non-deterministic order of argument evaluation.
parent
80f92a19
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
20 deletions
+25
-20
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+13
-8
spv.boolInBlock.frag.out
Test/baseResults/spv.boolInBlock.frag.out
+12
-12
No files found.
SPIRV/GlslangToSpv.cpp
View file @
b6cabc4f
...
...
@@ -2590,20 +2590,25 @@ void TGlslangToSpvTraverser::accessChainStore(const glslang::TType& type, spv::I
if
(
builder
.
isScalarType
(
nominalTypeId
))
{
// Conversion for bool
spv
::
Id
boolType
=
builder
.
makeBoolType
();
if
(
nominalTypeId
!=
boolType
)
rvalue
=
builder
.
createTriOp
(
spv
::
OpSelect
,
nominalTypeId
,
rvalue
,
builder
.
makeUintConstant
(
1
),
builder
.
makeUintConstant
(
0
));
else
if
(
builder
.
getTypeId
(
rvalue
)
!=
boolType
)
if
(
nominalTypeId
!=
boolType
)
{
// keep these outside arguments, for determinant order-of-evaluation
spv
::
Id
one
=
builder
.
makeUintConstant
(
1
);
spv
::
Id
zero
=
builder
.
makeUintConstant
(
0
);
rvalue
=
builder
.
createTriOp
(
spv
::
OpSelect
,
nominalTypeId
,
rvalue
,
one
,
zero
);
}
else
if
(
builder
.
getTypeId
(
rvalue
)
!=
boolType
)
rvalue
=
builder
.
createBinOp
(
spv
::
OpINotEqual
,
boolType
,
rvalue
,
builder
.
makeUintConstant
(
0
));
}
else
if
(
builder
.
isVectorType
(
nominalTypeId
))
{
// Conversion for bvec
int
vecSize
=
builder
.
getNumTypeComponents
(
nominalTypeId
);
spv
::
Id
bvecType
=
builder
.
makeVectorType
(
builder
.
makeBoolType
(),
vecSize
);
if
(
nominalTypeId
!=
bvecType
)
if
(
nominalTypeId
!=
bvecType
)
{
// keep these outside arguments, for determinant order-of-evaluation
spv
::
Id
one
=
builder
.
makeUintConstant
(
1
);
spv
::
Id
zero
=
builder
.
makeUintConstant
(
0
);
rvalue
=
builder
.
createTriOp
(
spv
::
OpSelect
,
nominalTypeId
,
rvalue
,
makeSmearedConstant
(
builder
.
makeUintConstant
(
1
)
,
vecSize
),
makeSmearedConstant
(
builder
.
makeUintConstant
(
0
)
,
vecSize
));
else
if
(
builder
.
getTypeId
(
rvalue
)
!=
bvecType
)
makeSmearedConstant
(
one
,
vecSize
),
makeSmearedConstant
(
zero
,
vecSize
));
}
else
if
(
builder
.
getTypeId
(
rvalue
)
!=
bvecType
)
rvalue
=
builder
.
createBinOp
(
spv
::
OpINotEqual
,
bvecType
,
rvalue
,
makeSmearedConstant
(
builder
.
makeUintConstant
(
0
),
vecSize
));
}
...
...
Test/baseResults/spv.boolInBlock.frag.out
View file @
b6cabc4f
...
...
@@ -52,17 +52,17 @@ Warning, version 450 is not yet complete; most version-specific features are pre
28: 27(int) Constant 0
29: 6(bool) ConstantFalse
30: 9(bvec2) ConstantComposite 29 29
31: 22(int) Constant
0
32: 22(int) Constant
1
33: 23(ivec2) ConstantComposite 3
1 31
34: 23(ivec2) ConstantComposite 3
2 32
31: 22(int) Constant
1
32: 22(int) Constant
0
33: 23(ivec2) ConstantComposite 3
2 32
34: 23(ivec2) ConstantComposite 3
1 31
36: TypePointer Uniform 23(ivec2)
38: TypeVector 22(int) 4
39(Uniform): TypeStruct 38(ivec4)
40: TypePointer Uniform 39(Uniform)
41: 40(ptr) Variable Uniform
42: TypePointer Uniform 38(ivec4)
65: 38(ivec4) ConstantComposite 3
1 31 31 31
65: 38(ivec4) ConstantComposite 3
2 32 32 32
72: TypeFloat 32
73: TypeVector 72(float) 4
74: TypePointer Output 73(fvec4)
...
...
@@ -79,14 +79,14 @@ Warning, version 450 is not yet complete; most version-specific features are pre
43: 42(ptr) AccessChain 41 28
44: 38(ivec4) Load 43
45: 22(int) CompositeExtract 44 2
46: 6(bool) INotEqual 45 3
1
46: 6(bool) INotEqual 45 3
2
SelectionMerge 48 None
BranchConditional 46 47 48
47: Label
49: 42(ptr) AccessChain 41 28
50: 38(ivec4) Load 49
51: 22(int) CompositeExtract 50 0
52: 6(bool) INotEqual 51 3
1
52: 6(bool) INotEqual 51 3
2
53: 9(bvec2) CompositeConstruct 52 52
54: 23(ivec2) Select 53 34 33
55: 36(ptr) AccessChain 26 28
...
...
@@ -96,7 +96,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
56: 36(ptr) AccessChain 26 28
57: 23(ivec2) Load 56
58: 22(int) CompositeExtract 57 0
59: 6(bool) INotEqual 58 3
1
59: 6(bool) INotEqual 58 3
2
SelectionMerge 61 None
BranchConditional 59 60 61
60: Label
...
...
@@ -114,14 +114,14 @@ Warning, version 450 is not yet complete; most version-specific features are pre
76: 42(ptr) AccessChain 41 28
77: 38(ivec4) Load 76
78: 22(int) CompositeExtract 77 0
79: 6(bool) INotEqual 78 3
1
79: 6(bool) INotEqual 78 3
2
SelectionMerge 81 None
BranchConditional 79 80 81
80: Label
82: 42(ptr) AccessChain 41 28
83: 38(ivec4) Load 82
84: 22(int) CompositeExtract 83 1
85: 6(bool) INotEqual 84 3
1
85: 6(bool) INotEqual 84 3
2
Branch 81
81: Label
86: 6(bool) Phi 79 61 85 80
...
...
@@ -131,7 +131,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
91: 42(ptr) AccessChain 41 28
92: 38(ivec4) Load 91
93: 22(int) CompositeExtract 92 0
94: 6(bool) INotEqual 93 3
1
94: 6(bool) INotEqual 93 3
2
95: 6(bool) LogicalNot 94
SelectionMerge 97 None
BranchConditional 95 96 97
...
...
@@ -139,7 +139,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
98: 42(ptr) AccessChain 41 28
99: 38(ivec4) Load 98
100: 22(int) CompositeExtract 99 1
101: 6(bool) INotEqual 100 3
1
101: 6(bool) INotEqual 100 3
2
Branch 97
97: Label
102: 6(bool) Phi 94 81 101 96
...
...
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