Sunshine/assets/shaders/ConvertYPS.hlsl

25 lines
493 B
HLSL
Raw Normal View History

2021-05-02 20:35:19 +00:00
Texture2D image : register(t0);
SamplerState def_sampler : register(s0);
2021-05-03 20:06:55 +00:00
cbuffer ColorMatrix : register(b0) {
float4 color_vec_y;
float4 color_vec_u;
float4 color_vec_v;
2021-05-08 10:03:58 +00:00
float2 range_y;
float2 range_uv;
2021-05-03 20:06:55 +00:00
};
2021-05-02 20:35:19 +00:00
struct PS_INPUT
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD;
};
2021-05-06 10:00:39 +00:00
float main_ps(PS_INPUT frag_in) : SV_Target
2021-05-02 20:35:19 +00:00
{
float3 rgb = image.Sample(def_sampler, frag_in.tex, 0).rgb;
2021-05-08 10:03:58 +00:00
float y = dot(color_vec_y.xyz, rgb);
2021-05-03 20:06:55 +00:00
2021-05-08 10:03:58 +00:00
return y * range_y.x + range_y.y;
2021-05-02 20:35:19 +00:00
}