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
fde4975d
Commit
fde4975d
authored
Jun 29, 2017
by
t.jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for not transforming all image symbols into sampled images symbols
Change-Id: I10f9bcea2e97f36912a81214552b93db4805b61a
parent
89f8d1e6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
24 deletions
+24
-24
spv.texture.sampler.transform.frag.out
Test/baseResults/spv.texture.sampler.transform.frag.out
+15
-14
Intermediate.cpp
glslang/MachineIndependent/Intermediate.cpp
+9
-10
No files found.
Test/baseResults/spv.texture.sampler.transform.frag.out
View file @
fde4975d
spv.texture.sampler.transform.frag
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by
19
// Id's are bound by
20
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 9 1
6
EntryPoint Fragment 4 "main" 9 1
7
ExecutionMode 4 OriginUpperLeft
Source GLSL 440
Name 4 "main"
Name 9 "color"
Name 1
2
"tex"
Name 1
6
"coord"
Decorate 1
2
(tex) DescriptorSet 0
Name 1
3
"tex"
Name 1
7
"coord"
Decorate 1
3
(tex) DescriptorSet 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
...
...
@@ -21,16 +21,17 @@ spv.texture.sampler.transform.frag
8: TypePointer Output 7(fvec4)
9(color): 8(ptr) Variable Output
10: TypeImage 6(float) 2D sampled format:Unknown
11: TypePointer UniformConstant 10
12(tex): 11(ptr) Variable UniformConstant
14: TypeVector 6(float) 2
15: TypePointer Input 14(fvec2)
16(coord): 15(ptr) Variable Input
11: TypeSampledImage 10
12: TypePointer UniformConstant 11
13(tex): 12(ptr) Variable UniformConstant
15: TypeVector 6(float) 2
16: TypePointer Input 15(fvec2)
17(coord): 16(ptr) Variable Input
4(main): 2 Function None 3
5: Label
1
3: 10 Load 12
(tex)
1
7: 14(fvec2) Load 16
(coord)
1
8: 7(fvec4) ImageSampleImplicitLod 13 17
Store 9(color) 1
8
1
4: 11 Load 13
(tex)
1
8: 15(fvec2) Load 17
(coord)
1
9: 7(fvec4) ImageSampleImplicitLod 14 18
Store 9(color) 1
9
Return
FunctionEnd
glslang/MachineIndependent/Intermediate.cpp
View file @
fde4975d
...
...
@@ -3186,6 +3186,11 @@ bool TIntermediate::specConstantPropagates(const TIntermTyped& node1, const TInt
}
struct
TextureUpgradeAndSamplerRemovalTransform
:
public
TIntermTraverser
{
void
visitSymbol
(
TIntermSymbol
*
symbol
)
override
{
if
(
symbol
->
getBasicType
()
==
EbtSampler
&&
symbol
->
getType
().
getSampler
().
isTexture
())
{
symbol
->
getWritableType
().
getSampler
().
combined
=
true
;
}
}
bool
visitAggregate
(
TVisit
,
TIntermAggregate
*
ag
)
override
{
using
namespace
std
;
TIntermSequence
&
seq
=
ag
->
getSequence
();
...
...
@@ -3199,17 +3204,11 @@ struct TextureUpgradeAndSamplerRemovalTransform : public TIntermTraverser {
});
seq
.
erase
(
newEnd
,
seq
.
end
());
// replace constructors with sampler/textures
// update textures into sampled textures
for_each
(
seq
.
begin
(),
seq
.
end
(),
[](
TIntermNode
*&
node
)
{
TIntermSymbol
*
symbol
=
node
->
getAsSymbolNode
();
if
(
!
symbol
)
{
TIntermAggregate
*
constructor
=
node
->
getAsAggregate
();
if
(
constructor
&&
constructor
->
getOp
()
==
EOpConstructTextureSampler
)
{
if
(
!
constructor
->
getSequence
().
empty
())
node
=
constructor
->
getSequence
()[
0
];
}
}
else
if
(
symbol
->
getBasicType
()
==
EbtSampler
&&
symbol
->
getType
().
getSampler
().
isTexture
())
{
symbol
->
getWritableType
().
getSampler
().
combined
=
true
;
TIntermAggregate
*
constructor
=
node
->
getAsAggregate
();
if
(
constructor
&&
constructor
->
getOp
()
==
EOpConstructTextureSampler
)
{
if
(
!
constructor
->
getSequence
().
empty
())
node
=
constructor
->
getSequence
()[
0
];
}
});
return
true
;
...
...
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