mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2025-07-03 08:15:37 +00:00
Use FP16 in the D3D11 shaders
This commit is contained in:
parent
b96cb1abaf
commit
b21131a466
Binary file not shown.
@ -1,13 +1,13 @@
|
|||||||
Texture2D theTexture : register(t0);
|
Texture2D<min16float4> theTexture : register(t0);
|
||||||
SamplerState theSampler : register(s0);
|
SamplerState theSampler : register(s0);
|
||||||
|
|
||||||
struct ShaderInput
|
struct ShaderInput
|
||||||
{
|
{
|
||||||
float4 pos : SV_POSITION;
|
min16float4 pos : SV_POSITION;
|
||||||
float2 tex : TEXCOORD0;
|
min16float2 tex : TEXCOORD0;
|
||||||
};
|
};
|
||||||
|
|
||||||
float4 main(ShaderInput input) : SV_TARGET
|
min16float4 main(ShaderInput input) : SV_TARGET
|
||||||
{
|
{
|
||||||
return theTexture.Sample(theSampler, input.tex);
|
return theTexture.Sample(theSampler, input.tex);
|
||||||
}
|
}
|
Binary file not shown.
@ -1,19 +1,19 @@
|
|||||||
struct ShaderInput
|
struct ShaderInput
|
||||||
{
|
{
|
||||||
float2 pos : POSITION;
|
min16float2 pos : POSITION;
|
||||||
float2 tex : TEXCOORD0;
|
min16float2 tex : TEXCOORD0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ShaderOutput
|
struct ShaderOutput
|
||||||
{
|
{
|
||||||
float4 pos : SV_POSITION;
|
min16float4 pos : SV_POSITION;
|
||||||
float2 tex : TEXCOORD0;
|
min16float2 tex : TEXCOORD0;
|
||||||
};
|
};
|
||||||
|
|
||||||
ShaderOutput main(ShaderInput input)
|
ShaderOutput main(ShaderInput input)
|
||||||
{
|
{
|
||||||
ShaderOutput output;
|
ShaderOutput output;
|
||||||
output.pos = float4(input.pos, 0.0f, 1.0f);
|
output.pos = min16float4(input.pos, 0.0, 1.0);
|
||||||
output.tex = input.tex;
|
output.tex = input.tex;
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
Binary file not shown.
@ -1,24 +1,23 @@
|
|||||||
Texture2D luminancePlane : register(t0);
|
Texture2D<min16float> luminancePlane : register(t0);
|
||||||
Texture2D chrominancePlane : register(t1);
|
Texture2D<min16float2> chrominancePlane : register(t1);
|
||||||
SamplerState theSampler : register(s0);
|
SamplerState theSampler : register(s0);
|
||||||
|
|
||||||
cbuffer CSC_CONST_BUF : register(b0)
|
cbuffer CSC_CONST_BUF : register(b0)
|
||||||
{
|
{
|
||||||
float3x3 cscMatrix;
|
min16float3x3 cscMatrix;
|
||||||
float3 offsets;
|
min16float3 offsets;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ShaderInput
|
struct ShaderInput
|
||||||
{
|
{
|
||||||
float4 pos : SV_POSITION;
|
min16float4 pos : SV_POSITION;
|
||||||
float2 tex : TEXCOORD0;
|
min16float2 tex : TEXCOORD0;
|
||||||
};
|
};
|
||||||
|
|
||||||
min16float4 main(ShaderInput input) : SV_TARGET
|
min16float4 main(ShaderInput input) : SV_TARGET
|
||||||
{
|
{
|
||||||
float y = luminancePlane.Sample(theSampler, input.tex);
|
min16float3 yuv = min16float3(luminancePlane.Sample(theSampler, input.tex),
|
||||||
float2 uv = chrominancePlane.Sample(theSampler, input.tex);
|
chrominancePlane.Sample(theSampler, input.tex));
|
||||||
float3 yuv = float3(y, uv);
|
|
||||||
|
|
||||||
// Subtract the YUV offset for limited vs full range
|
// Subtract the YUV offset for limited vs full range
|
||||||
yuv -= offsets;
|
yuv -= offsets;
|
||||||
@ -26,5 +25,5 @@ min16float4 main(ShaderInput input) : SV_TARGET
|
|||||||
// Multiply by the conversion matrix for this colorspace
|
// Multiply by the conversion matrix for this colorspace
|
||||||
yuv = mul(yuv, cscMatrix);
|
yuv = mul(yuv, cscMatrix);
|
||||||
|
|
||||||
return min16float4(saturate(yuv), 1.0f);
|
return min16float4(saturate(yuv), 1.0);
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user