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
8d3f3b7d
Unverified
Commit
8d3f3b7d
authored
Jun 30, 2020
by
John Kessenich
Committed by
GitHub
Jun 30, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2302 from KhronosGroup/fix-texture-precision
SPV: RelaxedPrecision: use the result precision for texture sampling.
parents
d5b5215a
12c155f3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
148 additions
and
2 deletions
+148
-2
GlslangToSpv.cpp
SPIRV/GlslangToSpv.cpp
+1
-1
spv.precisionTexture.frag.out
Test/baseResults/spv.precisionTexture.frag.out
+120
-0
spv.precisionTexture.frag
Test/spv.precisionTexture.frag
+25
-0
ParseHelper.cpp
glslang/MachineIndependent/ParseHelper.cpp
+1
-1
Spv.FromFile.cpp
gtests/Spv.FromFile.cpp
+1
-0
No files found.
SPIRV/GlslangToSpv.cpp
View file @
8d3f3b7d
...
...
@@ -4736,7 +4736,7 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO
translateArguments
(
*
node
->
getAsAggregate
(),
arguments
,
lvalueCoherentFlags
);
else
translateArguments
(
*
node
->
getAsUnaryNode
(),
arguments
);
spv
::
Decoration
precision
=
TranslatePrecisionDecoration
(
node
->
get
OperationPrecision
());
spv
::
Decoration
precision
=
TranslatePrecisionDecoration
(
node
->
get
Type
());
spv
::
Builder
::
TextureParameters
params
=
{
};
params
.
sampler
=
arguments
[
0
];
...
...
Test/baseResults/spv.precisionTexture.frag.out
0 → 100755
View file @
8d3f3b7d
spv.precisionTexture.frag
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 66
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 16 57 65
ExecutionMode 4 OriginUpperLeft
Source ESSL 310
Name 4 "main"
Name 9 "v"
Name 13 "texM"
Name 16 "vertex"
Name 21 "texH"
Name 52 "imageM"
Name 57 "coord"
Name 60 "imageH"
Name 65 "fragColor"
Decorate 9(v) RelaxedPrecision
Decorate 13(texM) RelaxedPrecision
Decorate 13(texM) DescriptorSet 0
Decorate 13(texM) Binding 0
Decorate 14 RelaxedPrecision
Decorate 16(vertex) Location 0
Decorate 20 RelaxedPrecision
Decorate 21(texH) DescriptorSet 0
Decorate 21(texH) Binding 1
Decorate 26 RelaxedPrecision
Decorate 34 RelaxedPrecision
Decorate 41 RelaxedPrecision
Decorate 45 RelaxedPrecision
Decorate 52(imageM) RelaxedPrecision
Decorate 52(imageM) DescriptorSet 0
Decorate 52(imageM) Binding 0
Decorate 52(imageM) NonWritable
Decorate 53 RelaxedPrecision
Decorate 57(coord) Flat
Decorate 57(coord) Location 1
Decorate 59 RelaxedPrecision
Decorate 60(imageH) DescriptorSet 0
Decorate 60(imageH) Binding 1
Decorate 60(imageH) NonWritable
Decorate 65(fragColor) RelaxedPrecision
Decorate 65(fragColor) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: TypeImage 6(float) 2D sampled format:Unknown
11: TypeSampledImage 10
12: TypePointer UniformConstant 11
13(texM): 12(ptr) Variable UniformConstant
15: TypePointer Input 7(fvec4)
16(vertex): 15(ptr) Variable Input
17: TypeVector 6(float) 2
21(texH): 12(ptr) Variable UniformConstant
29: TypeInt 32 0
30: 29(int) Constant 2
31: TypePointer Input 6(float)
42: TypeVector 6(float) 3
50: TypeImage 6(float) 2D nonsampled format:Rgba32f
51: TypePointer UniformConstant 50
52(imageM): 51(ptr) Variable UniformConstant
54: TypeInt 32 1
55: TypeVector 54(int) 2
56: TypePointer Input 55(ivec2)
57(coord): 56(ptr) Variable Input
60(imageH): 51(ptr) Variable UniformConstant
64: TypePointer Output 7(fvec4)
65(fragColor): 64(ptr) Variable Output
4(main): 2 Function None 3
5: Label
9(v): 8(ptr) Variable Function
14: 11 Load 13(texM)
18: 7(fvec4) Load 16(vertex)
19: 17(fvec2) VectorShuffle 18 18 0 1
20: 7(fvec4) ImageSampleImplicitLod 14 19
Store 9(v) 20
22: 11 Load 21(texH)
23: 7(fvec4) Load 16(vertex)
24: 17(fvec2) VectorShuffle 23 23 0 1
25: 7(fvec4) ImageSampleImplicitLod 22 24
Store 9(v) 25
26: 11 Load 13(texM)
27: 7(fvec4) Load 16(vertex)
28: 17(fvec2) VectorShuffle 27 27 0 1
32: 31(ptr) AccessChain 16(vertex) 30
33: 6(float) Load 32
34: 7(fvec4) ImageSampleExplicitLod 26 28 Lod 33
Store 9(v) 34
35: 11 Load 21(texH)
36: 7(fvec4) Load 16(vertex)
37: 17(fvec2) VectorShuffle 36 36 0 1
38: 31(ptr) AccessChain 16(vertex) 30
39: 6(float) Load 38
40: 7(fvec4) ImageSampleExplicitLod 35 37 Lod 39
Store 9(v) 40
41: 11 Load 13(texM)
43: 7(fvec4) Load 16(vertex)
44: 42(fvec3) VectorShuffle 43 43 0 1 2
45: 7(fvec4) ImageSampleProjImplicitLod 41 44
Store 9(v) 45
46: 11 Load 21(texH)
47: 7(fvec4) Load 16(vertex)
48: 42(fvec3) VectorShuffle 47 47 0 1 2
49: 7(fvec4) ImageSampleProjImplicitLod 46 48
Store 9(v) 49
53: 50 Load 52(imageM)
58: 55(ivec2) Load 57(coord)
59: 7(fvec4) ImageRead 53 58
Store 9(v) 59
61: 50 Load 60(imageH)
62: 55(ivec2) Load 57(coord)
63: 7(fvec4) ImageRead 61 62
Store 9(v) 63
Return
FunctionEnd
Test/spv.precisionTexture.frag
0 → 100644
View file @
8d3f3b7d
#version 310 es
precision
mediump
float
;
precision
mediump
int
;
layout
(
binding
=
0
)
uniform
mediump
sampler2D
texM
;
layout
(
binding
=
1
)
uniform
highp
sampler2D
texH
;
layout
(
binding
=
0
,
rgba32f
)
uniform
readonly
mediump
image2D
imageM
;
layout
(
binding
=
1
,
rgba32f
)
uniform
readonly
highp
image2D
imageH
;
layout
(
location
=
0
)
in
highp
vec4
vertex
;
layout
(
location
=
1
)
flat
in
highp
ivec2
coord
;
layout
(
location
=
0
)
out
vec4
fragColor
;
void
main
()
{
vec4
v
;
v
=
texture
(
texM
,
vertex
.
xy
);
v
=
texture
(
texH
,
vertex
.
xy
);
v
=
textureLod
(
texM
,
vertex
.
xy
,
vertex
.
z
);
v
=
textureLod
(
texH
,
vertex
.
xy
,
vertex
.
z
);
v
=
textureProj
(
texM
,
vertex
.
xyz
);
v
=
textureProj
(
texH
,
vertex
.
xyz
);
v
=
imageLoad
(
imageM
,
coord
);
v
=
imageLoad
(
imageH
,
coord
);
}
\ No newline at end of file
glslang/MachineIndependent/ParseHelper.cpp
View file @
8d3f3b7d
...
...
@@ -1295,7 +1295,7 @@ TIntermTyped* TParseContext::handleBuiltInFunctionCall(TSourceLoc loc, TIntermNo
TIntermTyped
*
result
=
intermediate
.
addBuiltInFunctionCall
(
loc
,
function
.
getBuiltInOp
(),
function
.
getParamCount
()
==
1
,
arguments
,
function
.
getType
());
if
(
obeyPrecisionQualifiers
())
if
(
result
!=
nullptr
&&
obeyPrecisionQualifiers
())
computeBuiltinPrecisions
(
*
result
,
function
);
if
(
result
==
nullptr
)
{
...
...
gtests/Spv.FromFile.cpp
View file @
8d3f3b7d
...
...
@@ -377,6 +377,7 @@ INSTANTIATE_TEST_CASE_P(
"spv.precision.frag"
,
"spv.precisionArgs.frag"
,
"spv.precisionNonESSamp.frag"
,
"spv.precisionTexture.frag"
,
"spv.prepost.frag"
,
"spv.privateVariableTypes.frag"
,
"spv.qualifiers.vert"
,
...
...
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