Warning, /graphics/krita/3rdparty/ext_qt/0009-Fix-Rec2020-display-format.patch is written in an unsupported language. File is not indexed.

0001 From 1f6fda5a721c37d86b116ba773687a9f2d9d72f2 Mon Sep 17 00:00:00 2001
0002 From: Dmitry Kazakov <dimula73@gmail.com>
0003 Date: Mon, 10 Feb 2020 16:37:43 +0300
0004 Subject: [PATCH 19/47] Fix Rec2020 display format
0005 
0006 This commit contains changes to smpte shader to fix the black screen
0007 in Rec2020 display format on Windows.
0008 Before this commit it was broken because of two things:
0009 - r=pow(x, y) in ANGLE is compiled into t=log(x); t=t*y; r=e^t
0010 which in case of 0 resulted in undefined behaviour, in this case...
0011 alpha = 1.0, even though the line was: pow(0, 1), qhich means
0012 the correct result should be 0.0, not 1.0.
0013 - changed order of painting UI and canvas; before it was first UI,
0014 then canvas. After the order was reversed, so the 0.0 alpha started
0015 to be crucial for canvas to be shown from underneath the UI.
0016 
0017 Change-Id: Ia46c36d16680ea1f03aca102565a9b181e6f5eb4
0018 ---
0019  src/gui/opengl/qopengltextureblitter.cpp | 22 +++++++++++++---------
0020  1 file changed, 13 insertions(+), 9 deletions(-)
0021 
0022 diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp
0023 index 8b9142a0ef..15d4a6e0af 100644
0024 --- a/src/gui/opengl/qopengltextureblitter.cpp
0025 +++ b/src/gui/opengl/qopengltextureblitter.cpp
0026 @@ -164,14 +164,16 @@ static const char fragment_shader[] =
0027      "#if defined SRGB_TO_BT2020PQ || defined SCRGB_TO_BT2020PQ\n"
0028      "highp vec4 applySmpte2084Curve(highp vec4 L)\n"
0029      "{"
0030 -    "   const highp vec2 m1 = vec2(2610.0 / 4096.0 / 4.0, 1.0);\n"
0031 -    "   const highp vec2 m2 = vec2(2523.0 / 4096.0 * 128.0, 1.0);\n"
0032 -    "   const highp vec2 a1 = vec2(3424.0 / 4096.0, 0.0);\n"
0033 -    "   const highp vec2 c2 = vec2(2413.0 / 4096.0 * 32.0, 1.0);\n"
0034 -    "   const highp vec2 c3 = vec2(2392.0 / 4096.0 * 32.0, 1.0);\n"
0035 -    "   const highp vec2 a4 = vec2(1.0, 0.0);\n"
0036 -    "   highp vec4 Lp = pow(L, m1.xxxy);\n"
0037 -    "   highp vec4 res = pow((a1.xxxy + c2.xxxy * Lp) / (a4.xxxy + c3.xxxy * Lp), m2.xxxy);\n"
0038 +       "   highp float oldAlpha = L.a;\n"
0039 +       "   const highp vec4 m1 = vec4(2610.0 / 4096.0 / 4.0);\n"
0040 +    "   const highp vec4 m2 = vec4(2523.0 / 4096.0 * 128.0);\n"
0041 +    "   const highp vec4 a1 = vec4(3424.0 / 4096.0);\n"
0042 +    "   const highp vec4 c2 = vec4(2413.0 / 4096.0 * 32.0);\n"
0043 +    "   const highp vec4 c3 = vec4(2392.0 / 4096.0 * 32.0);\n"
0044 +    "   const highp vec4 a4 = vec4(1.0);\n"
0045 +    "   highp vec4 Lp = pow(L, m1);\n"
0046 +    "   highp vec4 res = pow((a1 + c2 * Lp) / (a4 + c3 * Lp), m2);\n"
0047 +       "   res.a = oldAlpha;\n"
0048      "   return res;"
0049      "}\n"
0050      "#endif\n"
0051 @@ -185,7 +187,9 @@ static const char fragment_shader[] =
0052      "           0.0,      0.0,      0.0,      1.0);"
0053      ""
0054      "   value = convMat * value;\n"
0055 -    "   return applySmpte2084Curve(0.008 * value);"
0056 +       "   const highp vec4 whitePointScale = vec4(0.008, 0.008, 0.008, 1.0);\n"
0057 +       "   highp vec4 result = applySmpte2084Curve(whitePointScale * value);\n"
0058 +       "   return result;\n"
0059      "}\n"
0060      "#endif\n"
0061      "#if defined SRGB_TO_BT2020PQ\n"
0062 -- 
0063 2.20.1.windows.1
0064