shader: Fix Array Indices in TEX/TLD4

This commit is contained in:
FernandoS27 2021-03-26 01:54:03 +01:00 committed by ameerj
parent f5672777c8
commit 981eb6f43b
2 changed files with 6 additions and 6 deletions

View File

@ -61,11 +61,11 @@ IR::Value MakeCoords(TranslatorVisitor& v, IR::Reg reg, TextureType 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(read_array(), v.F(reg + 1)); return v.ir.CompositeConstruct(v.F(reg + 1), read_array());
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(read_array(), v.F(reg + 1), v.F(reg + 2)); return v.ir.CompositeConstruct(v.F(reg + 1), v.F(reg + 2), read_array());
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:
@ -73,7 +73,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(read_array(), v.F(reg + 1), v.F(reg + 2), v.F(reg + 3)); return v.ir.CompositeConstruct(v.F(reg + 1), v.F(reg + 2), v.F(reg + 3), read_array());
} }
throw NotImplementedException("Invalid texture type {}", type); throw NotImplementedException("Invalid texture type {}", type);
} }

View File

@ -65,11 +65,11 @@ IR::Value MakeCoords(TranslatorVisitor& v, IR::Reg reg, TextureType 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(read_array(), v.F(reg + 1)); return v.ir.CompositeConstruct(v.F(reg + 1), read_array());
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(read_array(), v.F(reg + 1), v.F(reg + 2)); return v.ir.CompositeConstruct(v.F(reg + 1), v.F(reg + 2), read_array());
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:
@ -77,7 +77,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(read_array(), v.F(reg + 1), v.F(reg + 2), v.F(reg + 3)); return v.ir.CompositeConstruct(v.F(reg + 1), v.F(reg + 2), v.F(reg + 3), read_array());
} }
throw NotImplementedException("Invalid texture type {}", type); throw NotImplementedException("Invalid texture type {}", type);
} }