mirror of https://github.com/PCSX2/pcsx2.git
gsdx-d3d11: Port/add depth mask support to EmulateZbuffer.
Add support for depthmasking to EmulateZbuffer, previous old code had support but wasn't ported properly with the new code a few years back. VS Constant buffer is now properly setup.
This commit is contained in:
parent
639986faa7
commit
24f06187df
|
@ -42,11 +42,14 @@ public:
|
||||||
GSVector4 VertexOffset;
|
GSVector4 VertexOffset;
|
||||||
GSVector4 Texture_Scale_Offset;
|
GSVector4 Texture_Scale_Offset;
|
||||||
|
|
||||||
|
GSVector2i DepthMask;
|
||||||
|
|
||||||
VSConstantBuffer()
|
VSConstantBuffer()
|
||||||
{
|
{
|
||||||
VertexScale = GSVector4::zero();
|
VertexScale = GSVector4::zero();
|
||||||
VertexOffset = GSVector4::zero();
|
VertexOffset = GSVector4::zero();
|
||||||
Texture_Scale_Offset = GSVector4::zero();
|
Texture_Scale_Offset = GSVector4::zero();
|
||||||
|
DepthMask = GSVector2i(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
__forceinline bool Update(const VSConstantBuffer* cb)
|
__forceinline bool Update(const VSConstantBuffer* cb)
|
||||||
|
@ -74,11 +77,10 @@ public:
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
uint32 bppz:2;
|
|
||||||
uint32 tme:1;
|
uint32 tme:1;
|
||||||
uint32 fst:1;
|
uint32 fst:1;
|
||||||
|
|
||||||
uint32 _free:28;
|
uint32 _free:30;
|
||||||
};
|
};
|
||||||
|
|
||||||
uint32 key;
|
uint32 key;
|
||||||
|
|
|
@ -176,6 +176,7 @@ void GSRendererDX11::EmulateZbuffer()
|
||||||
// The real GS appears to do no masking based on the Z buffer format and writing larger Z values
|
// The real GS appears to do no masking based on the Z buffer format and writing larger Z values
|
||||||
// than the buffer supports seems to be an error condition on the real GS, causing it to crash.
|
// than the buffer supports seems to be an error condition on the real GS, causing it to crash.
|
||||||
// We are probably receiving bad coordinates from VU1 in these cases.
|
// We are probably receiving bad coordinates from VU1 in these cases.
|
||||||
|
vs_cb.DepthMask = GSVector2i(0xFFFFFFFF, 0xFFFFFFFF);
|
||||||
|
|
||||||
if (m_om_dssel.ztst >= ZTST_ALWAYS && m_om_dssel.zwe && (m_context->ZBUF.PSM != PSM_PSMZ32))
|
if (m_om_dssel.ztst >= ZTST_ALWAYS && m_om_dssel.zwe && (m_context->ZBUF.PSM != PSM_PSMZ32))
|
||||||
{
|
{
|
||||||
|
@ -188,6 +189,7 @@ void GSRendererDX11::EmulateZbuffer()
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
fprintf(stdout, "%d: Bad Z size on %s buffers\n", s_n, psm_str(m_context->ZBUF.PSM));
|
fprintf(stdout, "%d: Bad Z size on %s buffers\n", s_n, psm_str(m_context->ZBUF.PSM));
|
||||||
#endif
|
#endif
|
||||||
|
vs_cb.DepthMask = GSVector2i(max_z, max_z);
|
||||||
m_om_dssel.ztst = ZTST_ALWAYS;
|
m_om_dssel.ztst = ZTST_ALWAYS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,6 @@ void GSDevice11::SetupVS(VSSelector sel, const VSConstantBuffer* cb)
|
||||||
{
|
{
|
||||||
ShaderMacro sm(m_shader.model);
|
ShaderMacro sm(m_shader.model);
|
||||||
|
|
||||||
sm.AddMacro("VS_BPPZ", sel.bppz);
|
|
||||||
sm.AddMacro("VS_TME", sel.tme);
|
sm.AddMacro("VS_TME", sel.tme);
|
||||||
sm.AddMacro("VS_FST", sel.fst);
|
sm.AddMacro("VS_FST", sel.fst);
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
#define FMT_24 1
|
#define FMT_24 1
|
||||||
#define FMT_16 2
|
#define FMT_16 2
|
||||||
|
|
||||||
#ifndef VS_BPPZ
|
#ifndef VS_TME
|
||||||
#define VS_BPPZ 0
|
|
||||||
#define VS_TME 1
|
#define VS_TME 1
|
||||||
#define VS_FST 1
|
#define VS_FST 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -100,6 +99,8 @@ cbuffer cb0
|
||||||
float4 VertexScale;
|
float4 VertexScale;
|
||||||
float4 VertexOffset;
|
float4 VertexOffset;
|
||||||
float4 Texture_Scale_Offset;
|
float4 Texture_Scale_Offset;
|
||||||
|
uint DepthMask;
|
||||||
|
uint3 _pad_cb0;
|
||||||
};
|
};
|
||||||
|
|
||||||
cbuffer cb1
|
cbuffer cb1
|
||||||
|
@ -786,14 +787,7 @@ PS_OUTPUT ps_main(PS_INPUT input)
|
||||||
|
|
||||||
VS_OUTPUT vs_main(VS_INPUT input)
|
VS_OUTPUT vs_main(VS_INPUT input)
|
||||||
{
|
{
|
||||||
if(VS_BPPZ == 1) // 24
|
input.z &= DepthMask;
|
||||||
{
|
|
||||||
input.z = input.z & 0xffffff;
|
|
||||||
}
|
|
||||||
else if(VS_BPPZ == 2) // 16
|
|
||||||
{
|
|
||||||
input.z = input.z & 0xffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
VS_OUTPUT output;
|
VS_OUTPUT output;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue