summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend/maxwell
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2021-03-26 16:02:04 +0100
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:24 +0200
commit742d11c2ad948c8630be15901514ec9e5e5fcd20 (patch)
tree4d9e0976f8c95fbb5c8006b46579200315b04f0f /src/shader_recompiler/frontend/maxwell
parentshader: Fix Array Indices in TEX/TLD4 (diff)
downloadyuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar
yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.gz
yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.bz2
yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.lz
yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.xz
yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.tar.zst
yuzu-742d11c2ad948c8630be15901514ec9e5e5fcd20.zip
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch.cpp14
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather.cpp16
2 files changed, 16 insertions, 14 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch.cpp
index 1f1689c43..b2da079f9 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_fetch.cpp
@@ -101,16 +101,18 @@ IR::Value MakeOffset(TranslatorVisitor& v, IR::Reg& reg, TextureType type) {
switch (type) {
case TextureType::_1D:
case TextureType::ARRAY_1D:
- return v.ir.BitFieldExtract(value, v.ir.Imm32(0), v.ir.Imm32(4));
+ return v.ir.BitFieldExtract(value, v.ir.Imm32(0), v.ir.Imm32(4), true);
case TextureType::_2D:
case TextureType::ARRAY_2D:
- return v.ir.CompositeConstruct(v.ir.BitFieldExtract(value, v.ir.Imm32(0), v.ir.Imm32(4)),
- v.ir.BitFieldExtract(value, v.ir.Imm32(4), v.ir.Imm32(4)));
+ return v.ir.CompositeConstruct(
+ v.ir.BitFieldExtract(value, v.ir.Imm32(0), v.ir.Imm32(4), true),
+ v.ir.BitFieldExtract(value, v.ir.Imm32(4), v.ir.Imm32(4), true));
case TextureType::_3D:
case TextureType::ARRAY_3D:
- return v.ir.CompositeConstruct(v.ir.BitFieldExtract(value, v.ir.Imm32(0), v.ir.Imm32(4)),
- v.ir.BitFieldExtract(value, v.ir.Imm32(4), v.ir.Imm32(4)),
- v.ir.BitFieldExtract(value, v.ir.Imm32(8), v.ir.Imm32(4)));
+ return v.ir.CompositeConstruct(
+ v.ir.BitFieldExtract(value, v.ir.Imm32(0), v.ir.Imm32(4), true),
+ v.ir.BitFieldExtract(value, v.ir.Imm32(4), v.ir.Imm32(4), true),
+ v.ir.BitFieldExtract(value, v.ir.Imm32(8), v.ir.Imm32(4), true));
case TextureType::CUBE:
case TextureType::ARRAY_CUBE:
throw NotImplementedException("Illegal offset on CUBE sample");
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather.cpp
index 8c6384040..cdf5cb5c4 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/texture_gather.cpp
@@ -106,17 +106,17 @@ IR::Value MakeOffset(TranslatorVisitor& v, IR::Reg& reg, TextureType type) {
throw NotImplementedException("Invalid texture type {}", type);
}
-std::pair<IR::Value, IR::Value> MakeOffsetPTP(TranslatorVisitor& v, IR::Reg& reg) {
+IR::Value MakeOffsetPTP(TranslatorVisitor& v, IR::Reg& reg) {
const IR::U32 value1{v.X(reg++)};
const IR::U32 value2{v.X(reg++)};
- const auto getVector = ([&v](const IR::U32& value) {
+ const IR::U32 bitsize = v.ir.Imm32(6);
+ const auto getVector = ([&v, &bitsize](const IR::U32& value, u32 base) {
return v.ir.CompositeConstruct(
- v.ir.BitFieldExtract(value, v.ir.Imm32(0), v.ir.Imm32(6), true),
- v.ir.BitFieldExtract(value, v.ir.Imm32(8), v.ir.Imm32(6), true),
- v.ir.BitFieldExtract(value, v.ir.Imm32(16), v.ir.Imm32(6), true),
- v.ir.BitFieldExtract(value, v.ir.Imm32(24), v.ir.Imm32(6), true));
+ v.ir.BitFieldExtract(value, v.ir.Imm32(base + 0), bitsize, true),
+ v.ir.BitFieldExtract(value, v.ir.Imm32(base + 8), bitsize, true));
});
- return {getVector(value1), getVector(value2)};
+ return v.ir.CompositeConstruct(getVector(value1, 0), getVector(value1, 16),
+ getVector(value2, 0), getVector(value2, 16));
}
void Impl(TranslatorVisitor& v, u64 insn, ComponentType component_type, OffsetType offset_type,
@@ -155,7 +155,7 @@ void Impl(TranslatorVisitor& v, u64 insn, ComponentType component_type, OffsetTy
break;
}
case OffsetType::PTP: {
- std::tie(offset, offset2) = MakeOffsetPTP(v, meta_reg);
+ offset2 = MakeOffsetPTP(v, meta_reg);
break;
}
default: