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
3839066e
Unverified
Commit
3839066e
authored
Feb 26, 2021
by
greg-lunarg
Committed by
GitHub
Feb 26, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2556 from greg-lunarg/i2541
Fix precision propagation around shifts
parents
51d672b8
c1760859
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
7 deletions
+51
-7
spv.precision.frag.out
Test/baseResults/spv.precision.frag.out
+39
-2
spv.precision.frag
Test/spv.precision.frag
+2
-0
Intermediate.cpp
glslang/MachineIndependent/Intermediate.cpp
+10
-5
No files found.
Test/baseResults/spv.precision.frag.out
View file @
3839066e
spv.precision.frag
spv.precision.frag
// Module Version 10000
// Module Version 10000
// Generated by (magic number): 8000a
// Generated by (magic number): 8000a
// Id's are bound by 1
46
// Id's are bound by 1
65
Capability Shader
Capability Shader
1: ExtInstImport "GLSL.std.450"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 23 62 64 76 119
EntryPoint Fragment 4 "main" 23 62 64 76 119
149
ExecutionMode 4 OriginUpperLeft
ExecutionMode 4 OriginUpperLeft
Source ESSL 310
Source ESSL 310
SourceExtension "GL_OES_sample_variables"
Name 4 "main"
Name 4 "main"
Name 12 "foo(vf3;"
Name 12 "foo(vf3;"
Name 11 "mv3"
Name 11 "mv3"
...
@@ -33,6 +34,7 @@ spv.precision.frag
...
@@ -33,6 +34,7 @@ spv.precision.frag
MemberName 117(S) 0 "a"
MemberName 117(S) 0 "a"
MemberName 117(S) 1 "b"
MemberName 117(S) 1 "b"
Name 119 "s"
Name 119 "s"
Name 149 "gl_SampleMaskIn"
Decorate 12(foo(vf3;) RelaxedPrecision
Decorate 12(foo(vf3;) RelaxedPrecision
Decorate 11(mv3) RelaxedPrecision
Decorate 11(mv3) RelaxedPrecision
Decorate 23(highfin) Location 2
Decorate 23(highfin) Location 2
...
@@ -97,6 +99,15 @@ spv.precision.frag
...
@@ -97,6 +99,15 @@ spv.precision.frag
Decorate 143 RelaxedPrecision
Decorate 143 RelaxedPrecision
Decorate 144 RelaxedPrecision
Decorate 144 RelaxedPrecision
Decorate 145 RelaxedPrecision
Decorate 145 RelaxedPrecision
Decorate 149(gl_SampleMaskIn) Flat
Decorate 149(gl_SampleMaskIn) BuiltIn SampleMask
Decorate 153 RelaxedPrecision
Decorate 156 RelaxedPrecision
Decorate 159 RelaxedPrecision
Decorate 160 RelaxedPrecision
Decorate 162 RelaxedPrecision
Decorate 163 RelaxedPrecision
Decorate 164 RelaxedPrecision
2: TypeVoid
2: TypeVoid
3: TypeFunction 2
3: TypeFunction 2
6: TypeFloat 32
6: TypeFloat 32
...
@@ -147,6 +158,11 @@ spv.precision.frag
...
@@ -147,6 +158,11 @@ spv.precision.frag
133: 6(float) Constant 1082549862
133: 6(float) Constant 1082549862
138: 6(float) Constant 1073741824
138: 6(float) Constant 1073741824
142: 6(float) Constant 1077936128
142: 6(float) Constant 1077936128
146: 95(int) Constant 1
147: TypeArray 39(int) 146
148: TypePointer Input 147
149(gl_SampleMaskIn): 148(ptr) Variable Input
150: TypePointer Input 39(int)
4(main): 2 Function None 3
4(main): 2 Function None 3
5: Label
5: Label
41(sum): 40(ptr) Variable Function
41(sum): 40(ptr) Variable Function
...
@@ -156,6 +172,7 @@ spv.precision.frag
...
@@ -156,6 +172,7 @@ spv.precision.frag
72(local_highp): 71(ptr) Variable Function
72(local_highp): 71(ptr) Variable Function
108(param): 16(ptr) Variable Function
108(param): 16(ptr) Variable Function
135: 71(ptr) Variable Function
135: 71(ptr) Variable Function
156: 71(ptr) Variable Function
44: 39(int) Load 43(uniform_medium)
44: 39(int) Load 43(uniform_medium)
46: 39(int) Load 45(uniform_high)
46: 39(int) Load 45(uniform_high)
47: 39(int) IAdd 44 46
47: 39(int) IAdd 44 46
...
@@ -249,6 +266,26 @@ spv.precision.frag
...
@@ -249,6 +266,26 @@ spv.precision.frag
137: Label
137: Label
145: 21(fvec4) Load 135
145: 21(fvec4) Load 135
Store 76(mediumfout) 145
Store 76(mediumfout) 145
151: 150(ptr) AccessChain 149(gl_SampleMaskIn) 120
152: 39(int) Load 151
153: 39(int) Load 43(uniform_medium)
154: 39(int) ShiftRightArithmetic 152 153
155: 14(bool) SGreaterThan 154 120
SelectionMerge 158 None
BranchConditional 155 157 161
157: Label
159: 21(fvec4) Load 76(mediumfout)
160: 21(fvec4) VectorTimesScalar 159 138
Store 156 160
Branch 158
161: Label
162: 21(fvec4) Load 76(mediumfout)
163: 21(fvec4) VectorTimesScalar 162 142
Store 156 163
Branch 158
158: Label
164: 21(fvec4) Load 156
Store 76(mediumfout) 164
Return
Return
FunctionEnd
FunctionEnd
12(foo(vf3;): 9(fvec2) Function None 10
12(foo(vf3;): 9(fvec2) Function None 10
...
...
Test/spv.precision.frag
View file @
3839066e
#version 310 es
#version 310 es
#extension GL_OES_sample_variables : enable
precision
mediump
float
;
precision
mediump
float
;
in
lowp
float
lowfin
;
in
lowp
float
lowfin
;
in
mediump
float
mediumfin
;
in
mediump
float
mediumfin
;
...
@@ -59,4 +60,5 @@ void main()
...
@@ -59,4 +60,5 @@ void main()
mediumfout
*=
s
.
b
;
mediumfout
*=
s
.
b
;
mediumfout
=
((
mediumfin
*
mediumfin
>
4
.
2
)
?
2
.
0
*
mediumfout
:
3
.
0
*
mediumfout
);
mediumfout
=
((
mediumfin
*
mediumfin
>
4
.
2
)
?
2
.
0
*
mediumfout
:
3
.
0
*
mediumfout
);
mediumfout
=
((
gl_SampleMaskIn
[
0
]
>>
uniform_medium
>
0
)
?
2
.
0
*
mediumfout
:
3
.
0
*
mediumfout
);
}
}
glslang/MachineIndependent/Intermediate.cpp
View file @
3839066e
...
@@ -3776,11 +3776,16 @@ void TIntermBinary::updatePrecision()
...
@@ -3776,11 +3776,16 @@ void TIntermBinary::updatePrecision()
{
{
if
(
getBasicType
()
==
EbtInt
||
getBasicType
()
==
EbtUint
||
if
(
getBasicType
()
==
EbtInt
||
getBasicType
()
==
EbtUint
||
getBasicType
()
==
EbtFloat
||
getBasicType
()
==
EbtFloat16
)
{
getBasicType
()
==
EbtFloat
||
getBasicType
()
==
EbtFloat16
)
{
getQualifier
().
precision
=
std
::
max
(
right
->
getQualifier
().
precision
,
left
->
getQualifier
().
precision
);
if
(
op
==
EOpRightShift
||
op
==
EOpLeftShift
)
{
if
(
getQualifier
().
precision
!=
EpqNone
)
{
// For shifts get precision from left side only and thus no need to propagate
left
->
propagatePrecision
(
getQualifier
().
precision
);
getQualifier
().
precision
=
left
->
getQualifier
().
precision
;
right
->
propagatePrecision
(
getQualifier
().
precision
);
}
else
{
}
getQualifier
().
precision
=
std
::
max
(
right
->
getQualifier
().
precision
,
left
->
getQualifier
().
precision
);
if
(
getQualifier
().
precision
!=
EpqNone
)
{
left
->
propagatePrecision
(
getQualifier
().
precision
);
right
->
propagatePrecision
(
getQualifier
().
precision
);
}
}
}
}
}
}
...
...
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