Recombine the YUV420 shader source

We don't build shaders with hardcoded CSC constants anymore.
This commit is contained in:
Cameron Gutman
2025-11-08 11:40:06 -06:00
parent d5abf568c6
commit 1160f40655
3 changed files with 28 additions and 30 deletions

View File

@@ -1,14 +0,0 @@
min16float4 main(ShaderInput input) : SV_TARGET
{
// Clamp the chrominance texcoords to avoid sampling the row of texels adjacent to the alignment padding
min16float3 yuv = min16float3(luminancePlane.Sample(theSampler, input.tex),
chrominancePlane.Sample(theSampler, min(input.tex + chromaOffset, chromaTexMax.rg)));
// Subtract the YUV offset for limited vs full range
yuv -= offsets;
// Multiply by the conversion matrix for this colorspace
yuv = mul(yuv, cscMatrix);
return min16float4(yuv, 1.0);
}

View File

@@ -1,14 +0,0 @@
Texture2D<min16float> luminancePlane : register(t0);
Texture2D<min16float2> chrominancePlane : register(t1);
SamplerState theSampler : register(s0);
struct ShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
};
cbuffer ChromaLimitBuf : register(b0)
{
min16float3 chromaTexMax;
};

View File

@@ -1,4 +1,17 @@
#include "d3d11_video_pixel_start.hlsli"
Texture2D<min16float> luminancePlane : register(t0);
Texture2D<min16float2> chrominancePlane : register(t1);
SamplerState theSampler : register(s0);
struct ShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
};
cbuffer ChromaLimitBuf : register(b0)
{
min16float3 chromaTexMax;
};
cbuffer CSC_CONST_BUF : register(b1)
{
@@ -7,4 +20,17 @@ cbuffer CSC_CONST_BUF : register(b1)
min16float2 chromaOffset;
};
#include "d3d11_video_pixel_end.hlsli"
min16float4 main(ShaderInput input) : SV_TARGET
{
// Clamp the chrominance texcoords to avoid sampling the row of texels adjacent to the alignment padding
min16float3 yuv = min16float3(luminancePlane.Sample(theSampler, input.tex),
chrominancePlane.Sample(theSampler, min(input.tex + chromaOffset, chromaTexMax.rg)));
// Subtract the YUV offset for limited vs full range
yuv -= offsets;
// Multiply by the conversion matrix for this colorspace
yuv = mul(yuv, cscMatrix);
return min16float4(yuv, 1.0);
}