diff options
| author | 2020-04-06 02:24:47 -0300 | |
|---|---|---|
| committer | 2020-04-06 02:24:47 -0300 | |
| commit | 3185245845f7487c3b832035b0c19fdc4f1a8262 (patch) | |
| tree | c002fb721c5db8fc5f035bbf218e423b8d982f85 /src/video_core/renderer_opengl | |
| parent | shader/memory: Add "using std::move" (diff) | |
| download | yuzu-3185245845f7487c3b832035b0c19fdc4f1a8262.tar.gz yuzu-3185245845f7487c3b832035b0c19fdc4f1a8262.tar.xz yuzu-3185245845f7487c3b832035b0c19fdc4f1a8262.zip | |
shader/memory: Implement RED.E.ADD
Implements a reduction operation. It's an atomic operation that doesn't
return a value.
This commit introduces another primitive because some shading languages
might have a primitive for reduction operations.
Diffstat (limited to 'src/video_core/renderer_opengl')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index c7d24cf14..a25280a47 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp | |||
| @@ -2119,8 +2119,14 @@ private: | |||
| 2119 | return {}; | 2119 | return {}; |
| 2120 | } | 2120 | } |
| 2121 | return {fmt::format("atomic{}({}, {})", opname, Visit(operation[0]).GetCode(), | 2121 | return {fmt::format("atomic{}({}, {})", opname, Visit(operation[0]).GetCode(), |
| 2122 | Visit(operation[1]).As(type)), | 2122 | Visit(operation[1]).AsUint()), |
| 2123 | type}; | 2123 | Type::Uint}; |
| 2124 | } | ||
| 2125 | |||
| 2126 | template <const std::string_view& opname, Type type> | ||
| 2127 | Expression Reduce(Operation operation) { | ||
| 2128 | code.AddLine("{};", Atomic<opname, type>(operation).GetCode()); | ||
| 2129 | return {}; | ||
| 2124 | } | 2130 | } |
| 2125 | 2131 | ||
| 2126 | Expression Branch(Operation operation) { | 2132 | Expression Branch(Operation operation) { |
| @@ -2479,6 +2485,20 @@ private: | |||
| 2479 | &GLSLDecompiler::Atomic<Func::Or, Type::Int>, | 2485 | &GLSLDecompiler::Atomic<Func::Or, Type::Int>, |
| 2480 | &GLSLDecompiler::Atomic<Func::Xor, Type::Int>, | 2486 | &GLSLDecompiler::Atomic<Func::Xor, Type::Int>, |
| 2481 | 2487 | ||
| 2488 | &GLSLDecompiler::Reduce<Func::Add, Type::Uint>, | ||
| 2489 | &GLSLDecompiler::Reduce<Func::Min, Type::Uint>, | ||
| 2490 | &GLSLDecompiler::Reduce<Func::Max, Type::Uint>, | ||
| 2491 | &GLSLDecompiler::Reduce<Func::And, Type::Uint>, | ||
| 2492 | &GLSLDecompiler::Reduce<Func::Or, Type::Uint>, | ||
| 2493 | &GLSLDecompiler::Reduce<Func::Xor, Type::Uint>, | ||
| 2494 | |||
| 2495 | &GLSLDecompiler::Reduce<Func::Add, Type::Int>, | ||
| 2496 | &GLSLDecompiler::Reduce<Func::Min, Type::Int>, | ||
| 2497 | &GLSLDecompiler::Reduce<Func::Max, Type::Int>, | ||
| 2498 | &GLSLDecompiler::Reduce<Func::And, Type::Int>, | ||
| 2499 | &GLSLDecompiler::Reduce<Func::Or, Type::Int>, | ||
| 2500 | &GLSLDecompiler::Reduce<Func::Xor, Type::Int>, | ||
| 2501 | |||
| 2482 | &GLSLDecompiler::Branch, | 2502 | &GLSLDecompiler::Branch, |
| 2483 | &GLSLDecompiler::BranchIndirect, | 2503 | &GLSLDecompiler::BranchIndirect, |
| 2484 | &GLSLDecompiler::PushFlowStack, | 2504 | &GLSLDecompiler::PushFlowStack, |