sunshine-sdk/src_assets/windows/assets/shaders/directx/ConvertYPS.hlsl
Cameron Gutman 65268212ee Saturate RGB values in non-PQ shaders to improve SDR streams of HDR displays
This avoids color shift caused by RGB values > 1.0f.
2023-04-06 22:37:05 -05:00

25 lines
495 B
HLSL

Texture2D image : register(t0);
SamplerState def_sampler : register(s0);
cbuffer ColorMatrix : register(b0) {
float4 color_vec_y;
float4 color_vec_u;
float4 color_vec_v;
float2 range_y;
float2 range_uv;
};
struct PS_INPUT
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD;
};
float main_ps(PS_INPUT frag_in) : SV_Target
{
float3 rgb = saturate(image.Sample(def_sampler, frag_in.tex, 0)).rgb;
float y = dot(color_vec_y.xyz, rgb) + color_vec_y.w;
return y * range_y.x + range_y.y;
}