summaryrefslogtreecommitdiffstats
path: root/src/shader_recompiler/frontend/maxwell
diff options
context:
space:
mode:
authorFernandoS27 <fsahmkow27@gmail.com>2021-04-04 02:42:58 +0200
committerameerj <52414509+ameerj@users.noreply.github.com>2021-07-23 03:51:26 +0200
commit0df7e509db060693ee1f131bae44045db995c3bd (patch)
tree44ccf52e42241cf85299abbed77398e479e2b900 /src/shader_recompiler/frontend/maxwell
parentshader: Fix BRX tracking (diff)
downloadyuzu-0df7e509db060693ee1f131bae44045db995c3bd.tar
yuzu-0df7e509db060693ee1f131bae44045db995c3bd.tar.gz
yuzu-0df7e509db060693ee1f131bae44045db995c3bd.tar.bz2
yuzu-0df7e509db060693ee1f131bae44045db995c3bd.tar.lz
yuzu-0df7e509db060693ee1f131bae44045db995c3bd.tar.xz
yuzu-0df7e509db060693ee1f131bae44045db995c3bd.tar.zst
yuzu-0df7e509db060693ee1f131bae44045db995c3bd.zip
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/attribute_memory_to_physical.cpp35
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp4
2 files changed, 35 insertions, 4 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/attribute_memory_to_physical.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/attribute_memory_to_physical.cpp
new file mode 100644
index 000000000..fb3f00d3f
--- /dev/null
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/attribute_memory_to_physical.cpp
@@ -0,0 +1,35 @@
+// Copyright 2021 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#include "common/bit_field.h"
+#include "common/common_types.h"
+#include "shader_recompiler/frontend/maxwell/opcodes.h"
+#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
+
+namespace Shader::Maxwell {
+
+enum class BitSize : u64 {
+ B32,
+ B64,
+ B96,
+ B128,
+};
+
+void TranslatorVisitor::AL2P(u64 inst) {
+ union {
+ u64 raw;
+ BitField<0, 8, IR::Reg> result_register;
+ BitField<8, 8, IR::Reg> indexing_register;
+ BitField<20, 11, s64> offset;
+ BitField<47, 2, BitSize> bitsize;
+ } al2p{inst};
+ if (al2p.bitsize != BitSize::B32) {
+ throw NotImplementedException("BitSize {}", al2p.bitsize.Value());
+ }
+ const IR::U32 converted_offset{ir.Imm32(static_cast<u32>(al2p.offset.Value()))};
+ const IR::U32 result{ir.IAdd(X(al2p.indexing_register), converted_offset)};
+ X(al2p.result_register, result);
+}
+
+} // namespace Shader::Maxwell
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
index acabb0118..ba0cfa673 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
@@ -13,10 +13,6 @@ namespace Shader::Maxwell {
throw NotImplementedException("Instruction {} is not implemented", opcode);
}
-void TranslatorVisitor::AL2P(u64) {
- ThrowNotImplemented(Opcode::AL2P);
-}
-
void TranslatorVisitor::ATOM_cas(u64) {
ThrowNotImplemented(Opcode::ATOM_cas);
}