summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar FernandoS272021-04-04 02:42:58 +0200
committerGravatar ameerj2021-07-22 21:51:26 -0400
commit0df7e509db060693ee1f131bae44045db995c3bd (patch)
tree44ccf52e42241cf85299abbed77398e479e2b900
parentshader: Fix BRX tracking (diff)
downloadyuzu-0df7e509db060693ee1f131bae44045db995c3bd.tar.gz
yuzu-0df7e509db060693ee1f131bae44045db995c3bd.tar.xz
yuzu-0df7e509db060693ee1f131bae44045db995c3bd.zip
shader: Implement AL2P
Diffstat (limited to '')
-rw-r--r--src/shader_recompiler/CMakeLists.txt1
-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
3 files changed, 36 insertions, 4 deletions
diff --git a/src/shader_recompiler/CMakeLists.txt b/src/shader_recompiler/CMakeLists.txt
index 700b17113..22639fe13 100644
--- a/src/shader_recompiler/CMakeLists.txt
+++ b/src/shader_recompiler/CMakeLists.txt
@@ -65,6 +65,7 @@ add_library(shader_recompiler STATIC
65 frontend/maxwell/program.h 65 frontend/maxwell/program.h
66 frontend/maxwell/structured_control_flow.cpp 66 frontend/maxwell/structured_control_flow.cpp
67 frontend/maxwell/structured_control_flow.h 67 frontend/maxwell/structured_control_flow.h
68 frontend/maxwell/translate/impl/attribute_memory_to_physical.cpp
68 frontend/maxwell/translate/impl/barrier_operations.cpp 69 frontend/maxwell/translate/impl/barrier_operations.cpp
69 frontend/maxwell/translate/impl/bitfield_extract.cpp 70 frontend/maxwell/translate/impl/bitfield_extract.cpp
70 frontend/maxwell/translate/impl/bitfield_insert.cpp 71 frontend/maxwell/translate/impl/bitfield_insert.cpp
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 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "common/bit_field.h"
6#include "common/common_types.h"
7#include "shader_recompiler/frontend/maxwell/opcodes.h"
8#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
9
10namespace Shader::Maxwell {
11
12enum class BitSize : u64 {
13 B32,
14 B64,
15 B96,
16 B128,
17};
18
19void TranslatorVisitor::AL2P(u64 inst) {
20 union {
21 u64 raw;
22 BitField<0, 8, IR::Reg> result_register;
23 BitField<8, 8, IR::Reg> indexing_register;
24 BitField<20, 11, s64> offset;
25 BitField<47, 2, BitSize> bitsize;
26 } al2p{inst};
27 if (al2p.bitsize != BitSize::B32) {
28 throw NotImplementedException("BitSize {}", al2p.bitsize.Value());
29 }
30 const IR::U32 converted_offset{ir.Imm32(static_cast<u32>(al2p.offset.Value()))};
31 const IR::U32 result{ir.IAdd(X(al2p.indexing_register), converted_offset)};
32 X(al2p.result_register, result);
33}
34
35} // 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 {
13 throw NotImplementedException("Instruction {} is not implemented", opcode); 13 throw NotImplementedException("Instruction {} is not implemented", opcode);
14} 14}
15 15
16void TranslatorVisitor::AL2P(u64) {
17 ThrowNotImplemented(Opcode::AL2P);
18}
19
20void TranslatorVisitor::ATOM_cas(u64) { 16void TranslatorVisitor::ATOM_cas(u64) {
21 ThrowNotImplemented(Opcode::ATOM_cas); 17 ThrowNotImplemented(Opcode::ATOM_cas);
22} 18}