summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2021-04-19 21:36:17 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:28 +0200
commit469f8bb85750792cf35d5a5aa72fa5a73cf33c82 (patch)
treee2ad225efe772d354c299650ac66d2bfc8b1f4da /src/shader_recompiler
parentshader: Add NVN storage buffer fallbacks (diff)
downloadyuzu-469f8bb85750792cf35d5a5aa72fa5a73cf33c82.tar
yuzu-469f8bb85750792cf35d5a5aa72fa5a73cf33c82.tar.gz
yuzu-469f8bb85750792cf35d5a5aa72fa5a73cf33c82.tar.bz2
yuzu-469f8bb85750792cf35d5a5aa72fa5a73cf33c82.tar.lz
yuzu-469f8bb85750792cf35d5a5aa72fa5a73cf33c82.tar.xz
yuzu-469f8bb85750792cf35d5a5aa72fa5a73cf33c82.tar.zst
yuzu-469f8bb85750792cf35d5a5aa72fa5a73cf33c82.zip
Diffstat (limited to 'src/shader_recompiler')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/load_store_local_shared.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_local_shared.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_local_shared.cpp
index e24b49721..20df163f2 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_local_shared.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/load_store_local_shared.cpp
@@ -34,6 +34,15 @@ IR::U32 Offset(TranslatorVisitor& v, u64 insn) {
}
}
+std::pair<IR::U32, IR::U32> WordOffset(TranslatorVisitor& v, u64 insn) {
+ const IR::U32 offset{Offset(v, insn)};
+ if (offset.IsImmediate()) {
+ return {v.ir.Imm32(offset.U32() / 4), offset};
+ } else {
+ return {v.ir.ShiftRightArithmetic(offset, v.ir.Imm32(2)), offset};
+ }
+}
+
std::pair<int, bool> GetSize(u64 insn) {
union {
u64 raw;
@@ -79,9 +88,7 @@ IR::U32 ShortOffset(IR::IREmitter& ir, const IR::U32& offset) {
} // Anonymous namespace
void TranslatorVisitor::LDL(u64 insn) {
- const IR::U32 offset{Offset(*this, insn)};
- const IR::U32 word_offset{ir.ShiftRightArithmetic(offset, ir.Imm32(2))};
-
+ const auto [word_offset, offset]{WordOffset(*this, insn)};
const IR::Reg dest{Reg(insn)};
const auto [bit_size, is_signed]{GetSize(insn)};
switch (bit_size) {
@@ -133,9 +140,7 @@ void TranslatorVisitor::LDS(u64 insn) {
}
void TranslatorVisitor::STL(u64 insn) {
- const IR::U32 offset{Offset(*this, insn)};
- const IR::U32 word_offset{ir.ShiftRightArithmetic(offset, ir.Imm32(2))};
-
+ const auto [word_offset, offset]{WordOffset(*this, insn)};
const IR::Reg reg{Reg(insn)};
const IR::U32 src{X(reg)};
const int bit_size{GetSize(insn).first};