diff options
| author | 2020-05-26 14:40:13 -0400 | |
|---|---|---|
| committer | 2020-05-26 14:40:13 -0400 | |
| commit | 508242c2671713239c66461125696db1a69bd163 (patch) | |
| tree | 07d495dd12545f1860a83f099c288b9637e76e67 | |
| parent | Merge pull request #3980 from ReinUsesLisp/red-op (diff) | |
| parent | shader/other: Implement BAR.SYNC 0x0 (diff) | |
| download | yuzu-508242c2671713239c66461125696db1a69bd163.tar.gz yuzu-508242c2671713239c66461125696db1a69bd163.tar.xz yuzu-508242c2671713239c66461125696db1a69bd163.zip | |
Merge pull request #3981 from ReinUsesLisp/bar
shader/other: Implement BAR.SYNC 0x0
| 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 84ca830f4..253484968 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -2335,6 +2335,15 @@ private: | |||
| 2335 | return {fmt::format("readInvocationARB({}, {})", value, index), Type::Float}; | 2335 | return {fmt::format("readInvocationARB({}, {})", value, index), Type::Float}; |
| 2336 | } | 2336 | } |
| 2337 | 2337 | ||
| 2338 | Expression Barrier(Operation) { | ||
| 2339 | if (!ir.IsDecompiled()) { | ||
| 2340 | LOG_ERROR(Render_OpenGL, "barrier() used but shader is not decompiled"); | ||
| 2341 | return {}; | ||
| 2342 | } | ||
| 2343 | code.AddLine("barrier();"); | ||
| 2344 | return {}; | ||
| 2345 | } | ||
| 2346 | |||
| 2338 | Expression MemoryBarrierGL(Operation) { | 2347 | Expression MemoryBarrierGL(Operation) { |
| 2339 | code.AddLine("memoryBarrier();"); | 2348 | code.AddLine("memoryBarrier();"); |
| 2340 | return {}; | 2349 | return {}; |
| @@ -2581,6 +2590,7 @@ private: | |||
| 2581 | &GLSLDecompiler::ThreadMask<Func::Lt>, | 2590 | &GLSLDecompiler::ThreadMask<Func::Lt>, |
| 2582 | &GLSLDecompiler::ShuffleIndexed, | 2591 | &GLSLDecompiler::ShuffleIndexed, |
| 2583 | 2592 | ||
| 2593 | &GLSLDecompiler::Barrier, | ||
| 2584 | &GLSLDecompiler::MemoryBarrierGL, | 2594 | &GLSLDecompiler::MemoryBarrierGL, |
| 2585 | }; | 2595 | }; |
| 2586 | static_assert(operation_decompilers.size() == static_cast<std::size_t>(OperationCode::Amount)); | 2596 | 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 b8169d832..890f34a2c 100644 --- a/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp +++ b/src/video_core/renderer_vulkan/vk_shader_decompiler.cpp | |||
| @@ -2199,6 +2199,22 @@ private: | |||
| 2199 | return {OpSubgroupReadInvocationKHR(t_float, value, index), Type::Float}; | 2199 | return {OpSubgroupReadInvocationKHR(t_float, value, index), Type::Float}; |
| 2200 | } | 2200 | } |
| 2201 | 2201 | ||
| 2202 | Expression Barrier(Operation) { | ||
| 2203 | if (!ir.IsDecompiled()) { | ||
| 2204 | LOG_ERROR(Render_Vulkan, "OpBarrier used by shader is not decompiled"); | ||
| 2205 | return {}; | ||
| 2206 | } | ||
| 2207 | |||
| 2208 | const auto scope = spv::Scope::Workgroup; | ||
| 2209 | const auto memory = spv::Scope::Workgroup; | ||
| 2210 | const auto semantics = | ||
| 2211 | spv::MemorySemanticsMask::WorkgroupMemory | spv::MemorySemanticsMask::AcquireRelease; | ||
| 2212 | OpControlBarrier(Constant(t_uint, static_cast<u32>(scope)), | ||
| 2213 | Constant(t_uint, static_cast<u32>(memory)), | ||
| 2214 | Constant(t_uint, static_cast<u32>(semantics))); | ||
| 2215 | return {}; | ||
| 2216 | } | ||
| 2217 | |||
| 2202 | Expression MemoryBarrierGL(Operation) { | 2218 | Expression MemoryBarrierGL(Operation) { |
| 2203 | const auto scope = spv::Scope::Device; | 2219 | const auto scope = spv::Scope::Device; |
| 2204 | const auto semantics = | 2220 | const auto semantics = |
| @@ -2664,6 +2680,7 @@ private: | |||
| 2664 | &SPIRVDecompiler::ThreadMask<4>, // Lt | 2680 | &SPIRVDecompiler::ThreadMask<4>, // Lt |
| 2665 | &SPIRVDecompiler::ShuffleIndexed, | 2681 | &SPIRVDecompiler::ShuffleIndexed, |
| 2666 | 2682 | ||
| 2683 | &SPIRVDecompiler::Barrier, | ||
| 2667 | &SPIRVDecompiler::MemoryBarrierGL, | 2684 | &SPIRVDecompiler::MemoryBarrierGL, |
| 2668 | }; | 2685 | }; |
| 2669 | static_assert(operation_decompilers.size() == static_cast<std::size_t>(OperationCode::Amount)); | 2686 | 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 399a455c4..694b325e1 100644 --- a/src/video_core/shader/decode/other.cpp +++ b/src/video_core/shader/decode/other.cpp | |||
| @@ -293,6 +293,11 @@ u32 ShaderIR::DecodeOther(NodeBlock& bb, u32 pc) { | |||
| 293 | SetRegister(bb, instr.gpr0, GetRegister(instr.gpr8)); | 293 | SetRegister(bb, instr.gpr0, GetRegister(instr.gpr8)); |
| 294 | break; | 294 | break; |
| 295 | } | 295 | } |
| 296 | case OpCode::Id::BAR: { | ||
| 297 | UNIMPLEMENTED_IF_MSG(instr.value != 0xF0A81B8000070000ULL, "BAR is not BAR.SYNC 0x0"); | ||
| 298 | bb.push_back(Operation(OperationCode::Barrier)); | ||
| 299 | break; | ||
| 300 | } | ||
| 296 | case OpCode::Id::MEMBAR: { | 301 | case OpCode::Id::MEMBAR: { |
| 297 | UNIMPLEMENTED_IF(instr.membar.type != Tegra::Shader::MembarType::GL); | 302 | UNIMPLEMENTED_IF(instr.membar.type != Tegra::Shader::MembarType::GL); |
| 298 | UNIMPLEMENTED_IF(instr.membar.unknown != Tegra::Shader::MembarUnknown::Default); | 303 | 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 cce8aeebe..c06512413 100644 --- a/src/video_core/shader/node.h +++ b/src/video_core/shader/node.h | |||
| @@ -233,6 +233,7 @@ enum class OperationCode { | |||
| 233 | ThreadLtMask, /// () -> uint | 233 | ThreadLtMask, /// () -> uint |
| 234 | ShuffleIndexed, /// (uint value, uint index) -> uint | 234 | ShuffleIndexed, /// (uint value, uint index) -> uint |
| 235 | 235 | ||
| 236 | Barrier, /// () -> void | ||
| 236 | MemoryBarrierGL, /// () -> void | 237 | MemoryBarrierGL, /// () -> void |
| 237 | 238 | ||
| 238 | Amount, | 239 | Amount, |