summaryrefslogtreecommitdiff
path: root/SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl
diff options
context:
space:
mode:
author3gg <3gg@shellblade.net>2026-03-06 13:26:57 -0800
committer3gg <3gg@shellblade.net>2026-03-06 13:26:57 -0800
commitf5c89b3bd5d74849757fd5b4d1a300068522a3ca (patch)
treed6f6e4c81745b393d7594b334710f30c0b2df3bd /SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl
Initial commitHEADmain
Diffstat (limited to 'SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl')
-rw-r--r--SDL-3.2.8/src/render/direct3d/D3D9_PixelShader_YUV.hlsl47
1 files changed, 47 insertions, 0 deletions
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 @@
1
2Texture2D theTextureY : register(t0);
3Texture2D theTextureU : register(t1);
4Texture2D theTextureV : register(t2);
5
6SamplerState theSampler = sampler_state
7{
8 addressU = Clamp;
9 addressV = Clamp;
10 mipfilter = NONE;
11 minfilter = LINEAR;
12 magfilter = LINEAR;
13};
14
15struct PixelShaderInput
16{
17 float4 pos : SV_POSITION;
18 float2 tex : TEXCOORD0;
19 float4 color : COLOR0;
20};
21
22cbuffer Constants : register(b0)
23{
24 float4 Yoffset;
25 float4 Rcoeff;
26 float4 Gcoeff;
27 float4 Bcoeff;
28};
29
30
31float4 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}