d3d12: Move root sigs to D3D12_Shader_Common.hlsli, fix mismatch
This commit is contained in:
parent
e2a8209263
commit
c74f273848
7 changed files with 44 additions and 69 deletions
|
@ -1,18 +1,7 @@
|
||||||
|
|
||||||
#include "D3D12_PixelShader_Common.incl"
|
#include "D3D12_PixelShader_Common.hlsli"
|
||||||
|
|
||||||
#define ADVANCEDRS \
|
[RootSignature(AdvancedRS)]
|
||||||
"RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \
|
|
||||||
" DENY_DOMAIN_SHADER_ROOT_ACCESS |" \
|
|
||||||
" DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \
|
|
||||||
" DENY_HULL_SHADER_ROOT_ACCESS )," \
|
|
||||||
"RootConstants(num32BitConstants=24, b1),"\
|
|
||||||
"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(ADVANCEDRS)]
|
|
||||||
float4 main(PixelShaderInput input) : SV_TARGET
|
float4 main(PixelShaderInput input) : SV_TARGET
|
||||||
{
|
{
|
||||||
return AdvancedPixelShader(input);
|
return AdvancedPixelShader(input);
|
||||||
|
|
|
@ -1,12 +1,5 @@
|
||||||
|
|
||||||
#include "D3D12_PixelShader_Common.incl"
|
#include "D3D12_PixelShader_Common.hlsli"
|
||||||
|
|
||||||
#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=24, b1)"
|
|
||||||
|
|
||||||
[RootSignature(ColorRS)]
|
[RootSignature(ColorRS)]
|
||||||
float4 main(PixelShaderInput input) : SV_TARGET0
|
float4 main(PixelShaderInput input) : SV_TARGET0
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "D3D12_Shader_Common.hlsli"
|
||||||
|
|
||||||
Texture2D texture0 : register(t0);
|
Texture2D texture0 : register(t0);
|
||||||
Texture2D texture1 : register(t1);
|
Texture2D texture1 : register(t1);
|
|
@ -1,14 +1,5 @@
|
||||||
|
|
||||||
#include "D3D12_PixelShader_Common.incl"
|
#include "D3D12_PixelShader_Common.hlsli"
|
||||||
|
|
||||||
#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=24, b1),"\
|
|
||||||
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
|
||||||
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
|
||||||
|
|
||||||
[RootSignature(TextureRS)]
|
[RootSignature(TextureRS)]
|
||||||
float4 main(PixelShaderInput input) : SV_TARGET
|
float4 main(PixelShaderInput input) : SV_TARGET
|
||||||
|
|
37
src/render/direct3d12/D3D12_Shader_Common.hlsli
Normal file
37
src/render/direct3d12/D3D12_Shader_Common.hlsli
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
#pragma pack_matrix( row_major )
|
||||||
|
|
||||||
|
cbuffer VertexShaderConstants : register(b0)
|
||||||
|
{
|
||||||
|
matrix model;
|
||||||
|
matrix projectionAndView;
|
||||||
|
};
|
||||||
|
|
||||||
|
#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)," \
|
||||||
|
"RootConstants(num32BitConstants=24, b1)"\
|
||||||
|
|
||||||
|
#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),"\
|
||||||
|
"RootConstants(num32BitConstants=24, b1),"\
|
||||||
|
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
||||||
|
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
||||||
|
|
||||||
|
#define AdvancedRS \
|
||||||
|
"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),"\
|
||||||
|
"RootConstants(num32BitConstants=24, b1),"\
|
||||||
|
"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 )"
|
|
@ -1,10 +1,4 @@
|
||||||
#pragma pack_matrix( row_major )
|
#include "D3D12_Shader_Common.hlsli"
|
||||||
|
|
||||||
cbuffer VertexShaderConstants : register(b0)
|
|
||||||
{
|
|
||||||
matrix model;
|
|
||||||
matrix projectionAndView;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct VertexShaderInput
|
struct VertexShaderInput
|
||||||
{
|
{
|
||||||
|
@ -20,36 +14,6 @@ struct VertexShaderOutput
|
||||||
float4 color : COLOR0;
|
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)," \
|
|
||||||
"RootConstants(num32BitConstants=20, b1)"\
|
|
||||||
|
|
||||||
#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),"\
|
|
||||||
"RootConstants(num32BitConstants=20, b1),"\
|
|
||||||
"DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\
|
|
||||||
"DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )"
|
|
||||||
|
|
||||||
#define AdvancedRS \
|
|
||||||
"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),"\
|
|
||||||
"RootConstants(num32BitConstants=20, b1),"\
|
|
||||||
"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(ColorRS)]
|
[RootSignature(ColorRS)]
|
||||||
VertexShaderOutput mainColor(VertexShaderInput input)
|
VertexShaderOutput mainColor(VertexShaderInput input)
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,7 +90,7 @@ typedef struct
|
||||||
Float4X4 projectionAndView;
|
Float4X4 projectionAndView;
|
||||||
} VertexShaderConstants;
|
} VertexShaderConstants;
|
||||||
|
|
||||||
/* These should mirror the definitions in D3D12_PixelShader_Common.incl */
|
/* These should mirror the definitions in D3D12_PixelShader_Common.hlsli */
|
||||||
//static const float TONEMAP_NONE = 0;
|
//static const float TONEMAP_NONE = 0;
|
||||||
//static const float TONEMAP_LINEAR = 1;
|
//static const float TONEMAP_LINEAR = 1;
|
||||||
static const float TONEMAP_CHROME = 2;
|
static const float TONEMAP_CHROME = 2;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue