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
433e9ff8
Commit
433e9ff8
authored
Jan 26, 2017
by
John Kessenich
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SPV: Emit OpSelect when a selection node is simple enough.
Also, ensures it has a type, no disallowed side effects, or performance trade offs.
parent
509177d1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
321 additions
and
322 deletions
+321
-322
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+67
-15
spv.140.frag.out
Test/baseResults/spv.140.frag.out
+137
-148
spv.bool.vert.out
Test/baseResults/spv.bool.vert.out
+27
-38
spv.deepRvalue.frag.out
Test/baseResults/spv.deepRvalue.frag.out
+44
-55
spv.for-complex-condition.vert.out
Test/baseResults/spv.for-complex-condition.vert.out
+30
-40
spv.image.frag.out
Test/baseResults/spv.image.frag.out
+16
-26
No files found.
SPIRV/GlslangToSpv.cpp
View file @
433e9ff8
...
@@ -1748,42 +1748,94 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
...
@@ -1748,42 +1748,94 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
}
}
}
}
// This path handles both if-then-else and ?:
// The if-then-else has a node type of void, while
// ?: has either a void or a non-void node type
//
// Leaving the result, when not void:
// GLSL only has r-values as the result of a :?, but
// if we have an l-value, that can be more efficient if it will
// become the base of a complex r-value expression, because the
// next layer copies r-values into memory to use the access-chain mechanism
bool
TGlslangToSpvTraverser
::
visitSelection
(
glslang
::
TVisit
/* visit */
,
glslang
::
TIntermSelection
*
node
)
bool
TGlslangToSpvTraverser
::
visitSelection
(
glslang
::
TVisit
/* visit */
,
glslang
::
TIntermSelection
*
node
)
{
{
// This path handles both if-then-else and ?:
// See if it simple and safe to generate OpSelect instead of using control flow.
// The if-then-else has a node type of void, while
// Crucially, side effects must be avoided, and there are performance trade-offs.
// ?: has a non-void node type
// Return true if good idea (and safe) for OpSelect, false otherwise.
spv
::
Id
result
=
0
;
const
auto
selectPolicy
=
[
&
]()
->
bool
{
if
(
node
->
getBasicType
()
!=
glslang
::
EbtVoid
)
{
if
(
node
->
getBasicType
()
==
glslang
::
EbtVoid
)
// don't handle this as just on-the-fly temporaries, because there will be two names
return
false
;
// and better to leave SSA to later passes
result
=
builder
.
createVariable
(
spv
::
StorageClassFunction
,
convertGlslangToSpvType
(
node
->
getType
()));
if
(
node
->
getTrueBlock
()
==
nullptr
||
node
->
getFalseBlock
()
==
nullptr
)
return
false
;
assert
(
node
->
getType
()
==
node
->
getTrueBlock
()
->
getAsTyped
()
->
getType
()
&&
node
->
getType
()
==
node
->
getFalseBlock
()
->
getAsTyped
()
->
getType
());
// return true if a single operand to ? : is okay for OpSelect
const
auto
operandOkay
=
[](
glslang
::
TIntermTyped
*
node
)
{
return
node
->
getAsSymbolNode
()
||
node
->
getAsConstantUnion
();
};
return
operandOkay
(
node
->
getTrueBlock
()
->
getAsTyped
())
&&
operandOkay
(
node
->
getFalseBlock
()
->
getAsTyped
());
};
// Emit OpSelect for this selection.
const
auto
handleAsOpSelect
=
[
&
]()
{
node
->
getCondition
()
->
traverse
(
this
);
spv
::
Id
condition
=
accessChainLoad
(
node
->
getCondition
()
->
getType
());
node
->
getTrueBlock
()
->
traverse
(
this
);
spv
::
Id
trueValue
=
accessChainLoad
(
node
->
getTrueBlock
()
->
getAsTyped
()
->
getType
());
node
->
getFalseBlock
()
->
traverse
(
this
);
spv
::
Id
falseValue
=
accessChainLoad
(
node
->
getTrueBlock
()
->
getAsTyped
()
->
getType
());
spv
::
Id
select
=
builder
.
createTriOp
(
spv
::
OpSelect
,
convertGlslangToSpvType
(
node
->
getType
()),
condition
,
trueValue
,
falseValue
);
builder
.
clearAccessChain
();
builder
.
setAccessChainRValue
(
select
);
};
// Try for OpSelect
if
(
selectPolicy
())
{
handleAsOpSelect
();
return
false
;
}
}
// Instead, emit control flow...
// Don't handle results as temporaries, because there will be two names
// and better to leave SSA to later passes.
spv
::
Id
result
=
(
node
->
getBasicType
()
==
glslang
::
EbtVoid
)
?
spv
::
NoResult
:
builder
.
createVariable
(
spv
::
StorageClassFunction
,
convertGlslangToSpvType
(
node
->
getType
()));
// emit the condition before doing anything with selection
// emit the condition before doing anything with selection
node
->
getCondition
()
->
traverse
(
this
);
node
->
getCondition
()
->
traverse
(
this
);
// make an "if" based on the value created by the condition
// make an "if" based on the value created by the condition
spv
::
Builder
::
If
ifBuilder
(
accessChainLoad
(
node
->
getCondition
()
->
getType
()),
builder
);
spv
::
Builder
::
If
ifBuilder
(
accessChainLoad
(
node
->
getCondition
()
->
getType
()),
builder
);
if
(
node
->
getTrueBlock
())
{
// emit the "then" statement
// emit the "then" statement
if
(
node
->
getTrueBlock
()
!=
nullptr
)
{
node
->
getTrueBlock
()
->
traverse
(
this
);
node
->
getTrueBlock
()
->
traverse
(
this
);
if
(
result
)
if
(
result
!=
spv
::
NoResult
)
builder
.
createStore
(
accessChainLoad
(
node
->
getTrueBlock
()
->
getAsTyped
()
->
getType
()),
result
);
builder
.
createStore
(
accessChainLoad
(
node
->
getTrueBlock
()
->
getAsTyped
()
->
getType
()),
result
);
}
}
if
(
node
->
getFalseBlock
())
{
if
(
node
->
getFalseBlock
()
!=
nullptr
)
{
ifBuilder
.
makeBeginElse
();
ifBuilder
.
makeBeginElse
();
// emit the "else" statement
// emit the "else" statement
node
->
getFalseBlock
()
->
traverse
(
this
);
node
->
getFalseBlock
()
->
traverse
(
this
);
if
(
result
)
if
(
result
!=
spv
::
NoResult
)
builder
.
createStore
(
accessChainLoad
(
node
->
getFalseBlock
()
->
getAsTyped
()
->
getType
()),
result
);
builder
.
createStore
(
accessChainLoad
(
node
->
getFalseBlock
()
->
getAsTyped
()
->
getType
()),
result
);
}
}
// finish off the control flow
ifBuilder
.
makeEndIf
();
ifBuilder
.
makeEndIf
();
if
(
result
)
{
if
(
result
!=
spv
::
NoResult
)
{
// GLSL only has r-values as the result of a :?, but
// GLSL only has r-values as the result of a :?, but
// if we have an l-value, that can be more efficient if it will
// if we have an l-value, that can be more efficient if it will
// become the base of a complex r-value expression, because the
// become the base of a complex r-value expression, because the
...
...
Test/baseResults/spv.140.frag.out
View file @
433e9ff8
spv.140.frag
spv.140.frag
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by
101
// Id's are bound by
96
Capability Shader
Capability Shader
Capability ClipDistance
Capability ClipDistance
...
@@ -10,168 +10,157 @@ spv.140.frag
...
@@ -10,168 +10,157 @@ spv.140.frag
Capability ImageQuery
Capability ImageQuery
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 1
6 28 33 43
EntryPoint Fragment 4 "main" 1
4 23 28 38
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 OriginUpperLeft
Source GLSL 140
Source GLSL 140
Name 4 "main"
Name 4 "main"
Name 8 "foo("
Name 8 "foo("
Name 11 "i1"
Name 11 "i1"
Name 1
6
"gl_FrontFacing"
Name 1
4
"gl_FrontFacing"
Name
24
"i2"
Name
19
"i2"
Name 2
8
"o"
Name 2
3
"o"
Name
33
"gl_ClipDistance"
Name
28
"gl_ClipDistance"
Name
43
"k"
Name
38
"k"
Name 5
5
"sampR"
Name 5
0
"sampR"
Name
63
"sampB"
Name
58
"sampB"
Name 8
7
"samp2Da"
Name 8
2
"samp2Da"
Name
92
"bn"
Name
87
"bn"
MemberName
92
(bn) 0 "matra"
MemberName
87
(bn) 0 "matra"
MemberName
92
(bn) 1 "matca"
MemberName
87
(bn) 1 "matca"
MemberName
92
(bn) 2 "matr"
MemberName
87
(bn) 2 "matr"
MemberName
92
(bn) 3 "matc"
MemberName
87
(bn) 3 "matc"
MemberName
92
(bn) 4 "matrdef"
MemberName
87
(bn) 4 "matrdef"
Name
94
""
Name
89
""
Name 9
7
"bi"
Name 9
2
"bi"
MemberName 9
7
(bi) 0 "v"
MemberName 9
2
(bi) 0 "v"
Name
100
"bname"
Name
95
"bname"
Decorate 1
6
(gl_FrontFacing) BuiltIn FrontFacing
Decorate 1
4
(gl_FrontFacing) BuiltIn FrontFacing
Decorate
33
(gl_ClipDistance) BuiltIn ClipDistance
Decorate
28
(gl_ClipDistance) BuiltIn ClipDistance
Decorate 5
5
(sampR) DescriptorSet 0
Decorate 5
0
(sampR) DescriptorSet 0
Decorate
63
(sampB) DescriptorSet 0
Decorate
58
(sampB) DescriptorSet 0
Decorate 8
7
(samp2Da) DescriptorSet 0
Decorate 8
2
(samp2Da) DescriptorSet 0
Decorate
90
ArrayStride 64
Decorate
85
ArrayStride 64
Decorate
91
ArrayStride 64
Decorate
86
ArrayStride 64
MemberDecorate
92
(bn) 0 RowMajor
MemberDecorate
87
(bn) 0 RowMajor
MemberDecorate
92
(bn) 0 Offset 0
MemberDecorate
87
(bn) 0 Offset 0
MemberDecorate
92
(bn) 0 MatrixStride 16
MemberDecorate
87
(bn) 0 MatrixStride 16
MemberDecorate
92
(bn) 1 ColMajor
MemberDecorate
87
(bn) 1 ColMajor
MemberDecorate
92
(bn) 1 Offset 256
MemberDecorate
87
(bn) 1 Offset 256
MemberDecorate
92
(bn) 1 MatrixStride 16
MemberDecorate
87
(bn) 1 MatrixStride 16
MemberDecorate
92
(bn) 2 RowMajor
MemberDecorate
87
(bn) 2 RowMajor
MemberDecorate
92
(bn) 2 Offset 512
MemberDecorate
87
(bn) 2 Offset 512
MemberDecorate
92
(bn) 2 MatrixStride 16
MemberDecorate
87
(bn) 2 MatrixStride 16
MemberDecorate
92
(bn) 3 ColMajor
MemberDecorate
87
(bn) 3 ColMajor
MemberDecorate
92
(bn) 3 Offset 576
MemberDecorate
87
(bn) 3 Offset 576
MemberDecorate
92
(bn) 3 MatrixStride 16
MemberDecorate
87
(bn) 3 MatrixStride 16
MemberDecorate
92
(bn) 4 RowMajor
MemberDecorate
87
(bn) 4 RowMajor
MemberDecorate
92
(bn) 4 Offset 640
MemberDecorate
87
(bn) 4 Offset 640
MemberDecorate
92
(bn) 4 MatrixStride 16
MemberDecorate
87
(bn) 4 MatrixStride 16
Decorate
92
(bn) Block
Decorate
87
(bn) Block
Decorate
94
DescriptorSet 0
Decorate
89
DescriptorSet 0
Decorate 9
6
ArrayStride 16
Decorate 9
1
ArrayStride 16
MemberDecorate 9
7
(bi) 0 Offset 0
MemberDecorate 9
2
(bi) 0 Offset 0
Decorate 9
7
(bi) Block
Decorate 9
2
(bi) Block
Decorate
100
(bname) DescriptorSet 0
Decorate
95
(bname) DescriptorSet 0
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeFloat 32
6: TypeFloat 32
7: TypeFunction 6(float)
7: TypeFunction 6(float)
10: TypePointer Private 6(float)
10: TypePointer Private 6(float)
11(i1): 10(ptr) Variable Private
11(i1): 10(ptr) Variable Private
12: TypePointer Function 6(float)
12: TypeBool
14: TypeBool
13: TypePointer Input 12(bool)
15: TypePointer Input 14(bool)
14(gl_FrontFacing): 13(ptr) Variable Input
16(gl_FrontFacing): 15(ptr) Variable Input
16: 6(float) Constant 3221225472
20: 6(float) Constant 3221225472
17: 6(float) Constant 1073741824
22: 6(float) Constant 1073741824
19(i2): 10(ptr) Variable Private
24(i2): 10(ptr) Variable Private
20: 6(float) Constant 1120665600
25: 6(float) Constant 1120665600
21: TypeVector 6(float) 4
26: TypeVector 6(float) 4
22: TypePointer Output 21(fvec4)
27: TypePointer Output 26(fvec4)
23(o): 22(ptr) Variable Output
28(o): 27(ptr) Variable Output
24: TypeInt 32 0
29: TypeInt 32 0
25: 24(int) Constant 5
30: 29(int) Constant 5
26: TypeArray 6(float) 25
31: TypeArray 6(float) 30
27: TypePointer Input 26
32: TypePointer Input 31
28(gl_ClipDistance): 27(ptr) Variable Input
33(gl_ClipDistance): 32(ptr) Variable Input
29: TypeInt 32 1
34: TypeInt 32 1
30: 29(int) Constant 2
35: 34(int) Constant 2
31: TypePointer Input 6(float)
36: TypePointer Input 6(float)
34: 24(int) Constant 1
39: 29(int) Constant 1
35: TypePointer Output 6(float)
40: TypePointer Output 6(float)
37: TypePointer Input 21(fvec4)
42: TypePointer Input 26(fvec4)
38(k): 37(ptr) Variable Input
43(k): 42(ptr) Variable Input
40: TypeVector 29(int) 4
45: TypeVector 34(int) 4
45: 24(int) Constant 2
50: 29(int) Constant 2
47: TypeImage 6(float) Rect sampled format:Unknown
52: TypeImage 6(float) Rect sampled format:Unknown
48: TypeSampledImage 47
53: TypeSampledImage 52
49: TypePointer UniformConstant 48
54: TypePointer UniformConstant 53
50(sampR): 49(ptr) Variable UniformConstant
55(sampR): 54(ptr) Variable UniformConstant
53: TypeVector 29(int) 2
58: TypeVector 34(int) 2
55: TypeImage 29(int) Buffer sampled format:Unknown
60: TypeImage 34(int) Buffer sampled format:Unknown
56: TypeSampledImage 55
61: TypeSampledImage 60
57: TypePointer UniformConstant 56
62: TypePointer UniformConstant 61
58(sampB): 57(ptr) Variable UniformConstant
63(sampB): 62(ptr) Variable UniformConstant
64: TypeVector 6(float) 2
69: TypeVector 6(float) 2
67: 6(float) Constant 1120403456
72: 6(float) Constant 1120403456
69: 24(int) Constant 3
74: 29(int) Constant 3
78: TypeImage 6(float) 2D sampled format:Unknown
83: TypeImage 6(float) 2D sampled format:Unknown
79: TypeSampledImage 78
84: TypeSampledImage 83
80: TypeArray 79 69
85: TypeArray 84 74
81: TypePointer UniformConstant 80
86: TypePointer UniformConstant 85
82(samp2Da): 81(ptr) Variable UniformConstant
87(samp2Da): 86(ptr) Variable UniformConstant
83: TypeMatrix 21(fvec4) 4
88: TypeMatrix 26(fvec4) 4
84: 24(int) Constant 4
89: 29(int) Constant 4
85: TypeArray 83 84
90: TypeArray 88 89
86: TypeArray 83 84
91: TypeArray 88 89
87(bn): TypeStruct 85 86 83 83 83
92(bn): TypeStruct 90 91 88 88 88
88: TypePointer Uniform 87(bn)
93: TypePointer Uniform 92(bn)
89: 88(ptr) Variable Uniform
94: 93(ptr) Variable Uniform
90: TypeVector 6(float) 3
95: TypeVector 6(float) 3
91: TypeArray 90(fvec3) 45
96: TypeArray 95(fvec3) 50
92(bi): TypeStruct 91
97(bi): TypeStruct 96
93: TypeArray 92(bi) 84
98: TypeArray 97(bi) 89
94: TypePointer Uniform 93
99: TypePointer Uniform 98
95(bname): 94(ptr) Variable Uniform
100(bname): 99(ptr) Variable Uniform
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
13: 12(ptr) Variable Function
15: 12(bool) Load 14(gl_FrontFacing)
17: 14(bool) Load 16(gl_FrontFacing)
18: 6(float) Select 15 16 17
SelectionMerge 19 None
Store 11(i1) 18
BranchConditional 17 18 21
Store 19(i2) 20
18: Label
32: 31(ptr) AccessChain 28(gl_ClipDistance) 30
Store 13 20
33: 6(float) Load 32
Branch 19
36: 35(ptr) AccessChain 23(o) 34
21: Label
Store 36 33
Store 13 22
39: 21(fvec4) Load 38(k)
Branch 19
41: 40(ivec4) ConvertFToS 39
19: Label
42: 29(int) CompositeExtract 41 0
23: 6(float) Load 13
43: 31(ptr) AccessChain 28(gl_ClipDistance) 42
Store 11(i1) 23
44: 6(float) Load 43
Store 24(i2) 25
46: 35(ptr) AccessChain 23(o) 45
37: 36(ptr) AccessChain 33(gl_ClipDistance) 35
Store 46 44
38: 6(float) Load 37
51: 48 Load 50(sampR)
41: 40(ptr) AccessChain 28(o) 39
52: 47 Image 51
Store 41 38
54: 53(ivec2) ImageQuerySize 52
44: 26(fvec4) Load 43(k)
59: 56 Load 58(sampB)
46: 45(ivec4) ConvertFToS 44
60: 55 Image 59
47: 34(int) CompositeExtract 46 0
61: 29(int) ImageQuerySize 60
48: 36(ptr) AccessChain 33(gl_ClipDistance) 47
62: 53(ivec2) CompositeConstruct 61 61
49: 6(float) Load 48
63: 53(ivec2) IAdd 54 62
51: 40(ptr) AccessChain 28(o) 50
65: 64(fvec2) ConvertSToF 63
Store 51 49
66: 6(float) CompositeExtract 65 0
56: 53 Load 55(sampR)
68: 6(float) FDiv 66 67
57: 52 Image 56
70: 35(ptr) AccessChain 23(o) 69
59: 58(ivec2) ImageQuerySize 57
Store 70 68
64: 61 Load 63(sampB)
71: 6(float) FunctionCall 8(foo()
65: 60 Image 64
72: 35(ptr) AccessChain 23(o) 45
66: 34(int) ImageQuerySize 65
Store 72 71
67: 58(ivec2) CompositeConstruct 66 66
68: 58(ivec2) IAdd 59 67
70: 69(fvec2) ConvertSToF 68
71: 6(float) CompositeExtract 70 0
73: 6(float) FDiv 71 72
75: 40(ptr) AccessChain 28(o) 74
Store 75 73
76: 6(float) FunctionCall 8(foo()
77: 40(ptr) AccessChain 28(o) 50
Store 77 76
Return
Return
FunctionEnd
FunctionEnd
8(foo(): 6(float) Function None 7
8(foo(): 6(float) Function None 7
9: Label
9: Label
7
8
: 6(float) Load 11(i1)
7
3
: 6(float) Load 11(i1)
7
9: 6(float) Load 24
(i2)
7
4: 6(float) Load 19
(i2)
80: 6(float) FAdd 78 79
75: 6(float) FAdd 73 74
ReturnValue
80
ReturnValue
75
FunctionEnd
FunctionEnd
Test/baseResults/spv.bool.vert.out
View file @
433e9ff8
...
@@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by 4
9
// Id's are bound by 4
4
Capability Shader
Capability Shader
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
...
@@ -19,18 +19,18 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -19,18 +19,18 @@ Warning, version 450 is not yet complete; most version-specific features are pre
MemberName 22(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 22(gl_PerVertex) 2 "gl_ClipDistance"
MemberName 22(gl_PerVertex) 3 "gl_CullDistance"
MemberName 22(gl_PerVertex) 3 "gl_CullDistance"
Name 24 ""
Name 24 ""
Name 2
9
"ubname"
Name 2
7
"ubname"
MemberName 2
9
(ubname) 0 "b"
MemberName 2
7
(ubname) 0 "b"
Name
31
"ubinst"
Name
29
"ubinst"
Name 3
2
"param"
Name 3
0
"param"
MemberDecorate 22(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 22(gl_PerVertex) 0 BuiltIn Position
MemberDecorate 22(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 22(gl_PerVertex) 1 BuiltIn PointSize
MemberDecorate 22(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 22(gl_PerVertex) 2 BuiltIn ClipDistance
MemberDecorate 22(gl_PerVertex) 3 BuiltIn CullDistance
MemberDecorate 22(gl_PerVertex) 3 BuiltIn CullDistance
Decorate 22(gl_PerVertex) Block
Decorate 22(gl_PerVertex) Block
MemberDecorate 2
9
(ubname) 0 Offset 0
MemberDecorate 2
7
(ubname) 0 Offset 0
Decorate 2
9
(ubname) Block
Decorate 2
7
(ubname) Block
Decorate
31
(ubinst) DescriptorSet 0
Decorate
29
(ubinst) DescriptorSet 0
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeBool
6: TypeBool
...
@@ -47,38 +47,27 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -47,38 +47,27 @@ Warning, version 450 is not yet complete; most version-specific features are pre
24: 23(ptr) Variable Output
24: 23(ptr) Variable Output
25: TypeInt 32 1
25: TypeInt 32 1
26: 25(int) Constant 0
26: 25(int) Constant 0
27: TypePointer Function 18(fvec4)
27(ubname): TypeStruct 19(int)
29(ubname): TypeStruct 19(int)
28: TypePointer Uniform 27(ubname)
30: TypePointer Uniform 29(ubname)
29(ubinst): 28(ptr) Variable Uniform
31(ubinst): 30(ptr) Variable Uniform
31: TypePointer Uniform 19(int)
33: TypePointer Uniform 19(int)
34: 19(int) Constant 0
36: 19(int) Constant 0
37: 17(float) Constant 0
41: 17(float) Constant 0
38: 18(fvec4) ConstantComposite 37 37 37 37
42: 18(fvec4) ConstantComposite 41 41 41 41
39: 17(float) Constant 1065353216
44: 17(float) Constant 1065353216
40: 18(fvec4) ConstantComposite 39 39 39 39
45: 18(fvec4) ConstantComposite 44 44 44 44
42: TypePointer Output 18(fvec4)
47: TypePointer Output 18(fvec4)
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
28: 27(ptr) Variable Function
30(param): 7(ptr) Variable Function
32(param): 7(ptr) Variable Function
32: 31(ptr) AccessChain 29(ubinst) 26
34: 33(ptr) AccessChain 31(ubinst) 26
33: 19(int) Load 32
35: 19(int) Load 34
35: 6(bool) INotEqual 33 34
37: 6(bool) INotEqual 35 36
Store 30(param) 35
Store 32(param) 37
36: 6(bool) FunctionCall 10(foo(b1;) 30(param)
38: 6(bool) FunctionCall 10(foo(b1;) 32(param)
41: 18(fvec4) Select 36 38 40
SelectionMerge 40 None
43: 42(ptr) AccessChain 24 26
BranchConditional 38 39 43
Store 43 41
39: Label
Store 28 42
Branch 40
43: Label
Store 28 45
Branch 40
40: Label
46: 18(fvec4) Load 28
48: 47(ptr) AccessChain 24 26
Store 48 46
Return
Return
FunctionEnd
FunctionEnd
10(foo(b1;): 6(bool) Function None 8
10(foo(b1;): 6(bool) Function None 8
...
...
Test/baseResults/spv.deepRvalue.frag.out
View file @
433e9ff8
spv.deepRvalue.frag
spv.deepRvalue.frag
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by 15
5
// Id's are bound by 15
0
Capability Shader
Capability Shader
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 14
9
EntryPoint Fragment 4 "main" 14
4
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 OriginUpperLeft
Source GLSL 330
Source GLSL 330
Name 4 "main"
Name 4 "main"
...
@@ -21,12 +21,12 @@ spv.deepRvalue.frag
...
@@ -21,12 +21,12 @@ spv.deepRvalue.frag
Name 106 "h"
Name 106 "h"
Name 107 "i"
Name 107 "i"
Name 111 "samp2D"
Name 111 "samp2D"
Name 1
34
"str"
Name 1
29
"str"
MemberName 1
34
(str) 0 "a"
MemberName 1
29
(str) 0 "a"
MemberName 1
34
(str) 1 "b"
MemberName 1
29
(str) 1 "b"
MemberName 1
34
(str) 2 "c"
MemberName 1
29
(str) 2 "c"
Name 13
6
"t"
Name 13
1
"t"
Name 14
9
"gl_FragColor"
Name 14
4
"gl_FragColor"
Decorate 111(samp2D) DescriptorSet 0
Decorate 111(samp2D) DescriptorSet 0
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
...
@@ -75,22 +75,21 @@ spv.deepRvalue.frag
...
@@ -75,22 +75,21 @@ spv.deepRvalue.frag
113: TypeVector 6(float) 2
113: TypeVector 6(float) 2
114: 6(float) Constant 1056964608
114: 6(float) Constant 1056964608
115: 113(fvec2) ConstantComposite 114 114
115: 113(fvec2) ConstantComposite 114 114
118: TypePointer Function 7(fvec4)
119: 6(float) Constant 1036831949
121: 6(float) Constant 1036831949
120: TypeBool
122: TypeBool
128: TypeArray 113(fvec2) 84
133: TypeArray 113(fvec2) 84
129(str): TypeStruct 81(int) 128 120(bool)
134(str): TypeStruct 81(int) 133 122(bool)
130: TypePointer Function 129(str)
135: TypePointer Function 134(str)
132: 113(fvec2) ConstantComposite 10 11
137: 113(fvec2) ConstantComposite 10 11
133: 6(float) Constant 1082130432
138: 6(float) Constant 1082130432
134: 113(fvec2) ConstantComposite 133 12
139: 113(fvec2) ConstantComposite 138 12
135: 6(float) Constant 1086324736
140: 6(float) Constant 1086324736
136: 113(fvec2) ConstantComposite 135 13
141: 113(fvec2) ConstantComposite 140 13
137: 128 ConstantComposite 132 134 136
142: 133 ConstantComposite 137 139 141
138: 120(bool) ConstantTrue
143: 122(bool) ConstantTrue
139: 129(str) ConstantComposite 82 137 138
144: 134(str) ConstantComposite 82 142 143
143: TypePointer Output 7(fvec4)
148: TypePointer Output 7(fvec4)
144(gl_FragColor): 143(ptr) Variable Output
149(gl_FragColor): 148(ptr) Variable Output
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
35(m): 34(ptr) Variable Function
35(m): 34(ptr) Variable Function
...
@@ -99,8 +98,7 @@ spv.deepRvalue.frag
...
@@ -99,8 +98,7 @@ spv.deepRvalue.frag
87(g): 79(ptr) Variable Function
87(g): 79(ptr) Variable Function
106(h): 79(ptr) Variable Function
106(h): 79(ptr) Variable Function
107(i): 79(ptr) Variable Function
107(i): 79(ptr) Variable Function
119: 118(ptr) Variable Function
131(t): 130(ptr) Variable Function
136(t): 135(ptr) Variable Function
Store 9(v1) 14
Store 9(v1) 14
Store 15(v2) 20
Store 15(v2) 20
Store 21(v3) 26
Store 21(v3) 26
...
@@ -172,34 +170,25 @@ spv.deepRvalue.frag
...
@@ -172,34 +170,25 @@ spv.deepRvalue.frag
116: 7(fvec4) ImageSampleImplicitLod 112 115
116: 7(fvec4) ImageSampleImplicitLod 112 115
117: 6(float) CompositeExtract 116 1
117: 6(float) CompositeExtract 116 1
Store 107(i) 117
Store 107(i) 117
120: 6(float) Load 107(i)
118: 6(float) Load 107(i)
123: 122(bool) FOrdGreaterThan 120 121
121: 120(bool) FOrdGreaterThan 118 119
SelectionMerge 125 None
122: 7(fvec4) Load 9(v1)
BranchConditional 123 124 127
123: 7(fvec4) Load 15(v2)
124: Label
124: 7(fvec4) Select 121 122 123
126: 7(fvec4) Load 9(v1)
125: 6(float) CompositeExtract 124 3
Store 119 126
126: 6(float) Load 107(i)
Branch 125
127: 6(float) FAdd 126 125
127: Label
Store 107(i) 127
128: 7(fvec4) Load 15(v2)
Store 131(t) 139
Store 119 128
140: 6(float) CompositeExtract 139 1 2 1
Branch 125
141: 6(float) Load 107(i)
125: Label
142: 6(float) FAdd 141 140
129: 79(ptr) AccessChain 119 84
Store 107(i) 142
130: 6(float) Load 129
145: 6(float) Load 80(f)
131: 6(float) Load 107(i)
146: 6(float) Load 87(g)
132: 6(float) FAdd 131 130
147: 6(float) Load 106(h)
Store 107(i) 132
148: 6(float) Load 107(i)
Store 136(t) 144
149: 7(fvec4) CompositeConstruct 145 146 147 148
145: 6(float) CompositeExtract 144 1 2 1
Store 144(gl_FragColor) 149
146: 6(float) Load 107(i)
147: 6(float) FAdd 146 145
Store 107(i) 147
150: 6(float) Load 80(f)
151: 6(float) Load 87(g)
152: 6(float) Load 106(h)
153: 6(float) Load 107(i)
154: 7(fvec4) CompositeConstruct 150 151 152 153
Store 149(gl_FragColor) 154
Return
Return
FunctionEnd
FunctionEnd
Test/baseResults/spv.for-complex-condition.vert.out
View file @
433e9ff8
...
@@ -3,38 +3,37 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -3,38 +3,37 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by 3
5
// Id's are bound by 3
1
Capability Shader
Capability Shader
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 1
8 31
EntryPoint Vertex 4 "main" 1
7 27
Source GLSL 450
Source GLSL 450
Name 4 "main"
Name 4 "main"
Name 8 "i"
Name 8 "i"
Name 1
8
"flag"
Name 1
7
"flag"
Name
31
"r"
Name
27
"r"
Decorate 1
8
(flag) RelaxedPrecision
Decorate 1
7
(flag) RelaxedPrecision
Decorate 1
8
(flag) Location 0
Decorate 1
7
(flag) Location 0
Decorate 1
9
RelaxedPrecision
Decorate 1
8
RelaxedPrecision
Decorate
31
(r) Location 0
Decorate
27
(r) Location 0
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeInt 32 1
6: TypeInt 32 1
7: TypePointer Function 6(int)
7: TypePointer Function 6(int)
9: 6(int) Constant 0
9: 6(int) Constant 0
1
7
: TypePointer Input 6(int)
1
6
: TypePointer Input 6(int)
1
8(flag): 17
(ptr) Variable Input
1
7(flag): 16
(ptr) Variable Input
20
: 6(int) Constant 1
19
: 6(int) Constant 1
2
1
: TypeBool
2
0
: TypeBool
2
5
: 6(int) Constant 10
2
2
: 6(int) Constant 10
2
7
: 6(int) Constant 15
2
3
: 6(int) Constant 15
30
: TypePointer Output 6(int)
26
: TypePointer Output 6(int)
31(r): 30
(ptr) Variable Output
27(r): 26
(ptr) Variable Output
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
8(i): 7(ptr) Variable Function
8(i): 7(ptr) Variable Function
16: 7(ptr) Variable Function
Store 8(i) 9
Store 8(i) 9
Branch 10
Branch 10
10: Label
10: Label
...
@@ -42,29 +41,20 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -42,29 +41,20 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Branch 14
Branch 14
14: Label
14: Label
15: 6(int) Load 8(i)
15: 6(int) Load 8(i)
19: 6(int) Load 18(flag)
18: 6(int) Load 17(flag)
22: 21(bool) IEqual 19 20
21: 20(bool) IEqual 18 19
SelectionMerge 24 None
24: 6(int) Select 21 22 23
BranchConditional 22 23 26
25: 20(bool) SLessThan 15 24
23: Label
BranchConditional 25 11 12
Store 16 25
11: Label
Branch 24
28: 6(int) Load 8(i)
26: Label
Store 27(r) 28
Store 16 27
Branch 13
Branch 24
13: Label
24: Label
29: 6(int) Load 8(i)
28: 6(int) Load 16
30: 6(int) IAdd 29 19
29: 21(bool) SLessThan 15 28
Store 8(i) 30
BranchConditional 29 11 12
Branch 10
11: Label
32: 6(int) Load 8(i)
Store 31(r) 32
Branch 13
13: Label
33: 6(int) Load 8(i)
34: 6(int) IAdd 33 20
Store 8(i) 34
Branch 10
12: Label
12: Label
Return
Return
FunctionEnd
FunctionEnd
Test/baseResults/spv.image.frag.out
View file @
433e9ff8
...
@@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -3,7 +3,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 80001
// Generated by (magic number): 80001
// Id's are bound by 37
8
// Id's are bound by 37
4
Capability Shader
Capability Shader
Capability SampledRect
Capability SampledRect
...
@@ -16,7 +16,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -16,7 +16,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Capability StorageImageWriteWithoutFormat
Capability StorageImageWriteWithoutFormat
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 132 142 152 248 362 37
7
EntryPoint Fragment 4 "main" 132 142 152 248 362 37
3
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
Source GLSL 450
Name 4 "main"
Name 4 "main"
...
@@ -42,7 +42,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -42,7 +42,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Name 248 "value"
Name 248 "value"
Name 357 "wo2D"
Name 357 "wo2D"
Name 362 "fragData"
Name 362 "fragData"
Name 37
7
"ic4D"
Name 37
3
"ic4D"
Decorate 15(i1D) DescriptorSet 0
Decorate 15(i1D) DescriptorSet 0
Decorate 15(i1D) Binding 0
Decorate 15(i1D) Binding 0
Decorate 27(i2D) DescriptorSet 0
Decorate 27(i2D) DescriptorSet 0
...
@@ -76,7 +76,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -76,7 +76,7 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Decorate 357(wo2D) DescriptorSet 0
Decorate 357(wo2D) DescriptorSet 0
Decorate 357(wo2D) Binding 1
Decorate 357(wo2D) Binding 1
Decorate 357(wo2D) NonReadable
Decorate 357(wo2D) NonReadable
Decorate 37
7
(ic4D) Flat
Decorate 37
3
(ic4D) Flat
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeInt 32 1
6: TypeInt 32 1
...
@@ -163,16 +163,15 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -163,16 +163,15 @@ Warning, version 450 is not yet complete; most version-specific features are pre
357(wo2D): 356(ptr) Variable UniformConstant
357(wo2D): 356(ptr) Variable UniformConstant
361: TypePointer Output 125(fvec4)
361: TypePointer Output 125(fvec4)
362(fragData): 361(ptr) Variable Output
362(fragData): 361(ptr) Variable Output
36
8
: TypeBool
36
7
: TypeBool
37
5
: TypeVector 6(int) 4
37
1
: TypeVector 6(int) 4
37
6: TypePointer Input 375
(ivec4)
37
2: TypePointer Input 371
(ivec4)
37
7(ic4D): 376
(ptr) Variable Input
37
3(ic4D): 372
(ptr) Variable Input
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
9(iv): 8(ptr) Variable Function
9(iv): 8(ptr) Variable Function
127(v): 126(ptr) Variable Function
127(v): 126(ptr) Variable Function
229(ui): 228(ptr) Variable Function
229(ui): 228(ptr) Variable Function
363: 126(ptr) Variable Function
Store 9(iv) 11
Store 9(iv) 11
16: 13 Load 15(i1D)
16: 13 Load 15(i1D)
17: 6(int) ImageQuerySize 16
17: 6(int) ImageQuerySize 16
...
@@ -498,22 +497,13 @@ Warning, version 450 is not yet complete; most version-specific features are pre
...
@@ -498,22 +497,13 @@ Warning, version 450 is not yet complete; most version-specific features are pre
359: 29(ivec2) Load 142(ic2D)
359: 29(ivec2) Load 142(ic2D)
360: 125(fvec4) Load 127(v)
360: 125(fvec4) Load 127(v)
ImageWrite 358 359 360
ImageWrite 358 359 360
364: 18(int) Load 229(ui)
363: 18(int) Load 229(ui)
365: 20(ptr) AccessChain 9(iv) 237
364: 20(ptr) AccessChain 9(iv) 237
366: 6(int) Load 365
365: 6(int) Load 364
367: 18(int) Bitcast 366
366: 18(int) Bitcast 365
369: 368(bool) INotEqual 364 367
368: 367(bool) INotEqual 363 366
SelectionMerge 371 None
369: 125(fvec4) Load 127(v)
BranchConditional 369 370 373
370: 125(fvec4) Select 368 369 129
370: Label
Store 362(fragData) 370
372: 125(fvec4) Load 127(v)
Store 363 372
Branch 371
373: Label
Store 363 129
Branch 371
371: Label
374: 125(fvec4) Load 363
Store 362(fragData) 374
Return
Return
FunctionEnd
FunctionEnd
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