summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-05-15 07:24:42 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-05-22 04:20:43 +0200
commit5d0986a53be495f2a2158968db1bc0974f0dd0d3 (patch)
tree76b89957701a3e8cec21211b0090f8517b9338af
parentMerge pull request #3926 from ogniK5377/keyboard-states (diff)
downloadyuzu-5d0986a53be495f2a2158968db1bc0974f0dd0d3.tar
yuzu-5d0986a53be495f2a2158968db1bc0974f0dd0d3.tar.gz
yuzu-5d0986a53be495f2a2158968db1bc0974f0dd0d3.tar.bz2
yuzu-5d0986a53be495f2a2158968db1bc0974f0dd0d3.tar.lz
yuzu-5d0986a53be495f2a2158968db1bc0974f0dd0d3.tar.xz
yuzu-5d0986a53be495f2a2158968db1bc0974f0dd0d3.tar.zst
yuzu-5d0986a53be495f2a2158968db1bc0974f0dd0d3.zip
m---------externals/sirit0
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp10
-rw-r--r--src/video_core/renderer_vulkan/vk_shader_decompiler.cpp17
-rw-r--r--src/video_core/shader/decode/other.cpp5
-rw-r--r--src/video_core/shader/node.h1
5 files changed, 33 insertions, 0 deletions
diff --git a/externals/sirit b/externals/sirit
-Subproject 414fc4dbd28d8fe48f735a0c389db8a234f733c
+Subproject a62c5bbc100a5e5a31ea0ccc4a78d8fa6a4167c
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 960ebf1a1..6804758f7 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -2321,6 +2321,15 @@ private:
return {fmt::format("readInvocationARB({}, {})", value, index), Type::Float};
}
+ Expression Barrier(Operation) {
+ if (!ir.IsDecompiled()) {
+ LOG_ERROR(Render_OpenGL, "barrier() used but shader is not decompiled");
+ return {};
+ }
+ code.AddLine("barrier();");
+ return {};
+ }
+
Expression MemoryBarrierGL(Operation) {
code.AddLine("memoryBarrier();");
return {};
@@ -2556,6 +2565,7 @@ private:
&GLSLDecompiler::ThreadId,
&GLSLDecompiler::ShuffleIndexed,
+ &GLSLDecompiler::Barrier,
&GLSLDecompiler::MemoryBarrierGL,
};
static_assert(operation_decompilers.size() == static_cast<std::size_t>(OperationCode::Amount));
diff --git a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
index 167e20e91..78963901c 100644
--- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
+++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp
@@ -2181,6 +2181,22 @@ private:
return {OpSubgroupReadInvocationKHR(t_float, value, index), Type::Float};
}
+ Expression Barrier(Operation) {
+ if (!ir.IsDecompiled()) {
+ LOG_ERROR(Render_Vulkan, "OpBarrier used by shader is not decompiled");
+ return {};
+ }
+
+ const auto scope = spv::Scope::Workgroup;
+ const auto memory = spv::Scope::Workgroup;
+ const auto semantics =
+ spv::MemorySemanticsMask::WorkgroupMemory | spv::MemorySemanticsMask::AcquireRelease;
+ OpControlBarrier(Constant(t_uint, static_cast<u32>(scope)),
+ Constant(t_uint, static_cast<u32>(memory)),
+ Constant(t_uint, static_cast<u32>(semantics)));
+ return {};
+ }
+
Expression MemoryBarrierGL(Operation) {
const auto scope = spv::Scope::Device;
const auto semantics =
@@ -2641,6 +2657,7 @@ private:
&SPIRVDecompiler::ThreadId,
&SPIRVDecompiler::ShuffleIndexed,
+ &SPIRVDecompiler::Barrier,
&SPIRVDecompiler::MemoryBarrierGL,
};
static_assert(operation_decompilers.size() == static_cast<std::size_t>(OperationCode::Amount));
diff --git a/src/video_core/shader/decode/other.cpp b/src/video_core/shader/decode/other.cpp
index d4f95b18c..82ec7bb6f 100644
--- a/src/video_core/shader/decode/other.cpp
+++ b/src/video_core/shader/decode/other.cpp
@@ -272,6 +272,11 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) {
SetRegister(bb, instr.gpr0, GetRegister(instr.gpr8));
break;
}
+ case OpCode::Id::BAR: {
+ UNIMPLEMENTED_IF_MSG(instr.value != 0xF0A81B8000070000ULL, "BAR is not BAR.SYNC 0x0");
+ bb.push_back(Operation(OperationCode::Barrier));
+ break;
+ }
case OpCode::Id::MEMBAR: {
UNIMPLEMENTED_IF(instr.membar.type != Tegra::Shader::MembarType::GL);
UNIMPLEMENTED_IF(instr.membar.unknown != Tegra::Shader::MembarUnknown::Default);
diff --git a/src/video_core/shader/node.h b/src/video_core/shader/node.h
index f75b62240..80aa69295 100644
--- a/src/video_core/shader/node.h
+++ b/src/video_core/shader/node.h
@@ -228,6 +228,7 @@ enum class OperationCode {
ThreadId, /// () -> uint
ShuffleIndexed, /// (uint value, uint index) -> uint
+ Barrier, /// () -> void
MemoryBarrierGL, /// () -> void
Amount,