mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-06-07 11:13:15 +00:00
video_out: HDR support (#2381)
* Initial HDR support * fix for crashes when debug tools used
This commit is contained in:
parent
fb0871dbc8
commit
8f2883a388
16 changed files with 186 additions and 16 deletions
|
@ -10,16 +10,23 @@ layout (binding = 0) uniform sampler2D texSampler;
|
|||
|
||||
layout(push_constant) uniform settings {
|
||||
float gamma;
|
||||
bool hdr;
|
||||
} pp;
|
||||
|
||||
const float cutoff = 0.0031308, a = 1.055, b = 0.055, d = 12.92;
|
||||
vec3 gamma(vec3 rgb)
|
||||
{
|
||||
return mix(a * pow(rgb, vec3(1.0 / (2.4 + 1.0 - pp.gamma))) - b, d * rgb / pp.gamma, lessThan(rgb, vec3(cutoff)));
|
||||
vec3 gamma(vec3 rgb) {
|
||||
return mix(
|
||||
a * pow(rgb, vec3(1.0 / (2.4 + 1.0 - pp.gamma))) - b,
|
||||
d * rgb / pp.gamma,
|
||||
lessThan(rgb, vec3(cutoff))
|
||||
);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
void main() {
|
||||
vec4 color_linear = texture(texSampler, uv);
|
||||
color = vec4(gamma(color_linear.rgb), color_linear.a);
|
||||
if (pp.hdr) {
|
||||
color = color_linear;
|
||||
} else {
|
||||
color = vec4(gamma(color_linear.rgb), color_linear.a);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue