summaryrefslogtreecommitdiff
path: root/src/shader_recompiler/frontend/maxwell
diff options
context:
space:
mode:
authorGravatar FernandoS272021-04-02 19:27:30 +0200
committerGravatar ameerj2021-07-22 21:51:26 -0400
commit655f7a570a10218ffb2ed175bb7f0b84530ccae0 (patch)
treebb95bc316718bd5c746a0b28084b3548a4aea222 /src/shader_recompiler/frontend/maxwell
parentshader: Improve VOTE.VTG stub (diff)
downloadyuzu-655f7a570a10218ffb2ed175bb7f0b84530ccae0.tar.gz
yuzu-655f7a570a10218ffb2ed175bb7f0b84530ccae0.tar.xz
yuzu-655f7a570a10218ffb2ed175bb7f0b84530ccae0.zip
shader: Implement MEMBAR
Diffstat (limited to 'src/shader_recompiler/frontend/maxwell')
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/barrier_operations.cpp56
-rw-r--r--src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp11
2 files changed, 56 insertions, 11 deletions
diff --git a/src/shader_recompiler/frontend/maxwell/translate/impl/barrier_operations.cpp b/src/shader_recompiler/frontend/maxwell/translate/impl/barrier_operations.cpp
new file mode 100644
index 000000000..933af572c
--- /dev/null
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/barrier_operations.cpp
@@ -0,0 +1,56 @@
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/ir/modifiers.h"
8#include "shader_recompiler/frontend/maxwell/translate/impl/impl.h"
9#include "shader_recompiler/frontend/maxwell/opcodes.h"
10
11namespace Shader::Maxwell {
12namespace {
13// Seems to be in CUDA terminology.
14enum class LocalScope : u64 {
15 CTG = 0,
16 GL = 1,
17 SYS = 2,
18 VC = 3,
19};
20
21IR::MemoryScope LocalScopeToMemoryScope(LocalScope scope) {
22 switch (scope) {
23 case LocalScope::CTG:
24 return IR::MemoryScope::Warp;
25 case LocalScope::GL:
26 return IR::MemoryScope::Device;
27 case LocalScope::SYS:
28 return IR::MemoryScope::System;
29 case LocalScope::VC:
30 return IR::MemoryScope::Workgroup; // or should be device?
31 default:
32 throw NotImplementedException("Unimplemented Local Scope {}", scope);
33 }
34}
35
36} // namespace
37
38void TranslatorVisitor::MEMBAR(u64 inst) {
39 union {
40 u64 raw;
41 BitField<8, 2, LocalScope> scope;
42 } membar{inst};
43 IR::BarrierInstInfo info{};
44 info.scope.Assign(LocalScopeToMemoryScope(membar.scope));
45 ir.MemoryBarrier(info);
46}
47
48void TranslatorVisitor::DEPBAR() {
49 // DEPBAR is a no-op
50}
51
52void TranslatorVisitor::BAR(u64) {
53 throw NotImplementedException("Instruction {} is not implemented", Opcode::BAR);
54}
55
56} // 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 83ed0c0fd..80a6ed578 100644
--- a/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
+++ b/src/shader_recompiler/frontend/maxwell/translate/impl/not_implemented.cpp
@@ -37,10 +37,6 @@ void TranslatorVisitor::B2R(u64) {
37 ThrowNotImplemented(Opcode::B2R); 37 ThrowNotImplemented(Opcode::B2R);
38} 38}
39 39
40void TranslatorVisitor::BAR(u64) {
41 ThrowNotImplemented(Opcode::BAR);
42}
43
44void TranslatorVisitor::BPT(u64) { 40void TranslatorVisitor::BPT(u64) {
45 ThrowNotImplemented(Opcode::BPT); 41 ThrowNotImplemented(Opcode::BPT);
46} 42}
@@ -73,9 +69,6 @@ void TranslatorVisitor::CS2R(u64) {
73 ThrowNotImplemented(Opcode::CS2R); 69 ThrowNotImplemented(Opcode::CS2R);
74} 70}
75 71
76void TranslatorVisitor::DEPBAR() {
77 // DEPBAR is a no-op
78}
79 72
80void TranslatorVisitor::FCHK_reg(u64) { 73void TranslatorVisitor::FCHK_reg(u64) {
81 ThrowNotImplemented(Opcode::FCHK_reg); 74 ThrowNotImplemented(Opcode::FCHK_reg);
@@ -189,10 +182,6 @@ void TranslatorVisitor::LONGJMP(u64) {
189 ThrowNotImplemented(Opcode::LONGJMP); 182 ThrowNotImplemented(Opcode::LONGJMP);
190} 183}
191 184
192void TranslatorVisitor::MEMBAR(u64) {
193 ThrowNotImplemented(Opcode::MEMBAR);
194}
195
196void TranslatorVisitor::NOP(u64) { 185void TranslatorVisitor::NOP(u64) {
197 ThrowNotImplemented(Opcode::NOP); 186 ThrowNotImplemented(Opcode::NOP);
198} 187}