mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-01-18 19:28:56 -05:00
52 lines
910 B
Plaintext
52 lines
910 B
Plaintext
uniform float4x4 ViewProj;
|
|
uniform float4x4 yuv_matrix;
|
|
uniform texture2d diffuse;
|
|
|
|
sampler_state def_sampler {
|
|
Filter = Linear;
|
|
AddressU = Clamp;
|
|
AddressV = Clamp;
|
|
};
|
|
|
|
struct VertInOut {
|
|
float4 pos : POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
VertInOut VSDefault(VertInOut vert_in)
|
|
{
|
|
VertInOut vert_out;
|
|
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
|
|
vert_out.uv = vert_in.uv;
|
|
return vert_out;
|
|
}
|
|
|
|
float4 PSDrawRGB(VertInOut vert_in) : TARGET
|
|
{
|
|
return diffuse.Sample(def_sampler, vert_in.uv);
|
|
}
|
|
|
|
float4 PSDrawYUVToRGB(VertInOut vert_in) : TARGET
|
|
{
|
|
float4 yuv = diffuse.Sample(def_sampler, vert_in.uv);
|
|
return saturate(mul(float4(yuv.xyz, 1.0), yuv_matrix));
|
|
}
|
|
|
|
technique DrawRGB
|
|
{
|
|
pass
|
|
{
|
|
vertex_shader = VSDefault(vert_in);
|
|
pixel_shader = PSDrawRGB(vert_in);
|
|
}
|
|
}
|
|
|
|
technique DrawYUV
|
|
{
|
|
pass
|
|
{
|
|
vertex_shader = VSDefault(vert_in);
|
|
pixel_shader = PSDrawYUVToRGB(vert_in);
|
|
}
|
|
}
|