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
b4fd8d10
Commit
b4fd8d10
authored
Mar 03, 2016
by
Rex Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Continue to fix the issue of bool -> uint32
For short-circuit operator (&& and ||), the conversion is missing.
parent
2725323b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
4 deletions
+55
-4
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+2
-2
spv.boolInBlock.frag.out
Test/baseResults/spv.boolInBlock.frag.out
+47
-2
spv.boolInBlock.frag
Test/spv.boolInBlock.frag
+6
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
b4fd8d10
...
...
@@ -3876,7 +3876,7 @@ spv::Id TGlslangToSpvTraverser::createShortCircuit(glslang::TOperator op, glslan
// emit left operand
builder
.
clearAccessChain
();
left
.
traverse
(
this
);
spv
::
Id
leftId
=
builder
.
accessChainLoad
(
spv
::
NoPrecision
,
boolTypeId
);
spv
::
Id
leftId
=
accessChainLoad
(
left
.
getType
()
);
// Operands to accumulate OpPhi operands
std
::
vector
<
spv
::
Id
>
phiOperands
;
...
...
@@ -3899,7 +3899,7 @@ spv::Id TGlslangToSpvTraverser::createShortCircuit(glslang::TOperator op, glslan
// emit right operand as the "then" part of the "if"
builder
.
clearAccessChain
();
right
.
traverse
(
this
);
spv
::
Id
rightId
=
builder
.
accessChainLoad
(
spv
::
NoPrecision
,
boolTypeId
);
spv
::
Id
rightId
=
accessChainLoad
(
right
.
getType
()
);
// accumulate left operand's phi information
phiOperands
.
push_back
(
rightId
);
...
...
Test/baseResults/spv.boolInBlock.frag.out
View file @
b4fd8d10
...
...
@@ -7,12 +7,12 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by
72
// Id's are bound by
107
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main"
EntryPoint Fragment 4 "main"
75
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Name 4 "main"
...
...
@@ -28,6 +28,7 @@ Linked fragment stage:
Name 41 ""
Name 62 "param"
Name 67 "param"
Name 75 "fragColor"
MemberDecorate 24(Buffer) 0 Offset 0
Decorate 24(Buffer) BufferBlock
Decorate 26 DescriptorSet 0
...
...
@@ -36,6 +37,7 @@ Linked fragment stage:
Decorate 39(Uniform) Block
Decorate 41 DescriptorSet 0
Decorate 41 Binding 0
Decorate 75(fragColor) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeBool
...
...
@@ -65,6 +67,12 @@ Linked fragment stage:
41: 40(ptr) Variable Uniform
42: TypePointer Uniform 38(ivec4)
65: 38(ivec4) ConstantComposite 31 31 31 31
72: TypeFloat 32
73: TypeVector 72(float) 4
74: TypePointer Output 73(fvec4)
75(fragColor): 74(ptr) Variable Output
87: 72(float) Constant 0
88: 72(float) Constant 1065353216
4(main): 2 Function None 3
5: Label
62(param): 8(ptr) Variable Function
...
...
@@ -107,6 +115,43 @@ Linked fragment stage:
Store 71 70
Branch 61
61: Label
76: 42(ptr) AccessChain 41 28
77: 38(ivec4) Load 76
78: 22(int) CompositeExtract 77 0
79: 6(bool) INotEqual 78 31
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 31
Branch 81
81: Label
86: 6(bool) Phi 79 61 85 80
89: 72(float) Select 86 88 87
90: 73(fvec4) CompositeConstruct 89 89 89 89
Store 75(fragColor) 90
91: 42(ptr) AccessChain 41 28
92: 38(ivec4) Load 91
93: 22(int) CompositeExtract 92 0
94: 6(bool) INotEqual 93 31
95: 6(bool) LogicalNot 94
SelectionMerge 97 None
BranchConditional 95 96 97
96: Label
98: 42(ptr) AccessChain 41 28
99: 38(ivec4) Load 98
100: 22(int) CompositeExtract 99 1
101: 6(bool) INotEqual 100 31
Branch 97
97: Label
102: 6(bool) Phi 94 81 101 96
103: 72(float) Select 102 88 87
104: 73(fvec4) CompositeConstruct 103 103 103 103
105: 73(fvec4) Load 75(fragColor)
106: 73(fvec4) FSub 105 104
Store 75(fragColor) 106
Return
FunctionEnd
14(foo(vb4;vb2;): 2 Function None 11
...
...
Test/spv.boolInBlock.frag
View file @
b4fd8d10
...
...
@@ -16,6 +16,8 @@ void foo(bvec4 paramb4, out bvec2 paramb2)
paramb2
=
bvec2
(
b1
);
}
layout
(
location
=
0
)
out
vec4
fragColor
;
void
main
()
{
b2
=
bvec2
(
0
.
0
);
...
...
@@ -23,4 +25,7 @@ void main()
b2
=
bvec2
(
b4
.
x
);
if
(
b2
.
x
)
foo
(
b4
,
b2
);
fragColor
=
vec4
(
b4
.
x
&&
b4
.
y
);
fragColor
-=
vec4
(
b4
.
x
||
b4
.
y
);
}
\ No newline at end of file
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