Merge pull request #959 from TiemoJung/texture_upgrade
Fix for not transforming all image symbols into sampled images symbols
This commit is contained in:
commit
aad93a80b2
@ -1,19 +1,19 @@
|
|||||||
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 16
|
EntryPoint Fragment 4 "main" 9 17
|
||||||
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 12 "tex"
|
Name 13 "tex"
|
||||||
Name 16 "coord"
|
Name 17 "coord"
|
||||||
Decorate 12(tex) DescriptorSet 0
|
Decorate 13(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
|
|||||||
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
|
||||||
13: 10 Load 12(tex)
|
14: 11 Load 13(tex)
|
||||||
17: 14(fvec2) Load 16(coord)
|
18: 15(fvec2) Load 17(coord)
|
||||||
18: 7(fvec4) ImageSampleImplicitLod 13 17
|
19: 7(fvec4) ImageSampleImplicitLod 14 18
|
||||||
Store 9(color) 18
|
Store 9(color) 19
|
||||||
Return
|
Return
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
@ -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,17 +3204,11 @@ 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();
|
TIntermAggregate *constructor = node->getAsAggregate();
|
||||||
if (!symbol) {
|
if (constructor && constructor->getOp() == EOpConstructTextureSampler) {
|
||||||
TIntermAggregate *constructor = node->getAsAggregate();
|
if (!constructor->getSequence().empty())
|
||||||
if (constructor && constructor->getOp() == EOpConstructTextureSampler) {
|
node = constructor->getSequence()[0];
|
||||||
if (!constructor->getSequence().empty())
|
|
||||||
node = constructor->getSequence()[0];
|
|
||||||
}
|
|
||||||
} else if (symbol->getBasicType() == EbtSampler && symbol->getType().getSampler().isTexture()) {
|
|
||||||
symbol->getWritableType().getSampler().combined = true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user