diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-11-03 03:44:46 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-11-08 00:08:41 +0100 |
commit | 56e237d1f998a4090afb6763222cd65593b299d7 (patch) | |
tree | b40d10b0b12b210e5b9ddf28324267bf210f9fd7 /src/video_core/renderer_opengl | |
parent | gl_shader_decompiler: Reimplement shuffles with platform agnostic intrinsics (diff) | |
download | yuzu-56e237d1f998a4090afb6763222cd65593b299d7.tar yuzu-56e237d1f998a4090afb6763222cd65593b299d7.tar.gz yuzu-56e237d1f998a4090afb6763222cd65593b299d7.tar.bz2 yuzu-56e237d1f998a4090afb6763222cd65593b299d7.tar.lz yuzu-56e237d1f998a4090afb6763222cd65593b299d7.tar.xz yuzu-56e237d1f998a4090afb6763222cd65593b299d7.tar.zst yuzu-56e237d1f998a4090afb6763222cd65593b299d7.zip |
Diffstat (limited to 'src/video_core/renderer_opengl')
-rw-r--r-- | src/video_core/renderer_opengl/gl_shader_decompiler.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp index ca4e6e468..21c137ec5 100644 --- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp +++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp @@ -1379,6 +1379,20 @@ private: return GenerateUnary(operation, "float", Type::Float, type); } + Expression FSwizzleAdd(Operation operation) { + const std::string op_a = VisitOperand(operation, 0).AsFloat(); + const std::string op_b = VisitOperand(operation, 1).AsFloat(); + const std::string instr_mask = VisitOperand(operation, 2).AsUint(); + + const std::string mask = code.GenerateTemporary(); + code.AddLine("uint {} = {} >> ((gl_SubGroupInvocationARB & 3) << 1);", mask, instr_mask); + + const std::string modifier_a = fmt::format("fswzadd_modifiers_a[{} & 3]", mask); + const std::string modifier_b = fmt::format("fswzadd_modifiers_b[{} & 3]", mask); + return {fmt::format("(({} * {}) + ({} * {}))", op_a, modifier_a, op_b, modifier_b), + Type::Float}; + } + Expression ICastFloat(Operation operation) { return GenerateUnary(operation, "int", Type::Int, Type::Float); } @@ -1991,6 +2005,7 @@ private: &GLSLDecompiler::FTrunc, &GLSLDecompiler::FCastInteger<Type::Int>, &GLSLDecompiler::FCastInteger<Type::Uint>, + &GLSLDecompiler::FSwizzleAdd, &GLSLDecompiler::Add<Type::Int>, &GLSLDecompiler::Mul<Type::Int>, @@ -2460,6 +2475,9 @@ bvec2 HalfFloatNanComparison(bvec2 comparison, vec2 pair1, vec2 pair2) { bvec2 is_nan2 = isnan(pair2); return bvec2(comparison.x || is_nan1.x || is_nan2.x, comparison.y || is_nan1.y || is_nan2.y); } + +const float fswzadd_modifiers_a[] = float[4](-1.0f, 1.0f, -1.0f, 0.0f ); +const float fswzadd_modifiers_b[] = float[4](-1.0f, -1.0f, 1.0f, -1.0f ); )"; } |