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