mirror of https://github.com/PCSX2/pcsx2.git
gsdx: new parameter for merge virtual function
* Add full PMODE register to replace slbg/mmod * Add full EXTBUF register (will allow to emulate write feedback) * Add a third source (which will actually be the destination of the write feedback)
This commit is contained in:
parent
357dcdb55e
commit
7ca9ca9465
|
@ -243,7 +243,7 @@ GSTexture* GSDevice::GetCurrent()
|
||||||
return m_current;
|
return m_current;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice::Merge(GSTexture* sTex[2], GSVector4* sRect, GSVector4* dRect, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c)
|
void GSDevice::Merge(GSTexture* sTex[3], GSVector4* sRect, GSVector4* dRect, const GSVector2i& fs, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c)
|
||||||
{
|
{
|
||||||
if(m_merge == NULL || m_merge->GetSize() != fs)
|
if(m_merge == NULL || m_merge->GetSize() != fs)
|
||||||
{
|
{
|
||||||
|
@ -260,7 +260,7 @@ void GSDevice::Merge(GSTexture* sTex[2], GSVector4* sRect, GSVector4* dRect, con
|
||||||
|
|
||||||
if(m_merge)
|
if(m_merge)
|
||||||
{
|
{
|
||||||
GSTexture* tex[2] = {NULL, NULL};
|
GSTexture* tex[3] = {NULL, NULL, NULL};
|
||||||
|
|
||||||
for(size_t i = 0; i < countof(tex); i++)
|
for(size_t i = 0; i < countof(tex); i++)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ void GSDevice::Merge(GSTexture* sTex[2], GSVector4* sRect, GSVector4* dRect, con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DoMerge(tex, sRect, m_merge, dRect, slbg, mmod, c);
|
DoMerge(tex, sRect, m_merge, dRect, PMODE, EXTBUF, c);
|
||||||
|
|
||||||
for(size_t i = 0; i < countof(tex); i++)
|
for(size_t i = 0; i < countof(tex); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -122,7 +122,7 @@ protected:
|
||||||
virtual GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format) = 0;
|
virtual GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format) = 0;
|
||||||
virtual GSTexture* FetchSurface(int type, int w, int h, bool msaa, int format);
|
virtual GSTexture* FetchSurface(int type, int w, int h, bool msaa, int format);
|
||||||
|
|
||||||
virtual void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c) = 0;
|
virtual void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c) = 0;
|
||||||
virtual void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset) = 0;
|
virtual void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset) = 0;
|
||||||
virtual void DoFXAA(GSTexture* sTex, GSTexture* dTex) {}
|
virtual void DoFXAA(GSTexture* sTex, GSTexture* dTex) {}
|
||||||
virtual void DoShadeBoost(GSTexture* sTex, GSTexture* dTex) {}
|
virtual void DoShadeBoost(GSTexture* sTex, GSTexture* dTex) {}
|
||||||
|
@ -176,7 +176,7 @@ public:
|
||||||
|
|
||||||
GSTexture* GetCurrent();
|
GSTexture* GetCurrent();
|
||||||
|
|
||||||
void Merge(GSTexture* sTex[2], GSVector4* sRect, GSVector4* dRect, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c);
|
void Merge(GSTexture* sTex[3], GSVector4* sRect, GSVector4* dRect, const GSVector2i& fs, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c);
|
||||||
void Interlace(const GSVector2i& ds, int field, int mode, float yoffset);
|
void Interlace(const GSVector2i& ds, int field, int mode, float yoffset);
|
||||||
void FXAA();
|
void FXAA();
|
||||||
void ShadeBoost();
|
void ShadeBoost();
|
||||||
|
|
|
@ -722,8 +722,11 @@ void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
||||||
PSSetShaderResources(NULL, NULL);
|
PSSetShaderResources(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c)
|
void GSDevice11::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c)
|
||||||
{
|
{
|
||||||
|
bool slbg = PMODE.SLBG;
|
||||||
|
bool mmod = PMODE.MMOD;
|
||||||
|
|
||||||
ClearRenderTarget(dTex, c);
|
ClearRenderTarget(dTex, c);
|
||||||
|
|
||||||
if(sTex[1] && !slbg)
|
if(sTex[1] && !slbg)
|
||||||
|
|
|
@ -34,7 +34,7 @@ class GSDevice11 : public GSDeviceDX
|
||||||
{
|
{
|
||||||
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
||||||
|
|
||||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c);
|
void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c);
|
||||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||||
void DoFXAA(GSTexture* sTex, GSTexture* dTex);
|
void DoFXAA(GSTexture* sTex, GSTexture* dTex);
|
||||||
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex);
|
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex);
|
||||||
|
|
|
@ -904,8 +904,11 @@ void GSDevice9::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
||||||
EndScene();
|
EndScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c)
|
void GSDevice9::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c)
|
||||||
{
|
{
|
||||||
|
bool slbg = PMODE.SLBG;
|
||||||
|
bool mmod = PMODE.MMOD;
|
||||||
|
|
||||||
ClearRenderTarget(dTex, c);
|
ClearRenderTarget(dTex, c);
|
||||||
|
|
||||||
if(sTex[1] && !slbg)
|
if(sTex[1] && !slbg)
|
||||||
|
|
|
@ -74,7 +74,7 @@ class GSDevice9 : public GSDeviceDX
|
||||||
{
|
{
|
||||||
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
||||||
|
|
||||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c);
|
void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c);
|
||||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||||
void DoFXAA(GSTexture* sTex, GSTexture* dTex);
|
void DoFXAA(GSTexture* sTex, GSTexture* dTex);
|
||||||
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex);
|
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class GSDeviceNull : public GSDevice
|
||||||
private:
|
private:
|
||||||
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
||||||
|
|
||||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c) {}
|
void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c) {}
|
||||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0) {}
|
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1389,12 +1389,14 @@ void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture
|
||||||
EndScene();
|
EndScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c)
|
void GSDeviceOGL::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c)
|
||||||
{
|
{
|
||||||
GL_PUSH("DoMerge");
|
GL_PUSH("DoMerge");
|
||||||
|
|
||||||
OMSetColorMaskState();
|
bool slbg = PMODE.SLBG;
|
||||||
|
bool mmod = PMODE.MMOD;
|
||||||
|
|
||||||
|
OMSetColorMaskState();
|
||||||
ClearRenderTarget(dTex, c);
|
ClearRenderTarget(dTex, c);
|
||||||
|
|
||||||
if(sTex[1] && !slbg)
|
if(sTex[1] && !slbg)
|
||||||
|
|
|
@ -482,7 +482,7 @@ public:
|
||||||
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
||||||
GSTexture* FetchSurface(int type, int w, int h, bool msaa, int format);
|
GSTexture* FetchSurface(int type, int w, int h, bool msaa, int format);
|
||||||
|
|
||||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c) final;
|
void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c) final;
|
||||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0) final;
|
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0) final;
|
||||||
void DoFXAA(GSTexture* sTex, GSTexture* dTex) final;
|
void DoFXAA(GSTexture* sTex, GSTexture* dTex) final;
|
||||||
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex) final;
|
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex) final;
|
||||||
|
|
|
@ -349,8 +349,11 @@ void GSDeviceSW::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
void GSDeviceSW::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c)
|
void GSDeviceSW::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c)
|
||||||
{
|
{
|
||||||
|
bool slbg = PMODE.SLBG;
|
||||||
|
bool mmod = PMODE.MMOD;
|
||||||
|
|
||||||
ClearRenderTarget(dTex, c);
|
ClearRenderTarget(dTex, c);
|
||||||
|
|
||||||
if(sTex[1] && !slbg)
|
if(sTex[1] && !slbg)
|
||||||
|
|
|
@ -28,7 +28,7 @@ class GSDeviceSW : public GSDevice
|
||||||
{
|
{
|
||||||
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
||||||
|
|
||||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c);
|
void DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, const GSVector4& c);
|
||||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||||
|
|
||||||
void Clear(GSTexture* t, uint32 c);
|
void Clear(GSTexture* t, uint32 c);
|
||||||
|
|
|
@ -196,8 +196,8 @@ bool GSRenderer::Merge(int field)
|
||||||
GSVector2i fs(0, 0);
|
GSVector2i fs(0, 0);
|
||||||
GSVector2i ds(0, 0);
|
GSVector2i ds(0, 0);
|
||||||
|
|
||||||
GSTexture* tex[2] = {NULL, NULL};
|
GSTexture* tex[3] = {NULL, NULL, NULL};
|
||||||
int y_offset[2] = {0, 0};
|
int y_offset[3] = {0, 0, 0};
|
||||||
|
|
||||||
s_n++;
|
s_n++;
|
||||||
|
|
||||||
|
@ -272,7 +272,6 @@ bool GSRenderer::Merge(int field)
|
||||||
m_real_size = ds;
|
m_real_size = ds;
|
||||||
|
|
||||||
bool slbg = m_regs->PMODE.SLBG;
|
bool slbg = m_regs->PMODE.SLBG;
|
||||||
bool mmod = m_regs->PMODE.MMOD;
|
|
||||||
|
|
||||||
if(tex[0] || tex[1])
|
if(tex[0] || tex[1])
|
||||||
{
|
{
|
||||||
|
@ -285,7 +284,7 @@ bool GSRenderer::Merge(int field)
|
||||||
|
|
||||||
GSVector4 c = GSVector4((int)m_regs->BGCOLOR.R, (int)m_regs->BGCOLOR.G, (int)m_regs->BGCOLOR.B, (int)m_regs->PMODE.ALP) / 255;
|
GSVector4 c = GSVector4((int)m_regs->BGCOLOR.R, (int)m_regs->BGCOLOR.G, (int)m_regs->BGCOLOR.B, (int)m_regs->PMODE.ALP) / 255;
|
||||||
|
|
||||||
m_dev->Merge(tex, src_hw, dst, fs, slbg, mmod, c);
|
m_dev->Merge(tex, src_hw, dst, fs, m_regs->PMODE, m_regs->EXTBUF, c);
|
||||||
|
|
||||||
if(m_regs->SMODE2.INT && m_interlace > 0)
|
if(m_regs->SMODE2.INT && m_interlace > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -104,7 +104,7 @@ bool GPURenderer::Create(void* hWnd)
|
||||||
|
|
||||||
bool GPURenderer::Merge()
|
bool GPURenderer::Merge()
|
||||||
{
|
{
|
||||||
GSTexture* st[2] = {GetOutput(), NULL};
|
GSTexture* st[3] = {GetOutput(), NULL, NULL};
|
||||||
|
|
||||||
if(!st[0])
|
if(!st[0])
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,10 @@ bool GPURenderer::Merge()
|
||||||
sr[0] = GSVector4(0, 0, 1, 1);
|
sr[0] = GSVector4(0, 0, 1, 1);
|
||||||
dr[0] = GSVector4(0, 0, s.x, s.y);
|
dr[0] = GSVector4(0, 0, s.x, s.y);
|
||||||
|
|
||||||
m_dev->Merge(st, sr, dr, s, 1, 1, GSVector4(0, 0, 0, 1));
|
GSRegPMODE PMODE = {0};
|
||||||
|
PMODE.u32[0] = 0xFFFFFFFF;
|
||||||
|
GSRegEXTBUF EXTBUF = {0};
|
||||||
|
m_dev->Merge(st, sr, dr, s, PMODE, EXTBUF, GSVector4(0, 0, 0, 1));
|
||||||
|
|
||||||
if(m_shadeboost)
|
if(m_shadeboost)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue