mirror of https://github.com/PCSX2/pcsx2.git
gsdx: sed/dr/dRect/
This commit is contained in:
parent
445c28fe97
commit
28bb64aae8
|
@ -114,12 +114,12 @@ bool GPURenderer::Merge()
|
|||
GSVector2i s = st[0]->GetSize();
|
||||
|
||||
GSVector4 sRect[2];
|
||||
GSVector4 dr[2];
|
||||
GSVector4 dRect[2];
|
||||
|
||||
sRect[0] = GSVector4(0, 0, 1, 1);
|
||||
dr[0] = GSVector4(0, 0, s.x, s.y);
|
||||
dRect[0] = GSVector4(0, 0, s.x, s.y);
|
||||
|
||||
m_dev->Merge(st, sRect, dr, s, 1, 1, GSVector4(0, 0, 0, 1));
|
||||
m_dev->Merge(st, sRect, dRect, s, 1, 1, GSVector4(0, 0, 0, 1));
|
||||
|
||||
if(m_shadeboost)
|
||||
{
|
||||
|
|
|
@ -122,9 +122,9 @@ void GSDevice::Present(const GSVector4i& r, int shader)
|
|||
GL_POP();
|
||||
}
|
||||
|
||||
void GSDevice::Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dr, int shader)
|
||||
void GSDevice::Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect, int shader)
|
||||
{
|
||||
StretchRect(sTex, dTex, dr, shader);
|
||||
StretchRect(sTex, dTex, dRect, shader);
|
||||
}
|
||||
|
||||
GSTexture* GSDevice::FetchSurface(int type, int w, int h, bool msaa, int format)
|
||||
|
@ -207,9 +207,9 @@ GSTexture* GSDevice::CreateOffscreen(int w, int h, int format)
|
|||
return FetchSurface(GSTexture::Offscreen, w, h, false, format);
|
||||
}
|
||||
|
||||
void GSDevice::StretchRect(GSTexture* sTex, GSTexture* dTex, const GSVector4& dr, int shader, bool linear)
|
||||
void GSDevice::StretchRect(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect, int shader, bool linear)
|
||||
{
|
||||
StretchRect(sTex, GSVector4(0, 0, 1, 1), dTex, dr, shader, linear);
|
||||
StretchRect(sTex, GSVector4(0, 0, 1, 1), dTex, dRect, shader, linear);
|
||||
}
|
||||
|
||||
GSTexture* GSDevice::GetCurrent()
|
||||
|
@ -217,7 +217,7 @@ GSTexture* GSDevice::GetCurrent()
|
|||
return m_current;
|
||||
}
|
||||
|
||||
void GSDevice::Merge(GSTexture* sTex[2], GSVector4* sRect, GSVector4* dr, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c)
|
||||
void GSDevice::Merge(GSTexture* sTex[2], GSVector4* sRect, GSVector4* dRect, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c)
|
||||
{
|
||||
if(m_merge == NULL || m_merge->GetSize() != fs)
|
||||
{
|
||||
|
@ -244,7 +244,7 @@ void GSDevice::Merge(GSTexture* sTex[2], GSVector4* sRect, GSVector4* dr, const
|
|||
}
|
||||
}
|
||||
|
||||
DoMerge(tex, sRect, m_merge, dr, slbg, mmod, c);
|
||||
DoMerge(tex, sRect, m_merge, dRect, slbg, mmod, c);
|
||||
|
||||
for(size_t i = 0; i < countof(tex); i++)
|
||||
{
|
||||
|
@ -322,9 +322,9 @@ void GSDevice::ExternalFX()
|
|||
if (m_shaderfx != NULL)
|
||||
{
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
StretchRect(m_current, sRect, m_shaderfx, dr, 7, false);
|
||||
StretchRect(m_current, sRect, m_shaderfx, dRect, 7, false);
|
||||
DoExternalFX(m_shaderfx, m_current);
|
||||
}
|
||||
}
|
||||
|
@ -342,9 +342,9 @@ void GSDevice::FXAA()
|
|||
if(m_fxaa != NULL)
|
||||
{
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
StretchRect(m_current, sRect, m_fxaa, dr, 7, false);
|
||||
StretchRect(m_current, sRect, m_fxaa, dRect, 7, false);
|
||||
DoFXAA(m_fxaa, m_current);
|
||||
}
|
||||
}
|
||||
|
@ -362,9 +362,9 @@ void GSDevice::ShadeBoost()
|
|||
if(m_shadeboost != NULL)
|
||||
{
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
StretchRect(m_current, sRect, m_shadeboost, dr, 0, false);
|
||||
StretchRect(m_current, sRect, m_shadeboost, dRect, 0, false);
|
||||
DoShadeBoost(m_shadeboost, m_current);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ protected:
|
|||
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 void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c) = 0;
|
||||
virtual void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c) = 0;
|
||||
virtual void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset) = 0;
|
||||
virtual void DoFXAA(GSTexture* sTex, GSTexture* dTex) {}
|
||||
virtual void DoShadeBoost(GSTexture* sTex, GSTexture* dTex) {}
|
||||
|
@ -118,7 +118,7 @@ public:
|
|||
virtual bool Reset(int w, int h);
|
||||
virtual bool IsLost(bool update = false) {return false;}
|
||||
virtual void Present(const GSVector4i& r, int shader);
|
||||
virtual void Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dr, int shader = 0);
|
||||
virtual void Present(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect, int shader = 0);
|
||||
virtual void Flip() {}
|
||||
|
||||
virtual void SetVSync(bool enable) {m_vsync = enable;}
|
||||
|
@ -144,9 +144,9 @@ public:
|
|||
virtual GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0) {return NULL;}
|
||||
|
||||
virtual void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r) {}
|
||||
virtual void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true) {}
|
||||
virtual void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader = 0, bool linear = true) {}
|
||||
|
||||
void StretchRect(GSTexture* sTex, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, GSTexture* dTex, const GSVector4& dRect, int shader = 0, bool linear = true);
|
||||
|
||||
virtual void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1) {}
|
||||
virtual void PSSetShaderResource(int i, GSTexture* sRect) {}
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
|
||||
GSTexture* GetCurrent();
|
||||
|
||||
void Merge(GSTexture* sTex[2], GSVector4* sRect, GSVector4* dr, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c);
|
||||
void Merge(GSTexture* sTex[2], GSVector4* sRect, GSVector4* dRect, const GSVector2i& fs, bool slbg, bool mmod, const GSVector4& c);
|
||||
void Interlace(const GSVector2i& ds, int field, int mode, float yoffset);
|
||||
void FXAA();
|
||||
void ShadeBoost();
|
||||
|
|
|
@ -583,11 +583,11 @@ GSTexture* GSDevice11::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int
|
|||
|
||||
if(GSTexture* rt = CreateRenderTarget(w, h, false, format))
|
||||
{
|
||||
GSVector4 dr(0, 0, w, h);
|
||||
GSVector4 dRect(0, 0, w, h);
|
||||
|
||||
if(GSTexture* src2 = src->IsMSAA() ? Resolve(src) : src)
|
||||
{
|
||||
StretchRect(src2, sRect, rt, dr, m_convert.ps[format == DXGI_FORMAT_R16_UINT ? 1 : 0], NULL);
|
||||
StretchRect(src2, sRect, rt, dRect, m_convert.ps[format == DXGI_FORMAT_R16_UINT ? 1 : 0], NULL);
|
||||
|
||||
if(src2 != src) Recycle(src2);
|
||||
}
|
||||
|
@ -618,17 +618,17 @@ void GSDevice11::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r)
|
|||
m_ctx->CopySubresourceRegion(*(GSTexture11*)dTex, 0, 0, 0, 0, *(GSTexture11*)sTex, 0, &box);
|
||||
}
|
||||
|
||||
void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, int shader, bool linear)
|
||||
void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader, bool linear)
|
||||
{
|
||||
StretchRect(sTex, sRect, dTex, dr, m_convert.ps[shader], NULL, linear);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_convert.ps[shader], NULL, linear);
|
||||
}
|
||||
|
||||
void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, bool linear)
|
||||
void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, bool linear)
|
||||
{
|
||||
StretchRect(sTex, sRect, dTex, dr, ps, ps_cb, m_convert.bs, linear);
|
||||
StretchRect(sTex, sRect, dTex, dRect, ps, ps_cb, m_convert.bs, linear);
|
||||
}
|
||||
|
||||
void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear)
|
||||
void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear)
|
||||
{
|
||||
if(!sTex || !dTex)
|
||||
{
|
||||
|
@ -648,10 +648,10 @@ void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
|||
|
||||
// ia
|
||||
|
||||
float left = dr.x * 2 / ds.x - 1.0f;
|
||||
float top = 1.0f - dr.y * 2 / ds.y;
|
||||
float right = dr.z * 2 / ds.x - 1.0f;
|
||||
float bottom = 1.0f - dr.w * 2 / ds.y;
|
||||
float left = dRect.x * 2 / ds.x - 1.0f;
|
||||
float top = 1.0f - dRect.y * 2 / ds.y;
|
||||
float right = dRect.z * 2 / ds.x - 1.0f;
|
||||
float bottom = 1.0f - dRect.w * 2 / ds.y;
|
||||
|
||||
GSVertexPT1 vertices[] =
|
||||
{
|
||||
|
@ -702,20 +702,20 @@ void GSDevice11::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
|||
PSSetShaderResources(NULL, NULL);
|
||||
}
|
||||
|
||||
void GSDevice11::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
||||
void GSDevice11::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c)
|
||||
{
|
||||
ClearRenderTarget(dTex, c);
|
||||
|
||||
if(sTex[1] && !slbg)
|
||||
{
|
||||
StretchRect(sTex[1], sRect[1], dTex, dr[1], m_merge.ps[0], NULL, true);
|
||||
StretchRect(sTex[1], sRect[1], dTex, dRect[1], m_merge.ps[0], NULL, true);
|
||||
}
|
||||
|
||||
if(sTex[0])
|
||||
{
|
||||
m_ctx->UpdateSubresource(m_merge.cb, 0, NULL, &c, 0, 0);
|
||||
|
||||
StretchRect(sTex[0], sRect[0], dTex, dr[0], m_merge.ps[mmod ? 1 : 0], m_merge.cb, m_merge.bs, true);
|
||||
StretchRect(sTex[0], sRect[0], dTex, dRect[0], m_merge.ps[mmod ? 1 : 0], m_merge.cb, m_merge.bs, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -724,7 +724,7 @@ void GSDevice11::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool
|
|||
GSVector4 s = GSVector4(dTex->GetSize());
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
||||
GSVector4 dRect(0.0f, yoffset, s.x, s.y + yoffset);
|
||||
|
||||
InterlaceConstantBuffer cb;
|
||||
|
||||
|
@ -733,7 +733,7 @@ void GSDevice11::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool
|
|||
|
||||
m_ctx->UpdateSubresource(m_interlace.cb, 0, NULL, &cb, 0, 0);
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_interlace.ps[shader], m_interlace.cb, linear);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_interlace.ps[shader], m_interlace.cb, linear);
|
||||
}
|
||||
|
||||
//Included an init function for this also. Just to be safe.
|
||||
|
@ -756,7 +756,7 @@ void GSDevice11::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
|
|||
GSVector2i s = dTex->GetSize();
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
ExternalFXConstantBuffer cb;
|
||||
|
||||
|
@ -768,7 +768,7 @@ void GSDevice11::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
|
|||
|
||||
m_ctx->UpdateSubresource(m_shaderfx.cb, 0, NULL, &cb, 0, 0);
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_shaderfx.ps, m_shaderfx.cb, true);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_shaderfx.ps, m_shaderfx.cb, true);
|
||||
}
|
||||
|
||||
// This shouldn't be necessary, we have some bug corrupting memory
|
||||
|
@ -792,7 +792,7 @@ void GSDevice11::DoFXAA(GSTexture* sTex, GSTexture* dTex)
|
|||
GSVector2i s = dTex->GetSize();
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
FXAAConstantBuffer cb;
|
||||
|
||||
|
@ -803,7 +803,7 @@ void GSDevice11::DoFXAA(GSTexture* sTex, GSTexture* dTex)
|
|||
|
||||
m_ctx->UpdateSubresource(m_fxaa.cb, 0, NULL, &cb, 0, 0);
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_fxaa.ps, m_fxaa.cb, true);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_fxaa.ps, m_fxaa.cb, true);
|
||||
|
||||
//sTex->Save("c:\\temp1\\1.bmp");
|
||||
//dTex->Save("c:\\temp1\\2.bmp");
|
||||
|
@ -814,7 +814,7 @@ void GSDevice11::DoShadeBoost(GSTexture* sTex, GSTexture* dTex)
|
|||
GSVector2i s = dTex->GetSize();
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
ShadeBoostConstantBuffer cb;
|
||||
|
||||
|
@ -823,7 +823,7 @@ void GSDevice11::DoShadeBoost(GSTexture* sTex, GSTexture* dTex)
|
|||
|
||||
m_ctx->UpdateSubresource(m_shadeboost.cb, 0, NULL, &cb, 0, 0);
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_shadeboost.ps, m_shadeboost.cb, true);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_shadeboost.ps, m_shadeboost.cb, true);
|
||||
}
|
||||
|
||||
void GSDevice11::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
|
||||
|
|
|
@ -34,7 +34,7 @@ class GSDevice11 : public GSDeviceDX
|
|||
{
|
||||
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
||||
|
||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c);
|
||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||
void DoFXAA(GSTexture* sTex, GSTexture* dTex);
|
||||
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex);
|
||||
|
@ -188,9 +188,9 @@ public:
|
|||
|
||||
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r);
|
||||
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader = 0, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear = true);
|
||||
|
||||
void IASetVertexBuffer(const void* vertex, size_t stride, size_t count);
|
||||
bool IAMapVertexBuffer(void** vertex, size_t stride, size_t count);
|
||||
|
|
|
@ -786,11 +786,11 @@ GSTexture* GSDevice9::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int
|
|||
|
||||
if(GSTexture* rt = CreateRenderTarget(w, h, false, format))
|
||||
{
|
||||
GSVector4 dr(0, 0, w, h);
|
||||
GSVector4 dRect(0, 0, w, h);
|
||||
|
||||
if(GSTexture* src2 = src->IsMSAA() ? Resolve(src) : src)
|
||||
{
|
||||
StretchRect(src2, sRect, rt, dr, m_convert.ps[1], NULL, 0);
|
||||
StretchRect(src2, sRect, rt, dRect, m_convert.ps[1], NULL, 0);
|
||||
|
||||
if(src2 != src) Recycle(src2);
|
||||
}
|
||||
|
@ -819,17 +819,17 @@ void GSDevice9::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r)
|
|||
m_dev->StretchRect(*(GSTexture9*)sTex, r, *(GSTexture9*)dTex, r, D3DTEXF_NONE);
|
||||
}
|
||||
|
||||
void GSDevice9::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, int shader, bool linear)
|
||||
void GSDevice9::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader, bool linear)
|
||||
{
|
||||
StretchRect(sTex, sRect, dTex, dr, m_convert.ps[shader], NULL, 0, linear);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_convert.ps[shader], NULL, 0, linear);
|
||||
}
|
||||
|
||||
void GSDevice9::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear)
|
||||
void GSDevice9::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear)
|
||||
{
|
||||
StretchRect(sTex, sRect, dTex, dr, ps, ps_cb, ps_cb_len, &m_convert.bs, linear);
|
||||
StretchRect(sTex, sRect, dTex, dRect, ps, ps_cb, ps_cb_len, &m_convert.bs, linear);
|
||||
}
|
||||
|
||||
void GSDevice9::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, Direct3DBlendState9* bs, bool linear)
|
||||
void GSDevice9::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, Direct3DBlendState9* bs, bool linear)
|
||||
{
|
||||
if(!sTex || !dTex)
|
||||
{
|
||||
|
@ -849,10 +849,10 @@ void GSDevice9::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
|||
|
||||
// ia
|
||||
|
||||
float left = dr.x * 2 / ds.x - 1.0f;
|
||||
float top = 1.0f - dr.y * 2 / ds.y;
|
||||
float right = dr.z * 2 / ds.x - 1.0f;
|
||||
float bottom = 1.0f - dr.w * 2 / ds.y;
|
||||
float left = dRect.x * 2 / ds.x - 1.0f;
|
||||
float top = 1.0f - dRect.y * 2 / ds.y;
|
||||
float right = dRect.z * 2 / ds.x - 1.0f;
|
||||
float bottom = 1.0f - dRect.w * 2 / ds.y;
|
||||
|
||||
GSVertexPT1 vertices[] =
|
||||
{
|
||||
|
@ -891,13 +891,13 @@ void GSDevice9::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
|||
EndScene();
|
||||
}
|
||||
|
||||
void GSDevice9::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
||||
void GSDevice9::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c)
|
||||
{
|
||||
ClearRenderTarget(dTex, c);
|
||||
|
||||
if(sTex[1] && !slbg)
|
||||
{
|
||||
StretchRect(sTex[1], sRect[1], dTex, dr[1], m_merge.ps[0], NULL, true);
|
||||
StretchRect(sTex[1], sRect[1], dTex, dRect[1], m_merge.ps[0], NULL, true);
|
||||
}
|
||||
|
||||
if(sTex[0])
|
||||
|
@ -906,7 +906,7 @@ void GSDevice9::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, G
|
|||
|
||||
cb.BGColor = c;
|
||||
|
||||
StretchRect(sTex[0], sRect[0], dTex, dr[0], m_merge.ps[mmod ? 1 : 0], (const float*)&cb, 1, &m_merge.bs, true);
|
||||
StretchRect(sTex[0], sRect[0], dTex, dRect[0], m_merge.ps[mmod ? 1 : 0], (const float*)&cb, 1, &m_merge.bs, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -915,14 +915,14 @@ void GSDevice9::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool l
|
|||
GSVector4 s = GSVector4(dTex->GetSize());
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
||||
GSVector4 dRect(0.0f, yoffset, s.x, s.y + yoffset);
|
||||
|
||||
InterlaceConstantBuffer cb;
|
||||
|
||||
cb.ZrH = GSVector2(0, 1.0f / s.y);
|
||||
cb.hH = (float)s.y / 2;
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_interlace.ps[shader], (const float*)&cb, 1, linear);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_interlace.ps[shader], (const float*)&cb, 1, linear);
|
||||
}
|
||||
|
||||
void GSDevice9::InitExternalFX()
|
||||
|
@ -944,7 +944,7 @@ void GSDevice9::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
|
|||
GSVector2i s = dTex->GetSize();
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
ExternalFXConstantBuffer cb;
|
||||
|
||||
|
@ -954,7 +954,7 @@ void GSDevice9::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
|
|||
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
|
||||
cb.rcpFrameOpt = GSVector4::zero();
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_shaderfx.ps, (const float*)&cb, 2, true);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_shaderfx.ps, (const float*)&cb, 2, true);
|
||||
}
|
||||
|
||||
void GSDevice9::InitFXAA()
|
||||
|
@ -976,7 +976,7 @@ void GSDevice9::DoFXAA(GSTexture* sTex, GSTexture* dTex)
|
|||
GSVector2i s = dTex->GetSize();
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
FXAAConstantBuffer cb;
|
||||
|
||||
|
@ -985,7 +985,7 @@ void GSDevice9::DoFXAA(GSTexture* sTex, GSTexture* dTex)
|
|||
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
|
||||
cb.rcpFrameOpt = GSVector4::zero();
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_fxaa.ps, (const float*)&cb, 2, true);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_fxaa.ps, (const float*)&cb, 2, true);
|
||||
}
|
||||
|
||||
void GSDevice9::DoShadeBoost(GSTexture* sTex, GSTexture* dTex)
|
||||
|
@ -993,14 +993,14 @@ void GSDevice9::DoShadeBoost(GSTexture* sTex, GSTexture* dTex)
|
|||
GSVector2i s = dTex->GetSize();
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
ShadeBoostConstantBuffer cb;
|
||||
|
||||
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
|
||||
cb.rcpFrameOpt = GSVector4::zero();
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_shadeboost.ps, (const float*)&cb, 1, true);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_shadeboost.ps, (const float*)&cb, 1, true);
|
||||
}
|
||||
|
||||
void GSDevice9::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
|
||||
|
|
|
@ -74,7 +74,7 @@ class GSDevice9 : public GSDeviceDX
|
|||
{
|
||||
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
||||
|
||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c);
|
||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||
void DoFXAA(GSTexture* sTex, GSTexture* dTex);
|
||||
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex);
|
||||
|
@ -213,9 +213,9 @@ public:
|
|||
|
||||
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r);
|
||||
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, Direct3DBlendState9* bs, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader = 0, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, Direct3DBlendState9* bs, bool linear = true);
|
||||
|
||||
void IASetVertexBuffer(const void* vertex, size_t stride, size_t count);
|
||||
bool IAMapVertexBuffer(void** vertex, size_t stride, size_t count);
|
||||
|
|
|
@ -29,7 +29,7 @@ class GSDeviceNull : public GSDevice
|
|||
private:
|
||||
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
||||
|
||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c) {}
|
||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c) {}
|
||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0) {}
|
||||
|
||||
public:
|
||||
|
|
|
@ -694,9 +694,9 @@ GSTexture* GSDeviceOGL::CopyOffscreen(GSTexture* src, const GSVector4& sRect, in
|
|||
if(format != GL_RGBA8 && format != GL_R16UI) return NULL;
|
||||
|
||||
GSTexture* dst = CreateOffscreen(w, h, format);
|
||||
GSVector4 dr(0, 0, w, h);
|
||||
GSVector4 dRect(0, 0, w, h);
|
||||
|
||||
StretchRect(src, sRect, dst, dr, m_convert.ps[format == GL_R16UI ? 1 : 0]);
|
||||
StretchRect(src, sRect, dst, dRect, m_convert.ps[format == GL_R16UI ? 1 : 0]);
|
||||
|
||||
return dst;
|
||||
}
|
||||
|
@ -733,17 +733,17 @@ void GSDeviceOGL::CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r
|
|||
GL_POP();
|
||||
}
|
||||
|
||||
void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, int shader, bool linear)
|
||||
void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader, bool linear)
|
||||
{
|
||||
StretchRect(sTex, sRect, dTex, dr, m_convert.ps[shader], linear);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_convert.ps[shader], linear);
|
||||
}
|
||||
|
||||
void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, GLuint ps, bool linear)
|
||||
void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, GLuint ps, bool linear)
|
||||
{
|
||||
StretchRect(sTex, sRect, dTex, dr, ps, m_convert.bs, linear);
|
||||
StretchRect(sTex, sRect, dTex, dRect, ps, m_convert.bs, linear);
|
||||
}
|
||||
|
||||
void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, GLuint ps, GSBlendStateOGL* bs, bool linear)
|
||||
void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, GLuint ps, GSBlendStateOGL* bs, bool linear)
|
||||
{
|
||||
if(!sTex || !dTex)
|
||||
{
|
||||
|
@ -784,16 +784,16 @@ void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture
|
|||
|
||||
|
||||
// Original code from DX
|
||||
float left = dr.x * 2 / ds.x - 1.0f;
|
||||
float right = dr.z * 2 / ds.x - 1.0f;
|
||||
float left = dRect.x * 2 / ds.x - 1.0f;
|
||||
float right = dRect.z * 2 / ds.x - 1.0f;
|
||||
#if 0
|
||||
float top = 1.0f - dr.y * 2 / ds.y;
|
||||
float bottom = 1.0f - dr.w * 2 / ds.y;
|
||||
float top = 1.0f - dRect.y * 2 / ds.y;
|
||||
float bottom = 1.0f - dRect.w * 2 / ds.y;
|
||||
#else
|
||||
// Opengl get some issues with the coordinate
|
||||
// I flip top/bottom to fix scaling of the internal resolution
|
||||
float top = -1.0f + dr.y * 2 / ds.y;
|
||||
float bottom = -1.0f + dr.w * 2 / ds.y;
|
||||
float top = -1.0f + dRect.y * 2 / ds.y;
|
||||
float bottom = -1.0f + dRect.w * 2 / ds.y;
|
||||
#endif
|
||||
|
||||
// Flip y axis only when we render in the backbuffer
|
||||
|
@ -844,7 +844,7 @@ void GSDeviceOGL::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture
|
|||
GL_POP();
|
||||
}
|
||||
|
||||
void GSDeviceOGL::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
||||
void GSDeviceOGL::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c)
|
||||
{
|
||||
GL_PUSH("DoMerge");
|
||||
|
||||
|
@ -854,14 +854,14 @@ void GSDeviceOGL::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex,
|
|||
|
||||
if(sTex[1] && !slbg)
|
||||
{
|
||||
StretchRect(sTex[1], sRect[1], dTex, dr[1], m_merge_obj.ps[0]);
|
||||
StretchRect(sTex[1], sRect[1], dTex, dRect[1], m_merge_obj.ps[0]);
|
||||
}
|
||||
|
||||
if(sTex[0])
|
||||
{
|
||||
m_merge_obj.cb->upload(&c.v);
|
||||
|
||||
StretchRect(sTex[0], sRect[0], dTex, dr[0], m_merge_obj.ps[mmod ? 1 : 0], m_merge_obj.bs);
|
||||
StretchRect(sTex[0], sRect[0], dTex, dRect[0], m_merge_obj.ps[mmod ? 1 : 0], m_merge_obj.bs);
|
||||
}
|
||||
|
||||
GL_POP();
|
||||
|
@ -876,7 +876,7 @@ void GSDeviceOGL::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool
|
|||
GSVector4 s = GSVector4(dTex->GetSize());
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
||||
GSVector4 dRect(0.0f, yoffset, s.x, s.y + yoffset);
|
||||
|
||||
InterlaceConstantBuffer cb;
|
||||
|
||||
|
@ -885,7 +885,7 @@ void GSDeviceOGL::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool
|
|||
|
||||
m_interlace.cb->upload(&cb);
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_interlace.ps[shader], linear);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_interlace.ps[shader], linear);
|
||||
|
||||
GL_POP();
|
||||
}
|
||||
|
@ -910,9 +910,9 @@ void GSDeviceOGL::DoFXAA(GSTexture* sTex, GSTexture* dTex)
|
|||
GSVector2i s = dTex->GetSize();
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_fxaa.ps, true);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_fxaa.ps, true);
|
||||
|
||||
GL_POP();
|
||||
}
|
||||
|
@ -948,7 +948,7 @@ void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
|
|||
GSVector2i s = dTex->GetSize();
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
ExternalFXConstantBuffer cb;
|
||||
|
||||
|
@ -958,7 +958,7 @@ void GSDeviceOGL::DoExternalFX(GSTexture* sTex, GSTexture* dTex)
|
|||
|
||||
m_shaderfx.cb->upload(&cb);
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_shaderfx.ps, true);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_shaderfx.ps, true);
|
||||
|
||||
GL_POP();
|
||||
}
|
||||
|
@ -972,7 +972,7 @@ void GSDeviceOGL::DoShadeBoost(GSTexture* sTex, GSTexture* dTex)
|
|||
GSVector2i s = dTex->GetSize();
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0, 0, s.x, s.y);
|
||||
GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
ShadeBoostConstantBuffer cb;
|
||||
|
||||
|
@ -981,7 +981,7 @@ void GSDeviceOGL::DoShadeBoost(GSTexture* sTex, GSTexture* dTex)
|
|||
|
||||
m_shadeboost.cb->upload(&cb);
|
||||
|
||||
StretchRect(sTex, sRect, dTex, dr, m_shadeboost.ps, true);
|
||||
StretchRect(sTex, sRect, dTex, dRect, m_shadeboost.ps, true);
|
||||
|
||||
GL_POP();
|
||||
}
|
||||
|
|
|
@ -536,7 +536,7 @@ class GSDeviceOGL : public GSDevice
|
|||
GSTexture* CreateSurface(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* dr, bool slbg, bool mmod, const GSVector4& c);
|
||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c);
|
||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||
void DoFXAA(GSTexture* sTex, GSTexture* dTex);
|
||||
void DoShadeBoost(GSTexture* sTex, GSTexture* dTex);
|
||||
|
@ -588,9 +588,9 @@ class GSDeviceOGL : public GSDevice
|
|||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0);
|
||||
|
||||
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, GLuint ps, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, GLuint ps, GSBlendStateOGL* bs, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader = 0, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, GLuint ps, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, GLuint ps, GSBlendStateOGL* bs, bool linear = true);
|
||||
|
||||
void SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm);
|
||||
|
||||
|
|
|
@ -207,9 +207,9 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template<class SHADER> static void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, const SHADER& shader, bool linear)
|
||||
template<class SHADER> static void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, const SHADER& shader, bool linear)
|
||||
{
|
||||
GSVector4i r(dr.ceil());
|
||||
GSVector4i r(dRect.ceil());
|
||||
|
||||
r = r.rintersect(GSVector4i(dTex->GetSize()).zwxy());
|
||||
|
||||
|
@ -225,7 +225,7 @@ template<class SHADER> static void StretchRect(GSTexture* sTex, const GSVector4&
|
|||
|
||||
GSVector2i ssize = sTex->GetSize();
|
||||
|
||||
GSVector4 p = dr;
|
||||
GSVector4 p = dRect;
|
||||
GSVector4 t = sRect * GSVector4(ssize).xyxy() * GSVector4((float)0x10000);
|
||||
|
||||
GSVector4 tl = p.xyxy(t);
|
||||
|
@ -301,13 +301,13 @@ template<class SHADER> static void StretchRect(GSTexture* sTex, const GSVector4&
|
|||
dTex->Unmap();
|
||||
}
|
||||
|
||||
void GSDeviceSW::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, int shader, bool linear)
|
||||
void GSDeviceSW::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader, bool linear)
|
||||
{
|
||||
// TODO: if dTex == m_backbuffer && m_backbuffer is special
|
||||
|
||||
if(shader == 0)
|
||||
{
|
||||
if((sRect == GSVector4(0, 0, 1, 1) & dr == GSVector4(dTex->GetSize()).zwxy()).alltrue() && sTex->GetSize() == dTex->GetSize())
|
||||
if((sRect == GSVector4(0, 0, 1, 1) & dRect == GSVector4(dTex->GetSize()).zwxy()).alltrue() && sTex->GetSize() == dTex->GetSize())
|
||||
{
|
||||
// shortcut
|
||||
|
||||
|
@ -318,13 +318,13 @@ void GSDeviceSW::StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
|||
|
||||
ShaderCopy s;
|
||||
|
||||
::StretchRect(sTex, sRect, dTex, dr, s, linear);
|
||||
::StretchRect(sTex, sRect, dTex, dRect, s, linear);
|
||||
}
|
||||
else if(shader == 1)
|
||||
{
|
||||
ShaderAlphaBlend s;
|
||||
|
||||
::StretchRect(sTex, sRect, dTex, dr, s, linear);
|
||||
::StretchRect(sTex, sRect, dTex, dRect, s, linear);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -349,13 +349,13 @@ void GSDeviceSW::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector
|
|||
|
||||
//
|
||||
|
||||
void GSDeviceSW::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
||||
void GSDeviceSW::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c)
|
||||
{
|
||||
ClearRenderTarget(dTex, c);
|
||||
|
||||
if(sTex[1] && !slbg)
|
||||
{
|
||||
StretchRect(sTex[1], sRect[1], dTex, dr[1]);
|
||||
StretchRect(sTex[1], sRect[1], dTex, dRect[1]);
|
||||
}
|
||||
|
||||
if(sTex[0])
|
||||
|
@ -366,7 +366,7 @@ void GSDeviceSW::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex,
|
|||
|
||||
ShaderAlpha2xBlend s;
|
||||
|
||||
::StretchRect(sTex[0], sRect[0], dTex, dr[0], s, true);
|
||||
::StretchRect(sTex[0], sRect[0], dTex, dRect[0], s, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -374,7 +374,7 @@ void GSDeviceSW::DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex,
|
|||
|
||||
ShaderFactorBlend s((uint32)(int)(c.a * 255));
|
||||
|
||||
::StretchRect(sTex[0], sRect[0], dTex, dr[0], s, true);
|
||||
::StretchRect(sTex[0], sRect[0], dTex, dRect[0], s, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ void GSDeviceSW::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool
|
|||
GSVector4 s = GSVector4(dTex->GetSize());
|
||||
|
||||
GSVector4 sRect(0, 0, 1, 1);
|
||||
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
||||
GSVector4 dRect(0.0f, yoffset, s.x, s.y + yoffset);
|
||||
|
||||
if(shader == 0 || shader == 1)
|
||||
{
|
||||
|
@ -398,7 +398,7 @@ void GSDeviceSW::DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool
|
|||
}
|
||||
else if(shader == 3)
|
||||
{
|
||||
StretchRect(sTex, sRect, dTex, dr, 0, linear);
|
||||
StretchRect(sTex, sRect, dTex, dRect, 0, linear);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ class GSDeviceSW : public GSDevice
|
|||
{
|
||||
GSTexture* CreateSurface(int type, int w, int h, bool msaa, int format);
|
||||
|
||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
||||
void DoMerge(GSTexture* sTex[2], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, bool slbg, bool mmod, const GSVector4& c);
|
||||
void DoInterlace(GSTexture* sTex, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||
|
||||
void Clear(GSTexture* t, uint32 c);
|
||||
|
@ -53,7 +53,7 @@ public:
|
|||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0);
|
||||
|
||||
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader = 0, bool linear = true);
|
||||
|
||||
void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1);
|
||||
void PSSetShaderResource(int i, GSTexture* sRect);
|
||||
|
|
|
@ -221,12 +221,12 @@ void GSDrawScanline::SetupPrim(const GSVertexSW* vertex, const uint32* index, co
|
|||
|
||||
GSVector8 dc(dscan.c);
|
||||
|
||||
GSVector8 dr = dc.xxxx();
|
||||
GSVector8 dRect = dc.xxxx();
|
||||
GSVector8 db = dc.zzzz();
|
||||
|
||||
for(int i = 0; i < 8; i++)
|
||||
{
|
||||
GSVector8i r = GSVector8i(dr * shift[1 + i]).ps32();
|
||||
GSVector8i r = GSVector8i(dRect * shift[1 + i]).ps32();
|
||||
GSVector8i b = GSVector8i(db * shift[1 + i]).ps32();
|
||||
|
||||
m_local.d[i].rb = r.upl16(b);
|
||||
|
@ -367,12 +367,12 @@ void GSDrawScanline::SetupPrim(const GSVertexSW* vertex, const uint32* index, co
|
|||
{
|
||||
m_local.d4.c = GSVector4i(dscan.c * shift[0]).xzyw().ps32();
|
||||
|
||||
GSVector4 dr = dscan.c.xxxx();
|
||||
GSVector4 dRect = dscan.c.xxxx();
|
||||
GSVector4 db = dscan.c.zzzz();
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
GSVector4i r = GSVector4i(dr * shift[1 + i]).ps32();
|
||||
GSVector4i r = GSVector4i(dRect * shift[1 + i]).ps32();
|
||||
GSVector4i b = GSVector4i(db * shift[1 + i]).ps32();
|
||||
|
||||
m_local.d[i].rb = r.upl16(b);
|
||||
|
|
|
@ -92,7 +92,7 @@ bool GSRenderer::Merge(int field)
|
|||
bool en[2];
|
||||
|
||||
GSVector4i fr[2];
|
||||
GSVector4i dr[2];
|
||||
GSVector4i dRect[2];
|
||||
|
||||
int baseline = INT_MAX;
|
||||
|
||||
|
@ -103,11 +103,11 @@ bool GSRenderer::Merge(int field)
|
|||
if(en[i])
|
||||
{
|
||||
fr[i] = GetFrameRect(i);
|
||||
dr[i] = GetDisplayRect(i);
|
||||
dRect[i] = GetDisplayRect(i);
|
||||
|
||||
baseline = min(dr[i].top, baseline);
|
||||
baseline = min(dRect[i].top, baseline);
|
||||
|
||||
//printf("[%d]: %d %d %d %d, %d %d %d %d\n", i, fr[i].x,fr[i].y,fr[i].z,fr[i].w , dr[i].x,dr[i].y,dr[i].z,dr[i].w);
|
||||
//printf("[%d]: %d %d %d %d, %d %d %d %d\n", i, fr[i].x,fr[i].y,fr[i].z,fr[i].w , dRect[i].x,dRect[i].y,dRect[i].z,dRect[i].w);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,15 +132,15 @@ bool GSRenderer::Merge(int field)
|
|||
|
||||
if(samesrc /*&& m_regs->PMODE.SLBG == 0 && m_regs->PMODE.MMOD == 1 && m_regs->PMODE.ALP == 0x80*/)
|
||||
{
|
||||
if(fr[0].eq(fr[1] + GSVector4i(0, -1, 0, 0)) && dr[0].eq(dr[1] + GSVector4i(0, 0, 0, 1))
|
||||
|| fr[1].eq(fr[0] + GSVector4i(0, -1, 0, 0)) && dr[1].eq(dr[0] + GSVector4i(0, 0, 0, 1)))
|
||||
if(fr[0].eq(fr[1] + GSVector4i(0, -1, 0, 0)) && dRect[0].eq(dRect[1] + GSVector4i(0, 0, 0, 1))
|
||||
|| fr[1].eq(fr[0] + GSVector4i(0, -1, 0, 0)) && dRect[1].eq(dRect[0] + GSVector4i(0, 0, 0, 1)))
|
||||
{
|
||||
// persona 4:
|
||||
//
|
||||
// fr[0] = 0 0 640 448
|
||||
// fr[1] = 0 1 640 448
|
||||
// dr[0] = 159 50 779 498
|
||||
// dr[1] = 159 50 779 497
|
||||
// dRect[0] = 159 50 779 498
|
||||
// dRect[1] = 159 50 779 497
|
||||
//
|
||||
// second image shifted up by 1 pixel and blended over itself
|
||||
//
|
||||
|
@ -148,29 +148,29 @@ bool GSRenderer::Merge(int field)
|
|||
//
|
||||
// fr[0] = 0 1 512 448
|
||||
// fr[1] = 0 0 512 448
|
||||
// dr[0] = 127 50 639 497
|
||||
// dr[1] = 127 50 639 498
|
||||
// dRect[0] = 127 50 639 497
|
||||
// dRect[1] = 127 50 639 498
|
||||
//
|
||||
// same just the first image shifted
|
||||
|
||||
int top = min(fr[0].top, fr[1].top);
|
||||
int bottom = max(dr[0].bottom, dr[1].bottom);
|
||||
int bottom = max(dRect[0].bottom, dRect[1].bottom);
|
||||
|
||||
fr[0].top = top;
|
||||
fr[1].top = top;
|
||||
dr[0].bottom = bottom;
|
||||
dr[1].bottom = bottom;
|
||||
dRect[0].bottom = bottom;
|
||||
dRect[1].bottom = bottom;
|
||||
|
||||
// blurdetected = true;
|
||||
}
|
||||
else if(dr[0].eq(dr[1]) && (fr[0].eq(fr[1] + GSVector4i(0, 1, 0, 1)) || fr[1].eq(fr[0] + GSVector4i(0, 1, 0, 1))))
|
||||
else if(dRect[0].eq(dRect[1]) && (fr[0].eq(fr[1] + GSVector4i(0, 1, 0, 1)) || fr[1].eq(fr[0] + GSVector4i(0, 1, 0, 1))))
|
||||
{
|
||||
// dq5:
|
||||
//
|
||||
// fr[0] = 0 1 512 445
|
||||
// fr[1] = 0 0 512 444
|
||||
// dr[0] = 127 50 639 494
|
||||
// dr[1] = 127 50 639 494
|
||||
// dRect[0] = 127 50 639 494
|
||||
// dRect[1] = 127 50 639 494
|
||||
|
||||
int top = min(fr[0].top, fr[1].top);
|
||||
int bottom = min(fr[0].bottom, fr[1].bottom);
|
||||
|
@ -210,7 +210,7 @@ bool GSRenderer::Merge(int field)
|
|||
|
||||
// overscan hack
|
||||
|
||||
if(dr[i].height() > 512) // hmm
|
||||
if(dRect[i].height() > 512) // hmm
|
||||
{
|
||||
int y = GetDeviceSize(i).y;
|
||||
if(m_regs->SMODE2.INT && m_regs->SMODE2.FFMD) y /= 2;
|
||||
|
@ -223,9 +223,9 @@ bool GSRenderer::Merge(int field)
|
|||
|
||||
GSVector2 off(0, 0);
|
||||
|
||||
if(dr[i].top - baseline >= 4) // 2?
|
||||
if(dRect[i].top - baseline >= 4) // 2?
|
||||
{
|
||||
off.y = tex[i]->GetScale().y * (dr[i].top - baseline);
|
||||
off.y = tex[i]->GetScale().y * (dRect[i].top - baseline);
|
||||
|
||||
if(m_regs->SMODE2.INT && m_regs->SMODE2.FFMD)
|
||||
{
|
||||
|
|
|
@ -92,12 +92,12 @@ void GSRendererSW::VSync(int field)
|
|||
{
|
||||
fprintf(s_fp, "%lld\n", m_perfmon.GetFrame());
|
||||
|
||||
GSVector4i dr = GetDisplayRect();
|
||||
GSVector4i dRect = GetDisplayRect();
|
||||
GSVector4i fr = GetFrameRect();
|
||||
GSVector2i ds = GetDeviceSize();
|
||||
|
||||
fprintf(s_fp, "dr %d %d %d %d, fr %d %d %d %d, ds %d %d\n",
|
||||
dr.x, dr.y, dr.z, dr.w,
|
||||
fprintf(s_fp, "dRect %d %d %d %d, fr %d %d %d %d, ds %d %d\n",
|
||||
dRect.x, dRect.y, dRect.z, dRect.w,
|
||||
fr.x, fr.y, fr.z, fr.w,
|
||||
ds.x, ds.y);
|
||||
|
||||
|
|
|
@ -704,9 +704,9 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
// int sy = off / sw;
|
||||
|
||||
// GSVector4 sRect = GSVector4(GSVector4i(sx, sy).xyxy() + br) * scale / size;
|
||||
// GSVector4 dr = GSVector4(GSVector4i(dx, dy).xyxy() + br) * scale;
|
||||
// GSVector4 dRect = GSVector4(GSVector4i(dx, dy).xyxy() + br) * scale;
|
||||
|
||||
// m_renderer->m_dev->StretchRect(dst->m_texture, sRect, src->m_texture, dr);
|
||||
// m_renderer->m_dev->StretchRect(dst->m_texture, sRect, src->m_texture, dRect);
|
||||
|
||||
// // TODO: this is quite a lot of StretchRect, do it with one Draw
|
||||
// }
|
||||
|
@ -726,19 +726,19 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
|
||||
GSVector2 scale = dst->m_texture->GetScale();
|
||||
|
||||
GSVector4 dr(0, 0, w, h);
|
||||
GSVector4 dRect(0, 0, w, h);
|
||||
|
||||
if(w > dstsize.x)
|
||||
{
|
||||
scale.x = (float)dstsize.x / tw;
|
||||
dr.z = (float)dstsize.x * scale.x / dst->m_texture->GetScale().x;
|
||||
dRect.z = (float)dstsize.x * scale.x / dst->m_texture->GetScale().x;
|
||||
w = dstsize.x;
|
||||
}
|
||||
|
||||
if(h > dstsize.y)
|
||||
{
|
||||
scale.y = (float)dstsize.y / th;
|
||||
dr.w = (float)dstsize.y * scale.y / dst->m_texture->GetScale().y;
|
||||
dRect.w = (float)dstsize.y * scale.y / dst->m_texture->GetScale().y;
|
||||
h = dstsize.y;
|
||||
}
|
||||
|
||||
|
@ -757,7 +757,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
src->m_texture = dTex;
|
||||
}
|
||||
|
||||
if((sRect == dr).alltrue())
|
||||
if((sRect == dRect).alltrue())
|
||||
{
|
||||
m_renderer->m_dev->CopyRect(sTex, dTex, GSVector4i(0, 0, w, h));
|
||||
}
|
||||
|
@ -766,7 +766,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
|||
sRect.z /= sTex->GetWidth();
|
||||
sRect.w /= sTex->GetHeight();
|
||||
|
||||
m_renderer->m_dev->StretchRect(sTex, sRect, dTex, dr);
|
||||
m_renderer->m_dev->StretchRect(sTex, sRect, dTex, dRect);
|
||||
}
|
||||
|
||||
if(dTex != src->m_texture)
|
||||
|
|
Loading…
Reference in New Issue