diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl')
| -rw-r--r-- | contrib/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl | 47 |
1 files changed, 47 insertions, 0 deletions
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 @@ | |||
| 1 | |||
| 2 | Texture2D theTextureY : register(t0); | ||
| 3 | Texture2D theTextureU : register(t1); | ||
| 4 | Texture2D theTextureV : register(t2); | ||
| 5 | |||
| 6 | SamplerState theSampler = sampler_state | ||
| 7 | { | ||
| 8 | addressU = Clamp; | ||
| 9 | addressV = Clamp; | ||
| 10 | mipfilter = NONE; | ||
| 11 | minfilter = LINEAR; | ||
| 12 | magfilter = LINEAR; | ||
| 13 | }; | ||
| 14 | |||
| 15 | struct PixelShaderInput | ||
| 16 | { | ||
| 17 | float4 pos : SV_POSITION; | ||
| 18 | float2 tex : TEXCOORD0; | ||
| 19 | float4 color : COLOR0; | ||
| 20 | }; | ||
| 21 | |||
| 22 | cbuffer Constants : register(b0) | ||
| 23 | { | ||
| 24 | float4 Yoffset; | ||
| 25 | float4 Rcoeff; | ||
| 26 | float4 Gcoeff; | ||
| 27 | float4 Bcoeff; | ||
| 28 | }; | ||
| 29 | |||
| 30 | |||
| 31 | float4 main(PixelShaderInput input) : SV_TARGET | ||
| 32 | { | ||
| 33 | float4 Output; | ||
| 34 | |||
| 35 | float3 yuv; | ||
| 36 | yuv.x = theTextureY.Sample(theSampler, input.tex).r; | ||
| 37 | yuv.y = theTextureU.Sample(theSampler, input.tex).r; | ||
| 38 | yuv.z = theTextureV.Sample(theSampler, input.tex).r; | ||
| 39 | |||
| 40 | yuv += Yoffset.xyz; | ||
| 41 | Output.r = dot(yuv, Rcoeff.xyz); | ||
| 42 | Output.g = dot(yuv, Gcoeff.xyz); | ||
| 43 | Output.b = dot(yuv, Bcoeff.xyz); | ||
| 44 | Output.a = 1.0f; | ||
| 45 | |||
| 46 | return Output * input.color; | ||
| 47 | } | ||
