diff options
Diffstat (limited to 'system')
-rw-r--r-- | system/shaders/output_d3d.fx | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/system/shaders/output_d3d.fx b/system/shaders/output_d3d.fx index a3f73412f8..eebc200a19 100644 --- a/system/shaders/output_d3d.fx +++ b/system/shaders/output_d3d.fx @@ -96,16 +96,13 @@ float3 inversePQ(float3 x) } #endif #if defined(KODI_HLG_TO_PQ) -float inverseHLG(float x) +float3 inverseHLG(float3 x) { const float B67_a = 0.17883277f; const float B67_b = 0.28466892f; const float B67_c = 0.55991073f; const float B67_inv_r2 = 4.0f; - if (x <= 0.5f) - x = x * x * B67_inv_r2; - else - x = exp((x - B67_c) / B67_a) + B67_b; + x = (x <= 0.5f) ? x * x * B67_inv_r2 : exp((x - B67_c) / B67_a) + B67_b; return x; } @@ -139,9 +136,7 @@ float4 output4(float4 color, float2 uv) color.rgb = pow(color.rgb, 1.0f / 2.2f); #endif #if defined(KODI_HLG_TO_PQ) - color.r = inverseHLG(color.r); - color.g = inverseHLG(color.g); - color.b = inverseHLG(color.b); + color.rgb = inverseHLG(color.rgb); float3 ootf_2020 = float3(0.2627f, 0.6780f, 0.0593f); float ootf_ys = 2000.0f * dot(ootf_2020, color.rgb); color.rgb *= pow(ootf_ys, 0.2f); @@ -169,6 +164,13 @@ float4 output(float3 color, float2 uv) #if defined(KODI_OUTPUT_T) #include "convolution_d3d.fx" + +#if (defined(KODI_TONE_MAPPING_ACES) || defined(KODI_TONE_MAPPING_HABLE) || defined(KODI_HLG_TO_PQ)) +#define PS_PROFILE ps_4_0_level_9_3 +#else +#define PS_PROFILE ps_4_0_level_9_1 +#endif + float3 m_params; // 0 - range (0 - full, 1 - limited), 1 - contrast, 2 - brightness float4 OUTPUT_PS(VS_OUTPUT In) : SV_TARGET @@ -189,7 +191,7 @@ technique11 OUTPUT_T pass P0 { SetVertexShader( VS_SHADER ); - SetPixelShader( CompileShader( ps_4_0_level_9_3, OUTPUT_PS() ) ); + SetPixelShader( CompileShader( PS_PROFILE, OUTPUT_PS() ) ); } }; #endif
\ No newline at end of file |