Skip to content

Commit 1160f40

Browse files
committed
Recombine the YUV420 shader source
We don't build shaders with hardcoded CSC constants anymore.
1 parent d5abf56 commit 1160f40

3 files changed

Lines changed: 28 additions & 30 deletions

File tree

app/shaders/d3d11_video_pixel_end.hlsli

Lines changed: 0 additions & 14 deletions
This file was deleted.

app/shaders/d3d11_video_pixel_start.hlsli

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
#include "d3d11_video_pixel_start.hlsli"
1+
Texture2D<min16float> luminancePlane : register(t0);
2+
Texture2D<min16float2> chrominancePlane : register(t1);
3+
SamplerState theSampler : register(s0);
4+
5+
struct ShaderInput
6+
{
7+
float4 pos : SV_POSITION;
8+
float2 tex : TEXCOORD0;
9+
};
10+
11+
cbuffer ChromaLimitBuf : register(b0)
12+
{
13+
min16float3 chromaTexMax;
14+
};
215

316
cbuffer CSC_CONST_BUF : register(b1)
417
{
@@ -7,4 +20,17 @@ cbuffer CSC_CONST_BUF : register(b1)
720
min16float2 chromaOffset;
821
};
922

10-
#include "d3d11_video_pixel_end.hlsli"
23+
min16float4 main(ShaderInput input) : SV_TARGET
24+
{
25+
// Clamp the chrominance texcoords to avoid sampling the row of texels adjacent to the alignment padding
26+
min16float3 yuv = min16float3(luminancePlane.Sample(theSampler, input.tex),
27+
chrominancePlane.Sample(theSampler, min(input.tex + chromaOffset, chromaTexMax.rg)));
28+
29+
// Subtract the YUV offset for limited vs full range
30+
yuv -= offsets;
31+
32+
// Multiply by the conversion matrix for this colorspace
33+
yuv = mul(yuv, cscMatrix);
34+
35+
return min16float4(yuv, 1.0);
36+
}

0 commit comments

Comments
 (0)