From 5a079a2d114f96d4847d1ee305d5b7c16eeec50e Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 27 Dec 2025 12:03:39 -0800 Subject: Initial commit --- .../src/render/direct3d/D3D9_PixelShader_YUV.hlsl | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 contrib/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl (limited to 'contrib/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl') diff --git a/contrib/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl b/contrib/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl new file mode 100644 index 0000000..8804848 --- /dev/null +++ b/contrib/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl @@ -0,0 +1,47 @@ + +Texture2D theTextureY : register(t0); +Texture2D theTextureU : register(t1); +Texture2D theTextureV : register(t2); + +SamplerState theSampler = sampler_state +{ + addressU = Clamp; + addressV = Clamp; + mipfilter = NONE; + minfilter = LINEAR; + magfilter = LINEAR; +}; + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +cbuffer Constants : register(b0) +{ + float4 Yoffset; + float4 Rcoeff; + float4 Gcoeff; + float4 Bcoeff; +}; + + +float4 main(PixelShaderInput input) : SV_TARGET +{ + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += Yoffset.xyz; + Output.r = dot(yuv, Rcoeff.xyz); + Output.g = dot(yuv, Gcoeff.xyz); + Output.b = dot(yuv, Bcoeff.xyz); + Output.a = 1.0f; + + return Output * input.color; +} -- cgit v1.2.3