aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorthexai <58434170+thexai@users.noreply.github.com>2022-10-04 09:31:13 +0200
committerthexai <58434170+thexai@users.noreply.github.com>2022-10-04 09:31:13 +0200
commit614ebb5b76bde7c89d923f96f33943d2d820310e (patch)
tree4e4476fd25e3098578a826893f9d719a3ab8d32d /system
parent05c9e1f137fb62ab927060125c87b41e5a02ecb4 (diff)
[Windows] Adds new setting to set the GUI peak luminance when the display is in HDR PQ mode
Diffstat (limited to 'system')
-rwxr-xr-xsystem/settings/settings.xml11
-rw-r--r--system/shaders/guishader_common.hlsl4
2 files changed, 13 insertions, 2 deletions
diff --git a/system/settings/settings.xml b/system/settings/settings.xml
index 572d300de7..1b998bcc66 100755
--- a/system/settings/settings.xml
+++ b/system/settings/settings.xml
@@ -2591,6 +2591,17 @@
</constraints>
<control type="spinner" format="string" />
</setting>
+ <setting id="videoscreen.guisdrpeakluminance" type="integer" label="36097" help="36547">
+ <requirement>HAS_DX</requirement>
+ <dependencies>
+ <dependency type="visible">
+ <condition on="property" name="ishdrdisplay" />
+ </dependency>
+ </dependencies>
+ <level>2</level>
+ <default>60</default>
+ <control type="slider" format="percentage" range="0,100" />
+ </setting>
<setting id="videoscreen.10bitsurfaces" type="integer" label="36098" help="36578">
<requirement>HAS_DX</requirement>
<level>3</level>
diff --git a/system/shaders/guishader_common.hlsl b/system/shaders/guishader_common.hlsl
index 1d8fa10e56..0dd01c5476 100644
--- a/system/shaders/guishader_common.hlsl
+++ b/system/shaders/guishader_common.hlsl
@@ -47,6 +47,7 @@ cbuffer cbWorld : register(b0)
float4x4 worldViewProj;
float blackLevel;
float colorRange;
+ float sdrPeakLum;
int PQ;
};
@@ -57,7 +58,6 @@ inline float3 transferPQ(float3 x)
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;
- static const float SDR_peak_lum = 100.0f;
static const float3x3 matx =
{
0.627402, 0.329292, 0.043306,
@@ -69,7 +69,7 @@ inline float3 transferPQ(float3 x)
// REC.709 to BT.2020
x = mul(matx, x);
// linear to PQ
- x = pow(x / SDR_peak_lum, ST2084_m1);
+ x = pow(x / sdrPeakLum, ST2084_m1);
x = (ST2084_c1 + ST2084_c2 * x) / (1.0f + ST2084_c3 * x);
x = pow(x, ST2084_m2);
return x;