Atlas - D3D9_PixelShader_YUV.hlsl

Home / ext / SDL / src / render / direct3d Lines: 1 | Size: 958 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
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} 48
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.