summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend/maxwell/translate
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2022-03-18 00:36:31 +0100
committerGitHub <noreply@github.com>2022-03-18 00:36:31 +0100
commitcb86e7941b87c28491114c80cf2cd3cafd316c72 (patch)
treeecd031fac28e0bfe9c2d10855c74e01379654a4f /src/shader_recompiler/frontend/maxwell/translate
parentMerge pull request #8030 from liamwhite/s8d24-conversion (diff)
parentAddress review comments (diff)
downloadyuzu-cb86e7941b87c28491114c80cf2cd3cafd316c72.tar
yuzu-cb86e7941b87c28491114c80cf2cd3cafd316c72.tar.gz
yuzu-cb86e7941b87c28491114c80cf2cd3cafd316c72.tar.bz2
yuzu-cb86e7941b87c28491114c80cf2cd3cafd316c72.tar.lz
yuzu-cb86e7941b87c28491114c80cf2cd3cafd316c72.tar.xz
yuzu-cb86e7941b87c28491114c80cf2cd3cafd316c72.tar.zst
yuzu-cb86e7941b87c28491114c80cf2cd3cafd316c72.zip
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell/translate')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/load_constant.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/load_constant.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/load_constant.cpp
index 2300088e3..8007a4d46 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/load_constant.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/load_constant.cpp
@@ -11,10 +11,20 @@ namespace Shader::Maxwell {
using namespace LDC;
namespace {
std::pair<IR::U32, IR::U32> Slot(IR::IREmitter& ir, Mode mode, const IR::U32& imm_index,
- const IR::U32& reg, const IR::U32& imm) {
+ const IR::U32& reg, const IR::U32& imm_offset) {
switch (mode) {
case Mode::Default:
- return {imm_index, ir.IAdd(reg, imm)};
+ return {imm_index, ir.IAdd(reg, imm_offset)};
+ case Mode::IS: {
+ // Segmented addressing mode
+ // Ra+imm_offset points into a flat mapping of const buffer
+ // address space
+ const IR::U32 address{ir.IAdd(reg, imm_offset)};
+ const IR::U32 index{ir.BitFieldExtract(address, ir.Imm32(16), ir.Imm32(16))};
+ const IR::U32 offset{ir.BitFieldExtract(address, ir.Imm32(0), ir.Imm32(16))};
+
+ return {ir.IAdd(index, imm_index), offset};
+ }
default:
break;
}