Update ShaderRecomp submodule.

This commit is contained in:
Skyth 2024-10-25 17:31:43 +03:00
parent c2d0128226
commit edc1eeead6
4 changed files with 53 additions and 46 deletions

View file

@ -1,36 +1,52 @@
#include "../../../thirdparty/ShaderRecomp/ShaderRecomp/shader_common.hlsli"
CONSTANT_BUFFER(VertexShaderConstants, b0)
#ifdef __spirv__
#define fZmin vk::RawBufferLoad<float>(g_PushConstants.PixelShaderConstants + 0)
#define fZmax vk::RawBufferLoad<float>(g_PushConstants.PixelShaderConstants + 16)
#define Tex0_ResourceDescriptorIndex vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 0)
#define Tex1_ResourceDescriptorIndex vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 4)
#define Tex2_ResourceDescriptorIndex vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 8)
#define Tex3_ResourceDescriptorIndex vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 12)
#define Tex4_ResourceDescriptorIndex vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 16)
#define Tex0_SamplerDescriptorIndex vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 64)
#define Tex1_SamplerDescriptorIndex vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 68)
#define Tex2_SamplerDescriptorIndex vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 72)
#define Tex3_SamplerDescriptorIndex vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 76)
#define Tex4_SamplerDescriptorIndex vk::RawBufferLoad<uint>(g_PushConstants.SharedConstants + 80)
#else
cbuffer PixelShaderConstants : register(b1, space4)
{
[[vk::offset(2880)]] float4 g_ViewportSize PACK_OFFSET(c180);
float fZmin : packoffset(c0);
float fZmax : packoffset(c1);
};
CONSTANT_BUFFER(PixelShaderConstants, b1)
cbuffer SharedConstants : register(b2, space4)
{
[[vk::offset(0)]] float fZmin PACK_OFFSET(c0);
[[vk::offset(4)]] float fZmax PACK_OFFSET(c1);
};
CONSTANT_BUFFER(SharedConstants, b2)
{
[[vk::offset(0)]] uint Tex0_ResourceDescriptorIndex PACK_OFFSET(c0.x);
[[vk::offset(4)]] uint Tex1_ResourceDescriptorIndex PACK_OFFSET(c0.y);
[[vk::offset(8)]] uint Tex2_ResourceDescriptorIndex PACK_OFFSET(c0.z);
[[vk::offset(12)]] uint Tex3_ResourceDescriptorIndex PACK_OFFSET(c0.w);
[[vk::offset(16)]] uint Tex4_ResourceDescriptorIndex PACK_OFFSET(c1.x);
uint Tex0_ResourceDescriptorIndex : packoffset(c0.x);
uint Tex1_ResourceDescriptorIndex : packoffset(c0.y);
uint Tex2_ResourceDescriptorIndex : packoffset(c0.z);
uint Tex3_ResourceDescriptorIndex : packoffset(c0.w);
uint Tex4_ResourceDescriptorIndex : packoffset(c1.x);
[[vk::offset(64)]] uint Tex0_SamplerDescriptorIndex PACK_OFFSET(c4.x);
[[vk::offset(68)]] uint Tex1_SamplerDescriptorIndex PACK_OFFSET(c4.y);
[[vk::offset(72)]] uint Tex2_SamplerDescriptorIndex PACK_OFFSET(c4.z);
[[vk::offset(76)]] uint Tex3_SamplerDescriptorIndex PACK_OFFSET(c4.w);
[[vk::offset(80)]] uint Tex4_SamplerDescriptorIndex PACK_OFFSET(c5.x);
uint Tex0_SamplerDescriptorIndex : packoffset(c4.x);
uint Tex1_SamplerDescriptorIndex : packoffset(c4.y);
uint Tex2_SamplerDescriptorIndex : packoffset(c4.z);
uint Tex3_SamplerDescriptorIndex : packoffset(c4.w);
uint Tex4_SamplerDescriptorIndex : packoffset(c5.x);
SHARED_CONSTANTS;
DEFINE_SHARED_CONSTANTS();
};
#define bCsc (GET_SHARED_CONSTANT(g_Booleans) & (1 << (16 + 0)))
#define bAmv (GET_SHARED_CONSTANT(g_Booleans) & (1 << (16 + 1)))
#define bZmv (GET_SHARED_CONSTANT(g_Booleans) & (1 << (16 + 2)))
#endif
#define bCsc (g_Booleans & (1 << (16 + 0)))
#define bAmv (g_Booleans & (1 << (16 + 1)))
#define bZmv (g_Booleans & (1 << (16 + 2)))
struct VertexShaderInput
{

View file

@ -2,22 +2,17 @@
PixelShaderOutput main(in Interpolators In)
{
#ifdef __spirv__
PixelShaderConstants constants = vk::RawBufferLoad<PixelShaderConstants>(g_PushConstants.PixelShaderConstants, 0x100);
SharedConstants sharedConstants = vk::RawBufferLoad<SharedConstants>(g_PushConstants.SharedConstants, 0x100);
#endif
Texture2D<float4> Tex0 = g_Texture2DDescriptorHeap[Tex0_ResourceDescriptorIndex];
Texture2D<float4> Tex1 = g_Texture2DDescriptorHeap[Tex1_ResourceDescriptorIndex];
Texture2D<float4> Tex2 = g_Texture2DDescriptorHeap[Tex2_ResourceDescriptorIndex];
Texture2D<float4> Tex3 = g_Texture2DDescriptorHeap[Tex3_ResourceDescriptorIndex];
Texture2D<float4> Tex4 = g_Texture2DDescriptorHeap[Tex4_ResourceDescriptorIndex];
Texture2D<float4> Tex0 = g_Texture2DDescriptorHeap[GET_SHARED_CONSTANT(Tex0_ResourceDescriptorIndex)];
Texture2D<float4> Tex1 = g_Texture2DDescriptorHeap[GET_SHARED_CONSTANT(Tex1_ResourceDescriptorIndex)];
Texture2D<float4> Tex2 = g_Texture2DDescriptorHeap[GET_SHARED_CONSTANT(Tex2_ResourceDescriptorIndex)];
Texture2D<float4> Tex3 = g_Texture2DDescriptorHeap[GET_SHARED_CONSTANT(Tex3_ResourceDescriptorIndex)];
Texture2D<float4> Tex4 = g_Texture2DDescriptorHeap[GET_SHARED_CONSTANT(Tex4_ResourceDescriptorIndex)];
SamplerState Tex0_s = g_SamplerDescriptorHeap[GET_SHARED_CONSTANT(Tex0_SamplerDescriptorIndex)];
SamplerState Tex1_s = g_SamplerDescriptorHeap[GET_SHARED_CONSTANT(Tex1_SamplerDescriptorIndex)];
SamplerState Tex2_s = g_SamplerDescriptorHeap[GET_SHARED_CONSTANT(Tex2_SamplerDescriptorIndex)];
SamplerState Tex3_s = g_SamplerDescriptorHeap[GET_SHARED_CONSTANT(Tex3_SamplerDescriptorIndex)];
SamplerState Tex4_s = g_SamplerDescriptorHeap[GET_SHARED_CONSTANT(Tex4_SamplerDescriptorIndex)];
SamplerState Tex0_s = g_SamplerDescriptorHeap[Tex0_SamplerDescriptorIndex];
SamplerState Tex1_s = g_SamplerDescriptorHeap[Tex1_SamplerDescriptorIndex];
SamplerState Tex2_s = g_SamplerDescriptorHeap[Tex2_SamplerDescriptorIndex];
SamplerState Tex3_s = g_SamplerDescriptorHeap[Tex3_SamplerDescriptorIndex];
SamplerState Tex4_s = g_SamplerDescriptorHeap[Tex4_SamplerDescriptorIndex];
PixelShaderOutput Out;
float ValY = Tex0.Sample(Tex0_s, In.UV).r;
@ -36,15 +31,15 @@ PixelShaderOutput main(in Interpolators In)
}
else if (ValD < 17.0 / 255.0)
{
ValD = GET_CONSTANT(fZmin);
ValD = fZmin;
}
else if (ValD < 224.0 / 255.0)
{
ValD = (ValD - 17.0 / 255.0) / (223.0 / 255.0 - 17.0 / 255.0) * (GET_CONSTANT(fZmax) - GET_CONSTANT(fZmin)) + GET_CONSTANT(fZmin);
ValD = (ValD - 17.0 / 255.0) / (223.0 / 255.0 - 17.0 / 255.0) * (fZmax - fZmin) + fZmin;
}
else if (ValD < 240.0 / 255.0)
{
ValD = GET_CONSTANT(fZmax);
ValD = fZmax;
}
else
{

View file

@ -2,10 +2,6 @@
Interpolators main(in VertexShaderInput In)
{
#ifdef __spirv__
VertexShaderConstants constants = vk::RawBufferLoad<VertexShaderConstants>(g_PushConstants.VertexShaderConstants, 0x100);
#endif
Interpolators Out;
Out.ProjPos = In.ObjPos;
Out.UV = In.UV;

@ -1 +1 @@
Subproject commit 85d19486559ff3603456b20585f64a50e2dd9d95
Subproject commit 25b4f604af274645255fa8afc7455b3b77bc5f3d