From 3185245845f7487c3b832035b0c19fdc4f1a8262 Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Mon, 6 Apr 2020 02:24:47 -0300 Subject: 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. --- .../renderer_opengl/gl_shader_decompiler.cpp | 24 ++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/video_core/renderer_opengl') 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: return {}; } return {fmt::format("atomic{}({}, {})", opname, Visit(operation[0]).GetCode(), - Visit(operation[1]).As(type)), - type}; + Visit(operation[1]).AsUint()), + Type::Uint}; + } + + template + Expression Reduce(Operation operation) { + code.AddLine("{};", Atomic(operation).GetCode()); + return {}; } Expression Branch(Operation operation) { @@ -2479,6 +2485,20 @@ private: &GLSLDecompiler::Atomic, &GLSLDecompiler::Atomic, + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Reduce, + + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Reduce, + &GLSLDecompiler::Branch, &GLSLDecompiler::BranchIndirect, &GLSLDecompiler::PushFlowStack, -- cgit v1.2.3