summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2019-08-21 16:27:57 +0200
committerGitHub <noreply@github.com>2019-08-21 16:27:57 +0200
commitcedc1aab4a9973590678fa1e094bb032c51c5959 (patch)
tree7fafb56c7d53c20a60dc835f258875ccc0cd1859 /src/video_core/renderer_opengl/gl_shader_decompiler.cpp
parentMerge pull request #2773 from lioncash/test-unused (diff)
parentShader_Ir: Implement F16 Variants of F2F, F2I, I2F. (diff)
downloadyuzu-cedc1aab4a9973590678fa1e094bb032c51c5959.tar
yuzu-cedc1aab4a9973590678fa1e094bb032c51c5959.tar.gz
yuzu-cedc1aab4a9973590678fa1e094bb032c51c5959.tar.bz2
yuzu-cedc1aab4a9973590678fa1e094bb032c51c5959.tar.lz
yuzu-cedc1aab4a9973590678fa1e094bb032c51c5959.tar.xz
yuzu-cedc1aab4a9973590678fa1e094bb032c51c5959.tar.zst
yuzu-cedc1aab4a9973590678fa1e094bb032c51c5959.zip
Diffstat (limited to 'src/video_core/renderer_opengl/gl_shader_decompiler.cpp')
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp18
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 ffe26b241..d8f722c26 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -1136,6 +1136,16 @@ private:
Type::Float);
}
+ std::string FCastHalf0(Operation operation) {
+ const std::string op_a = VisitOperand(operation, 0, Type::HalfFloat);
+ return fmt::format("({})[0]", op_a);
+ }
+
+ std::string FCastHalf1(Operation operation) {
+ const std::string op_a = VisitOperand(operation, 0, Type::HalfFloat);
+ return fmt::format("({})[1]", op_a);
+ }
+
template <Type type>
std::string Min(Operation operation) {
return GenerateBinaryCall(operation, "min", type, type, type);
@@ -1292,6 +1302,11 @@ private:
return ApplyPrecise(operation, BitwiseCastResult(clamped, Type::HalfFloat));
}
+ std::string HCastFloat(Operation operation) {
+ const std::string op_a = VisitOperand(operation, 0, Type::Float);
+ return fmt::format("fromHalf2(vec2({}, 0.0f))", op_a);
+ }
+
std::string HUnpack(Operation operation) {
const std::string operand{VisitOperand(operation, 0, Type::HalfFloat)};
const auto value = [&]() -> std::string {
@@ -1732,6 +1747,8 @@ private:
&GLSLDecompiler::Negate<Type::Float>,
&GLSLDecompiler::Absolute<Type::Float>,
&GLSLDecompiler::FClamp,
+ &GLSLDecompiler::FCastHalf0,
+ &GLSLDecompiler::FCastHalf1,
&GLSLDecompiler::Min<Type::Float>,
&GLSLDecompiler::Max<Type::Float>,
&GLSLDecompiler::FCos,
@@ -1792,6 +1809,7 @@ private:
&GLSLDecompiler::Absolute<Type::HalfFloat>,
&GLSLDecompiler::HNegate,
&GLSLDecompiler::HClamp,
+ &GLSLDecompiler::HCastFloat,
&GLSLDecompiler::HUnpack,
&GLSLDecompiler::HMergeF32,
&GLSLDecompiler::HMergeH0,