mirror of https://github.com/PCSX2/pcsx2.git
GS: Don't add 10 to date flag to indicate initialization
We already have 1 and 2 dedicated to the job
This commit is contained in:
parent
0500824e57
commit
412480b326
|
@ -102,7 +102,7 @@ struct PS_INPUT
|
||||||
#else
|
#else
|
||||||
nointerpolation float4 c : COLOR0;
|
nointerpolation float4 c : COLOR0;
|
||||||
#endif
|
#endif
|
||||||
#if PS_DATE > 10 || PS_DATE == 3
|
#if PS_DATE >= 1 && PS_DATE <= 3
|
||||||
uint primid : SV_PrimitiveID;
|
uint primid : SV_PrimitiveID;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -110,7 +110,7 @@ struct PS_INPUT
|
||||||
struct PS_OUTPUT
|
struct PS_OUTPUT
|
||||||
{
|
{
|
||||||
#if !PS_NO_COLOR
|
#if !PS_NO_COLOR
|
||||||
#if PS_DATE > 10
|
#if PS_DATE == 1 || PS_DATE == 2
|
||||||
float c : SV_Target;
|
float c : SV_Target;
|
||||||
#else
|
#else
|
||||||
float4 c0 : SV_Target0;
|
float4 c0 : SV_Target0;
|
||||||
|
@ -918,12 +918,12 @@ PS_OUTPUT ps_main(PS_INPUT input)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get first primitive that will write a failling alpha value
|
// Get first primitive that will write a failling alpha value
|
||||||
#if PS_DATE == 11
|
#if PS_DATE == 1
|
||||||
// DATM == 0
|
// DATM == 0
|
||||||
// Pixel with alpha equal to 1 will failed (128-255)
|
// Pixel with alpha equal to 1 will failed (128-255)
|
||||||
output.c = (C.a > 127.5f) ? float(input.primid) : float(0x7FFFFFFF);
|
output.c = (C.a > 127.5f) ? float(input.primid) : float(0x7FFFFFFF);
|
||||||
|
|
||||||
#elif PS_DATE == 12
|
#elif PS_DATE == 2
|
||||||
|
|
||||||
// DATM == 1
|
// DATM == 1
|
||||||
// Pixel with alpha equal to 0 will failed (0-127)
|
// Pixel with alpha equal to 0 will failed (0-127)
|
||||||
|
|
|
@ -348,7 +348,7 @@ void main()
|
||||||
#define SW_BLEND (PS_BLEND_A || PS_BLEND_B || PS_BLEND_D)
|
#define SW_BLEND (PS_BLEND_A || PS_BLEND_B || PS_BLEND_D)
|
||||||
#define SW_BLEND_NEEDS_RT (PS_BLEND_A == 1 || PS_BLEND_B == 1 || PS_BLEND_C == 1 || PS_BLEND_D == 1)
|
#define SW_BLEND_NEEDS_RT (PS_BLEND_A == 1 || PS_BLEND_B == 1 || PS_BLEND_C == 1 || PS_BLEND_D == 1)
|
||||||
|
|
||||||
#define PS_FEEDBACK_LOOP_IS_NEEDED (PS_TEX_IS_FB == 1 || PS_FBMASK || SW_BLEND_NEEDS_RT || (PS_DATE < 10 && (((PS_DATE & 3) == 1 || (PS_DATE & 3) == 2))))
|
#define PS_FEEDBACK_LOOP_IS_NEEDED (PS_TEX_IS_FB == 1 || PS_FBMASK || SW_BLEND_NEEDS_RT || (PS_DATE >= 5))
|
||||||
|
|
||||||
layout(std140, set = 0, binding = 1) uniform cb1
|
layout(std140, set = 0, binding = 1) uniform cb1
|
||||||
{
|
{
|
||||||
|
@ -1110,10 +1110,6 @@ void ps_blend(inout vec4 Color, inout float As)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if PS_DATE == 1 || PS_DATE == 2 || PS_DATE == 11 || PS_DATE == 12
|
|
||||||
layout(early_fragment_tests) in;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
#if PS_SCANMSK & 2
|
#if PS_SCANMSK & 2
|
||||||
|
@ -1121,7 +1117,7 @@ void main()
|
||||||
if ((int(gl_FragCoord.y) & 1) == (PS_SCANMSK & 1))
|
if ((int(gl_FragCoord.y) & 1) == (PS_SCANMSK & 1))
|
||||||
discard;
|
discard;
|
||||||
#endif
|
#endif
|
||||||
#if PS_DATE < 10 && (((PS_DATE & 3) == 1 || (PS_DATE & 3) == 2))
|
#if PS_DATE >= 5
|
||||||
|
|
||||||
#if PS_WRITE_RG == 1
|
#if PS_WRITE_RG == 1
|
||||||
// Pseudo 16 bits access.
|
// Pseudo 16 bits access.
|
||||||
|
@ -1139,15 +1135,10 @@ void main()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (bad) {
|
if (bad) {
|
||||||
#if PS_DATE >= 5
|
|
||||||
discard;
|
discard;
|
||||||
#else
|
|
||||||
// imageStore(img_prim_min, ivec2(gl_FragCoord.xy), ivec4(-1));
|
|
||||||
return;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // PS_DATE < 10 && (((PS_DATE & 3) == 1 || (PS_DATE & 3) == 2))
|
#endif // PS_DATE >= 5
|
||||||
|
|
||||||
#if PS_DATE == 3
|
#if PS_DATE == 3
|
||||||
int stencil_ceil = int(texelFetch(PrimMinTexture, ivec2(gl_FragCoord.xy), 0).r);
|
int stencil_ceil = int(texelFetch(PrimMinTexture, ivec2(gl_FragCoord.xy), 0).r);
|
||||||
|
@ -1208,13 +1199,13 @@ void main()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Get first primitive that will write a failling alpha value
|
// Get first primitive that will write a failling alpha value
|
||||||
#if PS_DATE == 1 || PS_DATE == 11
|
#if PS_DATE == 1
|
||||||
|
|
||||||
// DATM == 0
|
// DATM == 0
|
||||||
// Pixel with alpha equal to 1 will failed (128-255)
|
// Pixel with alpha equal to 1 will failed (128-255)
|
||||||
o_col0 = (C.a > 127.5f) ? vec4(gl_PrimitiveID) : vec4(0x7FFFFFFF);
|
o_col0 = (C.a > 127.5f) ? vec4(gl_PrimitiveID) : vec4(0x7FFFFFFF);
|
||||||
|
|
||||||
#elif PS_DATE == 2 || PS_DATE == 12
|
#elif PS_DATE == 2
|
||||||
|
|
||||||
// DATM == 1
|
// DATM == 1
|
||||||
// Pixel with alpha equal to 0 will failed (0-127)
|
// Pixel with alpha equal to 0 will failed (0-127)
|
||||||
|
|
|
@ -312,7 +312,7 @@ struct alignas(16) GSHWDrawConfig
|
||||||
// Flat/goround shading
|
// Flat/goround shading
|
||||||
u32 iip : 1;
|
u32 iip : 1;
|
||||||
// Pixel test
|
// Pixel test
|
||||||
u32 date : 4;
|
u32 date : 3;
|
||||||
u32 atst : 3;
|
u32 atst : 3;
|
||||||
// Color sampling
|
// Color sampling
|
||||||
u32 fst : 1; // Investigate to do it on the VS
|
u32 fst : 1; // Investigate to do it on the VS
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
static bool IsDATMConvertShader(ShaderConvert i) { return (i == ShaderConvert::DATM_0 || i == ShaderConvert::DATM_1); }
|
static bool IsDATMConvertShader(ShaderConvert i) { return (i == ShaderConvert::DATM_0 || i == ShaderConvert::DATM_1); }
|
||||||
|
static bool IsDATEModePrimIDInit(u32 flag) { return flag == 1 || flag == 2; }
|
||||||
|
|
||||||
static D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE GetLoadOpForTexture(GSTexture12* tex)
|
static D3D12_RENDER_PASS_BEGINNING_ACCESS_TYPE GetLoadOpForTexture(GSTexture12* tex)
|
||||||
{
|
{
|
||||||
|
@ -1601,8 +1602,9 @@ GSDevice12::ComPtr<ID3D12PipelineState> GSDevice12::CreateTFXPipeline(const Pipe
|
||||||
if (p.rt)
|
if (p.rt)
|
||||||
{
|
{
|
||||||
gpb.SetRenderTarget(0,
|
gpb.SetRenderTarget(0,
|
||||||
(p.ps.date >= 10) ? DXGI_FORMAT_R32_FLOAT :
|
IsDATEModePrimIDInit(p.ps.date) ? DXGI_FORMAT_R32_FLOAT :
|
||||||
(p.ps.hdr ? DXGI_FORMAT_R32G32B32A32_FLOAT : DXGI_FORMAT_R8G8B8A8_UNORM));
|
p.ps.hdr ? DXGI_FORMAT_R32G32B32A32_FLOAT :
|
||||||
|
DXGI_FORMAT_R8G8B8A8_UNORM);
|
||||||
}
|
}
|
||||||
if (p.ds)
|
if (p.ds)
|
||||||
gpb.SetDepthStencilFormat(DXGI_FORMAT_D32_FLOAT_S8X24_UINT);
|
gpb.SetDepthStencilFormat(DXGI_FORMAT_D32_FLOAT_S8X24_UINT);
|
||||||
|
@ -1642,7 +1644,7 @@ GSDevice12::ComPtr<ID3D12PipelineState> GSDevice12::CreateTFXPipeline(const Pipe
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blending
|
// Blending
|
||||||
if (p.ps.date >= 10)
|
if (IsDATEModePrimIDInit(p.ps.date))
|
||||||
{
|
{
|
||||||
// image DATE prepass
|
// image DATE prepass
|
||||||
gpb.SetBlendState(0, true, D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_MIN, D3D12_BLEND_ONE,
|
gpb.SetBlendState(0, true, D3D12_BLEND_ONE, D3D12_BLEND_ZERO, D3D12_BLEND_OP_MIN, D3D12_BLEND_ONE,
|
||||||
|
@ -2406,7 +2408,6 @@ GSTexture12* GSDevice12::SetupPrimitiveTrackingDATE(GSHWDrawConfig& config, Pipe
|
||||||
init_pipe.bs = {};
|
init_pipe.bs = {};
|
||||||
init_pipe.rt = true;
|
init_pipe.rt = true;
|
||||||
init_pipe.ps.blend_a = init_pipe.ps.blend_b = init_pipe.ps.blend_c = init_pipe.ps.blend_d = false;
|
init_pipe.ps.blend_a = init_pipe.ps.blend_b = init_pipe.ps.blend_c = init_pipe.ps.blend_d = false;
|
||||||
init_pipe.ps.date += 10;
|
|
||||||
init_pipe.ps.no_color = false;
|
init_pipe.ps.no_color = false;
|
||||||
init_pipe.ps.no_color1 = true;
|
init_pipe.ps.no_color1 = true;
|
||||||
if (BindDrawPipeline(init_pipe))
|
if (BindDrawPipeline(init_pipe))
|
||||||
|
|
|
@ -36,6 +36,7 @@ static u32 s_debug_scope_depth = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static bool IsDATMConvertShader(ShaderConvert i) { return (i == ShaderConvert::DATM_0 || i == ShaderConvert::DATM_1); }
|
static bool IsDATMConvertShader(ShaderConvert i) { return (i == ShaderConvert::DATM_0 || i == ShaderConvert::DATM_1); }
|
||||||
|
static bool IsDATEModePrimIDInit(u32 flag) { return flag == 1 || flag == 2; }
|
||||||
|
|
||||||
static VkAttachmentLoadOp GetLoadOpForTexture(GSTextureVK* tex)
|
static VkAttachmentLoadOp GetLoadOpForTexture(GSTextureVK* tex)
|
||||||
{
|
{
|
||||||
|
@ -2035,7 +2036,7 @@ VkPipeline GSDeviceVK::CreateTFXPipeline(const PipelineSelector& p)
|
||||||
|
|
||||||
// Common state
|
// Common state
|
||||||
gpb.SetPipelineLayout(m_tfx_pipeline_layout);
|
gpb.SetPipelineLayout(m_tfx_pipeline_layout);
|
||||||
if (p.ps.date >= 10)
|
if (IsDATEModePrimIDInit(p.ps.date))
|
||||||
{
|
{
|
||||||
// DATE image prepass
|
// DATE image prepass
|
||||||
gpb.SetRenderPass(m_date_image_setup_render_passes[p.ds][0], 0);
|
gpb.SetRenderPass(m_date_image_setup_render_passes[p.ds][0], 0);
|
||||||
|
@ -2083,7 +2084,7 @@ VkPipeline GSDeviceVK::CreateTFXPipeline(const PipelineSelector& p)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blending
|
// Blending
|
||||||
if (p.ps.date >= 10)
|
if (IsDATEModePrimIDInit(p.ps.date))
|
||||||
{
|
{
|
||||||
// image DATE prepass
|
// image DATE prepass
|
||||||
gpb.SetBlendAttachment(0, true, VK_BLEND_FACTOR_ONE, VK_BLEND_FACTOR_ZERO, VK_BLEND_OP_MIN, VK_BLEND_FACTOR_ONE,
|
gpb.SetBlendAttachment(0, true, VK_BLEND_FACTOR_ONE, VK_BLEND_FACTOR_ZERO, VK_BLEND_OP_MIN, VK_BLEND_FACTOR_ONE,
|
||||||
|
@ -2837,7 +2838,6 @@ GSTextureVK* GSDeviceVK::SetupPrimitiveTrackingDATE(GSHWDrawConfig& config)
|
||||||
pipe.feedback_loop = false;
|
pipe.feedback_loop = false;
|
||||||
pipe.rt = true;
|
pipe.rt = true;
|
||||||
pipe.ps.blend_a = pipe.ps.blend_b = pipe.ps.blend_c = pipe.ps.blend_d = false;
|
pipe.ps.blend_a = pipe.ps.blend_b = pipe.ps.blend_c = pipe.ps.blend_d = false;
|
||||||
pipe.ps.date += 10;
|
|
||||||
pipe.ps.no_color = false;
|
pipe.ps.no_color = false;
|
||||||
pipe.ps.no_color1 = true;
|
pipe.ps.no_color1 = true;
|
||||||
if (BindDrawPipeline(pipe))
|
if (BindDrawPipeline(pipe))
|
||||||
|
|
Loading…
Reference in New Issue