GDK: Remove old shader sources, unify shader compilation .bats

main
Jade Macho 2024-03-01 15:50:57 +01:00 committed by Sam Lantinga
parent bcbede31ce
commit 23ace600fc
19 changed files with 127 additions and 693 deletions

3
.gitignore vendored
View File

@ -79,7 +79,8 @@ VisualC/tests/testscale/sample.bmp
VisualC/tests/testsprite/icon.bmp
VisualC/tests/testyuv/testyuv.bmp
VisualC-GDK/**/Layout
VisualC-GDK/shaders/*.h
src/render/direct3d12/D3D12_*_One.h
src/render/direct3d12/D3D12_*_Series.h
# for Android
android-project/local.properties

View File

@ -171,7 +171,7 @@
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir)</Command>
<Command>$(SolutionDir)..\src\render\direct3d12\compile_shaders_xbox.bat $(SolutionDir)</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox Series)</Message>
@ -205,7 +205,7 @@
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir) one</Command>
<Command>$(SolutionDir)..\src\render\direct3d12\compile_shaders_xbox.bat $(SolutionDir) one</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox One)</Message>
@ -271,7 +271,7 @@
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir)</Command>
<Command>$(SolutionDir)..\src\render\direct3d12\compile_shaders_xbox.bat $(SolutionDir)</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox Series)</Message>
@ -306,7 +306,7 @@
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
</Link>
<PreBuildEvent>
<Command>$(SolutionDir)\shaders\buildshaders.bat $(SolutionDir) one</Command>
<Command>$(SolutionDir)..\src\render\direct3d12\compile_shaders_xbox.bat $(SolutionDir) one</Command>
</PreBuildEvent>
<PreBuildEvent>
<Message>Building shader blobs (Xbox One)</Message>

View File

@ -1,19 +0,0 @@
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define ColorRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
"DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
"DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
"DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0)"
[RootSignature(ColorRS)]
float4 main(PixelShaderInput input) : SV_TARGET0
{
return input.color;
}

View File

@ -1,43 +0,0 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@ -1,43 +0,0 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@ -1,43 +0,0 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {0.0, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@ -1,43 +0,0 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@ -1,43 +0,0 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@ -1,43 +0,0 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureUV : register(t1);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(NVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {0.0, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@ -1,24 +0,0 @@
Texture2D theTexture : register(t0);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define TextureRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(TextureRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
return theTexture.Sample(theSampler, input.tex) * input.color;
}

View File

@ -1,46 +0,0 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureU : register(t1);
Texture2D theTextureV : register(t2);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define YUVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(YUVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@ -1,46 +0,0 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureU : register(t1);
Texture2D theTextureV : register(t2);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define YUVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(YUVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@ -1,46 +0,0 @@
Texture2D theTextureY : register(t0);
Texture2D theTextureU : register(t1);
Texture2D theTextureV : register(t2);
SamplerState theSampler : register(s0);
struct PixelShaderInput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define YUVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(YUVRS)]
float4 main(PixelShaderInput input) : SV_TARGET
{
const float3 offset = {0.0, -0.501960814, -0.501960814};
const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
float4 Output;
float3 yuv;
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
yuv += offset;
Output.r = dot(yuv, Rcoeff);
Output.g = dot(yuv, Gcoeff);
Output.b = dot(yuv, Bcoeff);
Output.a = 1.0f;
return Output * input.color;
}

View File

@ -1,95 +0,0 @@
#pragma pack_matrix( row_major )
struct VertexShaderConstants
{
matrix model;
matrix projectionAndView;
};
ConstantBuffer<VertexShaderConstants> Constants : register(b0);
struct VertexShaderInput
{
float3 pos : POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
struct VertexShaderOutput
{
float4 pos : SV_POSITION;
float2 tex : TEXCOORD0;
float4 color : COLOR0;
};
#define ColorRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
"DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
"DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
"DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0)"
#define TextureRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
#define YUVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
#define NVRS \
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
" DENY_HULL_SHADER_ROOT_ACCESS )," \
"RootConstants(num32BitConstants=32, b0),"\
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
[RootSignature(ColorRS)]
VertexShaderOutput mainColor(VertexShaderInput input)
{
VertexShaderOutput output;
float4 pos = float4(input.pos, 1.0f);
// Transform the vertex position into projected space.
pos = mul(pos, Constants.model);
pos = mul(pos, Constants.projectionAndView);
output.pos = pos;
// Pass through texture coordinates and color values without transformation
output.tex = input.tex;
output.color = input.color;
return output;
}
[RootSignature(TextureRS)]
VertexShaderOutput mainTexture(VertexShaderInput input)
{
return mainColor(input);
}
[RootSignature(YUVRS)]
VertexShaderOutput mainYUV(VertexShaderInput input)
{
return mainColor(input);
}
[RootSignature(NVRS)]
VertexShaderOutput mainNV(VertexShaderInput input)
{
return mainColor(input);
}

View File

@ -1,35 +0,0 @@
if %2.==one. goto setxboxone
rem Xbox Series compile
set XBOXDXC="%GameDKLatest%\GXDK\bin\Scarlett\DXC.exe"
set SUFFIX=_Series.h
goto startbuild
:setxboxone
set XBOXDXC="%GameDKLatest%\GXDK\bin\XboxOne\DXC.exe"
set SUFFIX=_One.h
:startbuild
echo Building with %XBOXDXC%
cd "%1\shaders"
rem Root Signatures
%XBOXDXC% -E ColorRS -T rootsig_1_1 -rootsig-define ColorRS -Fh D3D12_RootSig_Color%SUFFIX% -Vn D3D12_RootSig_Color D3D12_VertexShader.hlsl
%XBOXDXC% -E TextureRS -T rootsig_1_1 -rootsig-define TextureRS -Fh D3D12_RootSig_Texture%SUFFIX% -Vn D3D12_RootSig_Texture D3D12_VertexShader.hlsl
%XBOXDXC% -E YUVRS -T rootsig_1_1 -rootsig-define YUVRS -Fh D3D12_RootSig_YUV%SUFFIX% -Vn D3D12_RootSig_YUV D3D12_VertexShader.hlsl
%XBOXDXC% -E NVRS -T rootsig_1_1 -rootsig-define NVRS -Fh D3D12_RootSig_NV%SUFFIX% -Vn D3D12_RootSig_NV D3D12_VertexShader.hlsl
rem Vertex Shaders
%XBOXDXC% -E mainColor -T vs_6_0 -Fh D3D12_VertexShader_Color%SUFFIX% -Vn D3D12_VertexShader_Color D3D12_VertexShader.hlsl
%XBOXDXC% -E mainTexture -T vs_6_0 -Fh D3D12_VertexShader_Texture%SUFFIX% -Vn D3D12_VertexShader_Texture D3D12_VertexShader.hlsl
%XBOXDXC% -E mainNV -T vs_6_0 -Fh D3D12_VertexShader_NV%SUFFIX% -Vn D3D12_VertexShader_NV D3D12_VertexShader.hlsl
%XBOXDXC% -E mainYUV -T vs_6_0 -Fh D3D12_VertexShader_YUV%SUFFIX% -Vn D3D12_VertexShader_YUV D3D12_VertexShader.hlsl
rem Pixel Shaders
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_Colors%SUFFIX% -Vn D3D12_PixelShader_Colors D3D12_PixelShader_Colors.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV12_BT601%SUFFIX% -Vn D3D12_PixelShader_NV12_BT601 D3D12_PixelShader_NV12_BT601.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV12_BT709%SUFFIX% -Vn D3D12_PixelShader_NV12_BT709 D3D12_PixelShader_NV12_BT709.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV12_JPEG%SUFFIX% -Vn D3D12_PixelShader_NV12_JPEG D3D12_PixelShader_NV12_JPEG.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV21_BT601%SUFFIX% -Vn D3D12_PixelShader_NV21_BT601 D3D12_PixelShader_NV21_BT601.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV21_BT709%SUFFIX% -Vn D3D12_PixelShader_NV21_BT709 D3D12_PixelShader_NV21_BT709.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV21_JPEG%SUFFIX% -Vn D3D12_PixelShader_NV21_JPEG D3D12_PixelShader_NV21_JPEG.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_Textures%SUFFIX% -Vn D3D12_PixelShader_Textures D3D12_PixelShader_Textures.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_YUV_BT601%SUFFIX% -Vn D3D12_PixelShader_YUV_BT601 D3D12_PixelShader_YUV_BT601.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_YUV_BT709%SUFFIX% -Vn D3D12_PixelShader_YUV_BT709 D3D12_PixelShader_YUV_BT709.hlsl
%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_YUV_JPEG%SUFFIX% -Vn D3D12_PixelShader_YUV_JPEG D3D12_PixelShader_YUV_JPEG.hlsl

View File

@ -31,28 +31,46 @@
#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str
/* Shader blob headers are generated with a pre-build step using buildshaders.bat */
#include "../VisualC-GDK/shaders/D3D12_PixelShader_Colors_One.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT601_One.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT709_One.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_JPEG_One.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT601_One.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT709_One.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_JPEG_One.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_Textures_One.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT601_One.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT709_One.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_JPEG_One.h"
/* Shader blob headers are generated with a pre-build step using compile_shaders_xbox.bat */
#include "../VisualC-GDK/shaders/D3D12_VertexShader_Color_One.h"
#include "../VisualC-GDK/shaders/D3D12_VertexShader_NV_One.h"
#include "../VisualC-GDK/shaders/D3D12_VertexShader_Texture_One.h"
#include "../VisualC-GDK/shaders/D3D12_VertexShader_YUV_One.h"
#define g_main D3D12_PixelShader_Colors
#include "D3D12_PixelShader_Colors_One.h"
#undef g_main
#define g_main D3D12_PixelShader_Textures
#include "D3D12_PixelShader_Textures_One.h"
#undef g_main
#define g_main D3D12_PixelShader_Advanced
#include "D3D12_PixelShader_Advanced_One.h"
#undef g_main
#define g_mainColor D3D12_VertexShader_Colors
#include "D3D12_VertexShader_Color_One.h"
#undef g_mainColor
#define g_mainTexture D3D12_VertexShader_Textures
#include "D3D12_VertexShader_Texture_One.h"
#undef g_mainTexture
#define g_mainAdvanced D3D12_VertexShader_Advanced
#include "D3D12_VertexShader_Advanced_One.h"
#undef g_mainAdvanced
#define g_ColorRS D3D12_RootSig_Color
#include "D3D12_RootSig_Color_One.h"
#undef g_ColorRS
#define g_TextureRS D3D12_RootSig_Texture
#include "D3D12_RootSig_Texture_One.h"
#undef g_TextureRS
#define g_AdvancedRS D3D12_RootSig_Advanced
#include "D3D12_RootSig_Advanced_One.h"
#undef g_AdvancedRS
#include "../VisualC-GDK/shaders/D3D12_RootSig_Color_One.h"
#include "../VisualC-GDK/shaders/D3D12_RootSig_NV_One.h"
#include "../VisualC-GDK/shaders/D3D12_RootSig_Texture_One.h"
#include "../VisualC-GDK/shaders/D3D12_RootSig_YUV_One.h"
static struct
{
@ -63,40 +81,14 @@ static struct
D3D12_RootSignature root_sig;
} D3D12_shaders[NUM_SHADERS] = {
{ D3D12_PixelShader_Colors, sizeof(D3D12_PixelShader_Colors),
D3D12_VertexShader_Color, sizeof(D3D12_VertexShader_Color),
D3D12_VertexShader_Colors, sizeof(D3D12_VertexShader_Colors),
ROOTSIG_COLOR },
{ D3D12_PixelShader_Textures, sizeof(D3D12_PixelShader_Textures),
D3D12_VertexShader_Texture, sizeof(D3D12_VertexShader_Texture),
D3D12_VertexShader_Textures, sizeof(D3D12_VertexShader_Textures),
ROOTSIG_TEXTURE },
#if SDL_HAVE_YUV
{ D3D12_PixelShader_YUV_JPEG, sizeof(D3D12_PixelShader_YUV_JPEG),
D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV),
ROOTSIG_YUV },
{ D3D12_PixelShader_YUV_BT601, sizeof(D3D12_PixelShader_YUV_BT601),
D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV),
ROOTSIG_YUV },
{ D3D12_PixelShader_YUV_BT709, sizeof(D3D12_PixelShader_YUV_BT709),
D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV),
ROOTSIG_YUV },
{ D3D12_PixelShader_NV12_JPEG, sizeof(D3D12_PixelShader_NV12_JPEG),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
{ D3D12_PixelShader_NV12_BT601, sizeof(D3D12_PixelShader_NV12_BT601),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
{ D3D12_PixelShader_NV12_BT709, sizeof(D3D12_PixelShader_NV12_BT709),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
{ D3D12_PixelShader_NV21_JPEG, sizeof(D3D12_PixelShader_NV21_JPEG),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
{ D3D12_PixelShader_NV21_BT601, sizeof(D3D12_PixelShader_NV21_BT601),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
{ D3D12_PixelShader_NV21_BT709, sizeof(D3D12_PixelShader_NV21_BT709),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
#endif
{ D3D12_PixelShader_Advanced, sizeof(D3D12_PixelShader_Advanced),
D3D12_VertexShader_Advanced, sizeof(D3D12_VertexShader_Advanced),
ROOTSIG_ADVANCED },
};
static struct
@ -106,10 +98,7 @@ static struct
} D3D12_rootsigs[NUM_ROOTSIGS] = {
{ D3D12_RootSig_Color, sizeof(D3D12_RootSig_Color) },
{ D3D12_RootSig_Texture, sizeof(D3D12_RootSig_Texture) },
#if SDL_HAVE_YUV
{ D3D12_RootSig_YUV, sizeof(D3D12_RootSig_YUV) },
{ D3D12_RootSig_NV, sizeof(D3D12_RootSig_NV) },
#endif
{ D3D12_RootSig_Advanced, sizeof(D3D12_RootSig_Advanced) },
};
extern "C" void

View File

@ -31,28 +31,47 @@
#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str
/* Shader blob headers are generated with a pre-build step using buildshaders.bat */
#include "../VisualC-GDK/shaders/D3D12_PixelShader_Colors_Series.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_Textures_Series.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT601_Series.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT709_Series.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_JPEG_Series.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT601_Series.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT709_Series.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_JPEG_Series.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT601_Series.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT709_Series.h"
#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_JPEG_Series.h"
#include "../VisualC-GDK/shaders/D3D12_VertexShader_Color_Series.h"
#include "../VisualC-GDK/shaders/D3D12_VertexShader_Texture_Series.h"
#include "../VisualC-GDK/shaders/D3D12_VertexShader_NV_Series.h"
#include "../VisualC-GDK/shaders/D3D12_VertexShader_YUV_Series.h"
/* Shader blob headers are generated with a pre-build step using compile_shaders_xbox.bat */
#define g_main D3D12_PixelShader_Colors
#include "D3D12_PixelShader_Colors_Series.h"
#undef g_main
#define g_main D3D12_PixelShader_Textures
#include "D3D12_PixelShader_Textures_Series.h"
#undef g_main
#define g_main D3D12_PixelShader_Advanced
#include "D3D12_PixelShader_Advanced_Series.h"
#undef g_main
#define g_mainColor D3D12_VertexShader_Colors
#include "D3D12_VertexShader_Color_Series.h"
#undef g_mainColor
#define g_mainTexture D3D12_VertexShader_Textures
#include "D3D12_VertexShader_Texture_Series.h"
#undef g_mainTexture
#define g_mainAdvanced D3D12_VertexShader_Advanced
#include "D3D12_VertexShader_Advanced_Series.h"
#undef g_mainAdvanced
#define g_ColorRS D3D12_RootSig_Color
#include "D3D12_RootSig_Color_Series.h"
#undef g_ColorRS
#define g_TextureRS D3D12_RootSig_Texture
#include "D3D12_RootSig_Texture_Series.h"
#undef g_TextureRS
#define g_AdvancedRS D3D12_RootSig_Advanced
#include "D3D12_RootSig_Advanced_Series.h"
#undef g_AdvancedRS
#include "../VisualC-GDK/shaders/D3D12_RootSig_Color_Series.h"
#include "../VisualC-GDK/shaders/D3D12_RootSig_Texture_Series.h"
#include "../VisualC-GDK/shaders/D3D12_RootSig_YUV_Series.h"
#include "../VisualC-GDK/shaders/D3D12_RootSig_NV_Series.h"
static struct
{
@ -63,40 +82,14 @@ static struct
D3D12_RootSignature root_sig;
} D3D12_shaders[NUM_SHADERS] = {
{ D3D12_PixelShader_Colors, sizeof(D3D12_PixelShader_Colors),
D3D12_VertexShader_Color, sizeof(D3D12_VertexShader_Color),
D3D12_VertexShader_Colors, sizeof(D3D12_VertexShader_Colors),
ROOTSIG_COLOR },
{ D3D12_PixelShader_Textures, sizeof(D3D12_PixelShader_Textures),
D3D12_VertexShader_Texture, sizeof(D3D12_VertexShader_Texture),
D3D12_VertexShader_Textures, sizeof(D3D12_VertexShader_Textures),
ROOTSIG_TEXTURE },
#if SDL_HAVE_YUV
{ D3D12_PixelShader_YUV_JPEG, sizeof(D3D12_PixelShader_YUV_JPEG),
D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV),
ROOTSIG_YUV },
{ D3D12_PixelShader_YUV_BT601, sizeof(D3D12_PixelShader_YUV_BT601),
D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV),
ROOTSIG_YUV },
{ D3D12_PixelShader_YUV_BT709, sizeof(D3D12_PixelShader_YUV_BT709),
D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV),
ROOTSIG_YUV },
{ D3D12_PixelShader_NV12_JPEG, sizeof(D3D12_PixelShader_NV12_JPEG),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
{ D3D12_PixelShader_NV12_BT601, sizeof(D3D12_PixelShader_NV12_BT601),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
{ D3D12_PixelShader_NV12_BT709, sizeof(D3D12_PixelShader_NV12_BT709),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
{ D3D12_PixelShader_NV21_JPEG, sizeof(D3D12_PixelShader_NV21_JPEG),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
{ D3D12_PixelShader_NV21_BT601, sizeof(D3D12_PixelShader_NV21_BT601),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
{ D3D12_PixelShader_NV21_BT709, sizeof(D3D12_PixelShader_NV21_BT709),
D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV),
ROOTSIG_NV },
#endif
{ D3D12_PixelShader_Advanced, sizeof(D3D12_PixelShader_Advanced),
D3D12_VertexShader_Advanced, sizeof(D3D12_VertexShader_Advanced),
ROOTSIG_ADVANCED },
};
static struct
@ -106,10 +99,7 @@ static struct
} D3D12_rootsigs[NUM_ROOTSIGS] = {
{ D3D12_RootSig_Color, sizeof(D3D12_RootSig_Color) },
{ D3D12_RootSig_Texture, sizeof(D3D12_RootSig_Texture) },
#if SDL_HAVE_YUV
{ D3D12_RootSig_YUV, sizeof(D3D12_RootSig_YUV) },
{ D3D12_RootSig_NV, sizeof(D3D12_RootSig_NV) },
#endif
{ D3D12_RootSig_Advanced, sizeof(D3D12_RootSig_Advanced) },
};
extern "C" void

View File

@ -1,11 +1,21 @@
dxc -E main -T ps_6_0 -Fh D3D12_PixelShader_Colors.h D3D12_PixelShader_Colors.hlsl
dxc -E main -T ps_6_0 -Fh D3D12_PixelShader_Textures.h D3D12_PixelShader_Textures.hlsl
dxc -E main -T ps_6_0 -Fh D3D12_PixelShader_Advanced.h D3D12_PixelShader_Advanced.hlsl
rem This script runs for the Windows build, but also via the _xbox variant with these vars set.
rem Make sure to default to building for Windows if they're not set.
if %DXC%.==. set DXC=dxc
if %SUFFIX%.==. set SUFFIX=.h
dxc -E mainColor -T vs_6_0 -Fh D3D12_VertexShader_Color.h D3D12_VertexShader.hlsl
dxc -E mainTexture -T vs_6_0 -Fh D3D12_VertexShader_Texture.h D3D12_VertexShader.hlsl
dxc -E mainAdvanced -T vs_6_0 -Fh D3D12_VertexShader_Advanced.h D3D12_VertexShader.hlsl
echo Building with %DXC%
echo Suffix %SUFFIX%
dxc -E ColorRS -T rootsig_1_1 -rootsig-define ColorRS -Fh D3D12_RootSig_Color.h D3D12_VertexShader.hlsl
dxc -E TextureRS -T rootsig_1_1 -rootsig-define TextureRS -Fh D3D12_RootSig_Texture.h D3D12_VertexShader.hlsl
dxc -E AdvancedRS -T rootsig_1_1 -rootsig-define AdvancedRS -Fh D3D12_RootSig_Advanced.h D3D12_VertexShader.hlsl
cd "%~dp0"
%DXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_Colors%SUFFIX% D3D12_PixelShader_Colors.hlsl
%DXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_Textures%SUFFIX% D3D12_PixelShader_Textures.hlsl
%DXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_Advanced%SUFFIX% D3D12_PixelShader_Advanced.hlsl
%DXC% -E mainColor -T vs_6_0 -Fh D3D12_VertexShader_Color%SUFFIX% D3D12_VertexShader.hlsl
%DXC% -E mainTexture -T vs_6_0 -Fh D3D12_VertexShader_Texture%SUFFIX% D3D12_VertexShader.hlsl
%DXC% -E mainAdvanced -T vs_6_0 -Fh D3D12_VertexShader_Advanced%SUFFIX% D3D12_VertexShader.hlsl
%DXC% -E ColorRS -T rootsig_1_1 -rootsig-define ColorRS -Fh D3D12_RootSig_Color%SUFFIX% D3D12_VertexShader.hlsl
%DXC% -E TextureRS -T rootsig_1_1 -rootsig-define TextureRS -Fh D3D12_RootSig_Texture%SUFFIX% D3D12_VertexShader.hlsl
%DXC% -E AdvancedRS -T rootsig_1_1 -rootsig-define AdvancedRS -Fh D3D12_RootSig_Advanced%SUFFIX% D3D12_VertexShader.hlsl

View File

@ -0,0 +1,13 @@
if %2.==one. goto setxboxone
rem Xbox Series compile
set DXC="%GameDKLatest%\GXDK\bin\Scarlett\DXC.exe"
set SUFFIX=_Series.h
goto startbuild
:setxboxone
set DXC="%GameDKLatest%\GXDK\bin\XboxOne\DXC.exe"
set SUFFIX=_One.h
:startbuild
call "%~dp0\compile_shaders.bat"