diff options
| m--------- | externals/sirit | 0 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | 17 | ||||
| -rw-r--r-- | src/video_core/shader/decode/other.cpp | 5 | ||||
| -rw-r--r-- | src/video_core/shader/node.h | 1 |
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: | |||
| 2321 | return {fmt::format("readInvocationARB({}, {})", value, index), Type::Float}; | 2321 | return {fmt::format("readInvocationARB({}, {})", value, index), Type::Float}; |
| 2322 | } | 2322 | } |
| 2323 | 2323 | ||
| 2324 | Expression Barrier(Operation) { | ||
| 2325 | if (!ir.IsDecompiled()) { | ||
| 2326 | LOG_ERROR(Render_OpenGL, "barrier() used but shader is not decompiled"); | ||
| 2327 | return {}; | ||
| 2328 | } | ||
| 2329 | code.AddLine("barrier();"); | ||
| 2330 | return {}; | ||
| 2331 | } | ||
| 2332 | |||
| 2324 | Expression MemoryBarrierGL(Operation) { | 2333 | Expression MemoryBarrierGL(Operation) { |
| 2325 | code.AddLine("memoryBarrier();"); | 2334 | code.AddLine("memoryBarrier();"); |
| 2326 | return {}; | 2335 | return {}; |
| @@ -2556,6 +2565,7 @@ private: | |||
| 2556 | &GLSLDecompiler::ThreadId, | 2565 | &GLSLDecompiler::ThreadId, |
| 2557 | &GLSLDecompiler::ShuffleIndexed, | 2566 | &GLSLDecompiler::ShuffleIndexed, |
| 2558 | 2567 | ||
| 2568 | &GLSLDecompiler::Barrier, | ||
| 2559 | &GLSLDecompiler::MemoryBarrierGL, | 2569 | &GLSLDecompiler::MemoryBarrierGL, |
| 2560 | }; | 2570 | }; |
| 2561 | static_assert(operation_decompilers.size() == static_cast<std::size_t>(OperationCode::Amount)); | 2571 | 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: | |||
| 2181 | return {OpSubgroupReadInvocationKHR(t_float, value, index), Type::Float}; | 2181 | return {OpSubgroupReadInvocationKHR(t_float, value, index), Type::Float}; |
| 2182 | } | 2182 | } |
| 2183 | 2183 | ||
| 2184 | Expression Barrier(Operation) { | ||
| 2185 | if (!ir.IsDecompiled()) { | ||
| 2186 | LOG_ERROR(Render_Vulkan, "OpBarrier used by shader is not decompiled"); | ||
| 2187 | return {}; | ||
| 2188 | } | ||
| 2189 | |||
| 2190 | const auto scope = spv::Scope::Workgroup; | ||
| 2191 | const auto memory = spv::Scope::Workgroup; | ||
| 2192 | const auto semantics = | ||
| 2193 | spv::MemorySemanticsMask::WorkgroupMemory | spv::MemorySemanticsMask::AcquireRelease; | ||
| 2194 | OpControlBarrier(Constant(t_uint, static_cast<u32>(scope)), | ||
| 2195 | Constant(t_uint, static_cast<u32>(memory)), | ||
| 2196 | Constant(t_uint, static_cast<u32>(semantics))); | ||
| 2197 | return {}; | ||
| 2198 | } | ||
| 2199 | |||
| 2184 | Expression MemoryBarrierGL(Operation) { | 2200 | Expression MemoryBarrierGL(Operation) { |
| 2185 | const auto scope = spv::Scope::Device; | 2201 | const auto scope = spv::Scope::Device; |
| 2186 | const auto semantics = | 2202 | const auto semantics = |
| @@ -2641,6 +2657,7 @@ private: | |||
| 2641 | &SPIRVDecompiler::ThreadId, | 2657 | &SPIRVDecompiler::ThreadId, |
| 2642 | &SPIRVDecompiler::ShuffleIndexed, | 2658 | &SPIRVDecompiler::ShuffleIndexed, |
| 2643 | 2659 | ||
| 2660 | &SPIRVDecompiler::Barrier, | ||
| 2644 | &SPIRVDecompiler::MemoryBarrierGL, | 2661 | &SPIRVDecompiler::MemoryBarrierGL, |
| 2645 | }; | 2662 | }; |
| 2646 | static_assert(operation_decompilers.size() == static_cast<std::size_t>(OperationCode::Amount)); | 2663 | 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) { | |||
| 272 | SetRegister(bb, instr.gpr0, GetRegister(instr.gpr8)); | 272 | SetRegister(bb, instr.gpr0, GetRegister(instr.gpr8)); |
| 273 | break; | 273 | break; |
| 274 | } | 274 | } |
| 275 | case OpCode::Id::BAR: { | ||
| 276 | UNIMPLEMENTED_IF_MSG(instr.value != 0xF0A81B8000070000ULL, "BAR is not BAR.SYNC 0x0"); | ||
| 277 | bb.push_back(Operation(OperationCode::Barrier)); | ||
| 278 | break; | ||
| 279 | } | ||
| 275 | case OpCode::Id::MEMBAR: { | 280 | case OpCode::Id::MEMBAR: { |
| 276 | UNIMPLEMENTED_IF(instr.membar.type != Tegra::Shader::MembarType::GL); | 281 | UNIMPLEMENTED_IF(instr.membar.type != Tegra::Shader::MembarType::GL); |
| 277 | UNIMPLEMENTED_IF(instr.membar.unknown != Tegra::Shader::MembarUnknown::Default); | 282 | 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 { | |||
| 228 | ThreadId, /// () -> uint | 228 | ThreadId, /// () -> uint |
| 229 | ShuffleIndexed, /// (uint value, uint index) -> uint | 229 | ShuffleIndexed, /// (uint value, uint index) -> uint |
| 230 | 230 | ||
| 231 | Barrier, /// () -> void | ||
| 231 | MemoryBarrierGL, /// () -> void | 232 | MemoryBarrierGL, /// () -> void |
| 232 | 233 | ||
| 233 | Amount, | 234 | Amount, |