summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-04-12 05:06:55 -0300
committerGravatar ReinUsesLisp2020-04-12 05:06:55 -0300
commit75eb953575b99da5657c1d1e5fe0605782b30e35 (patch)
tree6060859516ef00557d053480173412e97ea6e808
parentMerge pull request #3635 from FernandoS27/buffer-free (diff)
downloadyuzu-75eb953575b99da5657c1d1e5fe0605782b30e35.tar.gz
yuzu-75eb953575b99da5657c1d1e5fe0605782b30e35.tar.xz
yuzu-75eb953575b99da5657c1d1e5fe0605782b30e35.zip
gl_shader_decompiler: Improve generated code in HMergeH*
Avoiding bitwise expressions, this fixes Turing issues in shaders using half float merges that affected several games.
-rw-r--r--src/video_core/renderer_opengl/gl_shader_decompiler.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
index 160ae4340..59bbd1211 100644
--- a/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_decompiler.cpp
@@ -1819,15 +1819,17 @@ private:
1819 } 1819 }
1820 1820
1821 Expression HMergeH0(Operation operation) { 1821 Expression HMergeH0(Operation operation) {
1822 std::string dest = VisitOperand(operation, 0).AsUint(); 1822 const std::string dest = VisitOperand(operation, 0).AsUint();
1823 std::string src = VisitOperand(operation, 1).AsUint(); 1823 const std::string src = VisitOperand(operation, 1).AsUint();
1824 return {fmt::format("(({} & 0x0000FFFFU) | ({} & 0xFFFF0000U))", src, dest), Type::Uint}; 1824 return {fmt::format("vec2(unpackHalf2x16({}).x, unpackHalf2x16({}).y)", src, dest),
1825 Type::HalfFloat};
1825 } 1826 }
1826 1827
1827 Expression HMergeH1(Operation operation) { 1828 Expression HMergeH1(Operation operation) {
1828 std::string dest = VisitOperand(operation, 0).AsUint(); 1829 const std::string dest = VisitOperand(operation, 0).AsUint();
1829 std::string src = VisitOperand(operation, 1).AsUint(); 1830 const std::string src = VisitOperand(operation, 1).AsUint();
1830 return {fmt::format("(({} & 0x0000FFFFU) | ({} & 0xFFFF0000U))", dest, src), Type::Uint}; 1831 return {fmt::format("vec2(unpackHalf2x16({}).x, unpackHalf2x16({}).y)", dest, src),
1832 Type::HalfFloat};
1831 } 1833 }
1832 1834
1833 Expression HPack2(Operation operation) { 1835 Expression HPack2(Operation operation) {