aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorthexai <58434170+thexai@users.noreply.github.com>2020-11-08 09:49:49 +0100
committerthexai <58434170+thexai@users.noreply.github.com>2020-11-08 09:55:27 +0100
commit298b265d4990cc826cabbc62c53e4d45d993fe20 (patch)
tree626b6cf331c67eb4c3ac123e6c6273379e9cdb0c /system
parent306145723ecad9b60e81837ad3d681762bdb8384 (diff)
Tone mapping: small fixes and clean up
Diffstat (limited to 'system')
-rw-r--r--system/shaders/output_d3d.fx16
1 files changed, 7 insertions, 9 deletions
diff --git a/system/shaders/output_d3d.fx b/system/shaders/output_d3d.fx
index 6a251b0723..9e4f250850 100644
--- a/system/shaders/output_d3d.fx
+++ b/system/shaders/output_d3d.fx
@@ -42,16 +42,15 @@ SamplerState DitherSampler : IMMUTABLE
};
#endif
#if (defined(KODI_TONE_MAPPING_ACES) || defined(KODI_TONE_MAPPING_HABLE) || defined(KODI_HLG_TO_PQ))
-const float ST2084_m1 = 2610.0f / (4096.0f * 4.0f);
-const float ST2084_m2 = (2523.0f / 4096.0f) * 128.0f;
-const float ST2084_c1 = 3424.0f / 4096.0f;
-const float ST2084_c2 = (2413.0f / 4096.0f) * 32.0f;
-const float ST2084_c3 = (2392.0f / 4096.0f) * 32.0f;
+static const float ST2084_m1 = 2610.0f / (4096.0f * 4.0f);
+static const float ST2084_m2 = (2523.0f / 4096.0f) * 128.0f;
+static const float ST2084_c1 = 3424.0f / 4096.0f;
+static const float ST2084_c2 = (2413.0f / 4096.0f) * 32.0f;
+static const float ST2084_c3 = (2392.0f / 4096.0f) * 32.0f;
#endif
#if defined(KODI_TONE_MAPPING_REINHARD)
float g_toneP1;
float3 g_coefsDst;
-float g_luminance;
float reinhard(float x)
{
@@ -73,8 +72,8 @@ float3 aces(float3 x)
}
#endif
#if defined(KODI_TONE_MAPPING_HABLE)
-float g_luminance;
float g_toneP1;
+float g_toneP2;
float3 hable(float3 x)
{
@@ -136,8 +135,7 @@ float4 output4(float4 color, float2 uv)
#if defined(KODI_TONE_MAPPING_HABLE)
color.rgb = inversePQ(color.rgb);
color.rgb *= g_toneP1;
- float wp = g_luminance / 100.0f;
- color.rgb = hable(color.rgb * wp) / hable(wp);
+ color.rgb = hable(color.rgb * g_toneP2) / hable(g_toneP2);
color.rgb = pow(color.rgb, 1.0f / 2.2f);
#endif
#if defined(KODI_HLG_TO_PQ)