1
0
Fork 0
forked from suyu/suyu

tmml: Remove index component from coords vec

The lod query functions exposed by the rendering API's do not make use of the texturearray layer indexing.
This commit is contained in:
ameerj 2021-06-12 16:23:04 -04:00
parent ea038d6653
commit 3c125d4134

View file

@ -46,16 +46,15 @@ Shader::TextureType GetType(TextureType type) {
} }
IR::Value MakeCoords(TranslatorVisitor& v, IR::Reg reg, TextureType type) { IR::Value MakeCoords(TranslatorVisitor& v, IR::Reg reg, TextureType type) {
const auto read_array{[&]() -> IR::F32 { return v.ir.ConvertUToF(32, 16, v.X(reg)); }};
switch (type) { switch (type) {
case TextureType::_1D: case TextureType::_1D:
return v.F(reg); return v.F(reg);
case TextureType::ARRAY_1D: case TextureType::ARRAY_1D:
return v.ir.CompositeConstruct(v.F(reg + 1), read_array()); return v.F(reg + 1);
case TextureType::_2D: case TextureType::_2D:
return v.ir.CompositeConstruct(v.F(reg), v.F(reg + 1)); return v.ir.CompositeConstruct(v.F(reg), v.F(reg + 1));
case TextureType::ARRAY_2D: case TextureType::ARRAY_2D:
return v.ir.CompositeConstruct(v.F(reg + 1), v.F(reg + 2), read_array()); return v.ir.CompositeConstruct(v.F(reg + 1), v.F(reg + 2));
case TextureType::_3D: case TextureType::_3D:
return v.ir.CompositeConstruct(v.F(reg), v.F(reg + 1), v.F(reg + 2)); return v.ir.CompositeConstruct(v.F(reg), v.F(reg + 1), v.F(reg + 2));
case TextureType::ARRAY_3D: case TextureType::ARRAY_3D:
@ -63,7 +62,7 @@ IR::Value MakeCoords(TranslatorVisitor& v, IR::Reg reg, TextureType type) {
case TextureType::CUBE: case TextureType::CUBE:
return v.ir.CompositeConstruct(v.F(reg), v.F(reg + 1), v.F(reg + 2)); return v.ir.CompositeConstruct(v.F(reg), v.F(reg + 1), v.F(reg + 2));
case TextureType::ARRAY_CUBE: case TextureType::ARRAY_CUBE:
return v.ir.CompositeConstruct(v.F(reg + 1), v.F(reg + 2), v.F(reg + 3), read_array()); return v.ir.CompositeConstruct(v.F(reg + 1), v.F(reg + 2), v.F(reg + 3));
} }
throw NotImplementedException("Invalid texture type {}", type); throw NotImplementedException("Invalid texture type {}", type);
} }