From f5c89b3bd5d74849757fd5b4d1a300068522a3ca Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Fri, 6 Mar 2026 13:26:57 -0800 Subject: Initial commit --- .../src/render/direct3d/D3D9_PixelShader_YUV.hlsl | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl (limited to 'SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl') diff --git a/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl b/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl new file mode 100644 index 0000000..8804848 --- /dev/null +++ b/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