mirror of https://github.com/PCSX2/pcsx2.git
gsdx: sed /dt/dTex/
This commit is contained in:
parent
d870188d21
commit
6a9e425308
|
@ -122,9 +122,9 @@ void GSDevice::Present(const GSVector4i& r, int shader)
|
||||||
GL_POP();
|
GL_POP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice::Present(GSTexture* st, GSTexture* dt, const GSVector4& dr, int shader)
|
void GSDevice::Present(GSTexture* st, GSTexture* dTex, const GSVector4& dr, int shader)
|
||||||
{
|
{
|
||||||
StretchRect(st, dt, dr, shader);
|
StretchRect(st, dTex, dr, shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
GSTexture* GSDevice::FetchSurface(int type, int w, int h, bool msaa, int format)
|
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);
|
return FetchSurface(GSTexture::Offscreen, w, h, false, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice::StretchRect(GSTexture* st, GSTexture* dt, const GSVector4& dr, int shader, bool linear)
|
void GSDevice::StretchRect(GSTexture* st, GSTexture* dTex, const GSVector4& dr, int shader, bool linear)
|
||||||
{
|
{
|
||||||
StretchRect(st, GSVector4(0, 0, 1, 1), dt, dr, shader, linear);
|
StretchRect(st, GSVector4(0, 0, 1, 1), dTex, dr, shader, linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
GSTexture* GSDevice::GetCurrent()
|
GSTexture* GSDevice::GetCurrent()
|
||||||
|
|
|
@ -100,11 +100,11 @@ 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* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c) = 0;
|
virtual void DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c) = 0;
|
||||||
virtual void DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset) = 0;
|
virtual void DoInterlace(GSTexture* st, GSTexture* dTex, int shader, bool linear, float yoffset) = 0;
|
||||||
virtual void DoFXAA(GSTexture* st, GSTexture* dt) {}
|
virtual void DoFXAA(GSTexture* st, GSTexture* dTex) {}
|
||||||
virtual void DoShadeBoost(GSTexture* st, GSTexture* dt) {}
|
virtual void DoShadeBoost(GSTexture* st, GSTexture* dTex) {}
|
||||||
virtual void DoExternalFX(GSTexture* st, GSTexture* dt) {}
|
virtual void DoExternalFX(GSTexture* st, GSTexture* dTex) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSDevice();
|
GSDevice();
|
||||||
|
@ -118,7 +118,7 @@ public:
|
||||||
virtual bool Reset(int w, int h);
|
virtual bool Reset(int w, int h);
|
||||||
virtual bool IsLost(bool update = false) {return false;}
|
virtual bool IsLost(bool update = false) {return false;}
|
||||||
virtual void Present(const GSVector4i& r, int shader);
|
virtual void Present(const GSVector4i& r, int shader);
|
||||||
virtual void Present(GSTexture* st, GSTexture* dt, const GSVector4& dr, int shader = 0);
|
virtual void Present(GSTexture* st, GSTexture* dTex, const GSVector4& dr, int shader = 0);
|
||||||
virtual void Flip() {}
|
virtual void Flip() {}
|
||||||
|
|
||||||
virtual void SetVSync(bool enable) {m_vsync = enable;}
|
virtual void SetVSync(bool enable) {m_vsync = enable;}
|
||||||
|
@ -143,10 +143,10 @@ public:
|
||||||
|
|
||||||
virtual GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0) {return NULL;}
|
virtual GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0) {return NULL;}
|
||||||
|
|
||||||
virtual void CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r) {}
|
virtual void CopyRect(GSTexture* st, GSTexture* dTex, const GSVector4i& r) {}
|
||||||
virtual void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true) {}
|
virtual void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true) {}
|
||||||
|
|
||||||
void StretchRect(GSTexture* st, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
|
void StretchRect(GSTexture* st, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||||
|
|
||||||
virtual void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1) {}
|
virtual void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1) {}
|
||||||
virtual void PSSetShaderResource(int i, GSTexture* sr) {}
|
virtual void PSSetShaderResource(int i, GSTexture* sr) {}
|
||||||
|
|
|
@ -605,9 +605,9 @@ GSTexture* GSDevice11::CopyOffscreen(GSTexture* src, const GSVector4& sr, int w,
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
|
void GSDevice11::CopyRect(GSTexture* st, GSTexture* dTex, const GSVector4i& r)
|
||||||
{
|
{
|
||||||
if(!st || !dt)
|
if(!st || !dTex)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return;
|
return;
|
||||||
|
@ -615,22 +615,22 @@ void GSDevice11::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
|
||||||
|
|
||||||
D3D11_BOX box = {r.left, r.top, 0, r.right, r.bottom, 1};
|
D3D11_BOX box = {r.left, r.top, 0, r.right, r.bottom, 1};
|
||||||
|
|
||||||
m_ctx->CopySubresourceRegion(*(GSTexture11*)dt, 0, 0, 0, 0, *(GSTexture11*)st, 0, &box);
|
m_ctx->CopySubresourceRegion(*(GSTexture11*)dTex, 0, 0, 0, 0, *(GSTexture11*)st, 0, &box);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear)
|
void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, int shader, bool linear)
|
||||||
{
|
{
|
||||||
StretchRect(st, sr, dt, dr, m_convert.ps[shader], NULL, linear);
|
StretchRect(st, sr, dTex, dr, m_convert.ps[shader], NULL, linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, bool linear)
|
void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, bool linear)
|
||||||
{
|
{
|
||||||
StretchRect(st, sr, dt, dr, ps, ps_cb, m_convert.bs, linear);
|
StretchRect(st, sr, dTex, dr, ps, ps_cb, m_convert.bs, linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear)
|
void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear)
|
||||||
{
|
{
|
||||||
if(!st || !dt)
|
if(!st || !dTex)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return;
|
return;
|
||||||
|
@ -638,13 +638,13 @@ void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt,
|
||||||
|
|
||||||
BeginScene();
|
BeginScene();
|
||||||
|
|
||||||
GSVector2i ds = dt->GetSize();
|
GSVector2i ds = dTex->GetSize();
|
||||||
|
|
||||||
// om
|
// om
|
||||||
|
|
||||||
OMSetDepthStencilState(m_convert.dss, 0);
|
OMSetDepthStencilState(m_convert.dss, 0);
|
||||||
OMSetBlendState(bs, 0);
|
OMSetBlendState(bs, 0);
|
||||||
OMSetRenderTargets(dt, NULL);
|
OMSetRenderTargets(dTex, NULL);
|
||||||
|
|
||||||
// ia
|
// ia
|
||||||
|
|
||||||
|
@ -702,26 +702,26 @@ void GSDevice11::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt,
|
||||||
PSSetShaderResources(NULL, NULL);
|
PSSetShaderResources(NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
void GSDevice11::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
||||||
{
|
{
|
||||||
ClearRenderTarget(dt, c);
|
ClearRenderTarget(dTex, c);
|
||||||
|
|
||||||
if(st[1] && !slbg)
|
if(st[1] && !slbg)
|
||||||
{
|
{
|
||||||
StretchRect(st[1], sr[1], dt, dr[1], m_merge.ps[0], NULL, true);
|
StretchRect(st[1], sr[1], dTex, dr[1], m_merge.ps[0], NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(st[0])
|
if(st[0])
|
||||||
{
|
{
|
||||||
m_ctx->UpdateSubresource(m_merge.cb, 0, NULL, &c, 0, 0);
|
m_ctx->UpdateSubresource(m_merge.cb, 0, NULL, &c, 0, 0);
|
||||||
|
|
||||||
StretchRect(st[0], sr[0], dt, dr[0], m_merge.ps[mmod ? 1 : 0], m_merge.cb, m_merge.bs, true);
|
StretchRect(st[0], sr[0], dTex, dr[0], m_merge.ps[mmod ? 1 : 0], m_merge.cb, m_merge.bs, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset)
|
void GSDevice11::DoInterlace(GSTexture* st, GSTexture* dTex, int shader, bool linear, float yoffset)
|
||||||
{
|
{
|
||||||
GSVector4 s = GSVector4(dt->GetSize());
|
GSVector4 s = GSVector4(dTex->GetSize());
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
||||||
|
@ -733,7 +733,7 @@ void GSDevice11::DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool line
|
||||||
|
|
||||||
m_ctx->UpdateSubresource(m_interlace.cb, 0, NULL, &cb, 0, 0);
|
m_ctx->UpdateSubresource(m_interlace.cb, 0, NULL, &cb, 0, 0);
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_interlace.ps[shader], m_interlace.cb, linear);
|
StretchRect(st, sr, dTex, dr, m_interlace.ps[shader], m_interlace.cb, linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Included an init function for this also. Just to be safe.
|
//Included an init function for this also. Just to be safe.
|
||||||
|
@ -751,9 +751,9 @@ void GSDevice11::InitExternalFX()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::DoExternalFX(GSTexture* st, GSTexture* dt)
|
void GSDevice11::DoExternalFX(GSTexture* st, GSTexture* dTex)
|
||||||
{
|
{
|
||||||
GSVector2i s = dt->GetSize();
|
GSVector2i s = dTex->GetSize();
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0, 0, s.x, s.y);
|
GSVector4 dr(0, 0, s.x, s.y);
|
||||||
|
@ -768,7 +768,7 @@ void GSDevice11::DoExternalFX(GSTexture* st, GSTexture* dt)
|
||||||
|
|
||||||
m_ctx->UpdateSubresource(m_shaderfx.cb, 0, NULL, &cb, 0, 0);
|
m_ctx->UpdateSubresource(m_shaderfx.cb, 0, NULL, &cb, 0, 0);
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_shaderfx.ps, m_shaderfx.cb, true);
|
StretchRect(st, sr, dTex, dr, m_shaderfx.ps, m_shaderfx.cb, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This shouldn't be necessary, we have some bug corrupting memory
|
// This shouldn't be necessary, we have some bug corrupting memory
|
||||||
|
@ -787,9 +787,9 @@ void GSDevice11::InitFXAA()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::DoFXAA(GSTexture* st, GSTexture* dt)
|
void GSDevice11::DoFXAA(GSTexture* st, GSTexture* dTex)
|
||||||
{
|
{
|
||||||
GSVector2i s = dt->GetSize();
|
GSVector2i s = dTex->GetSize();
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0, 0, s.x, s.y);
|
GSVector4 dr(0, 0, s.x, s.y);
|
||||||
|
@ -803,15 +803,15 @@ void GSDevice11::DoFXAA(GSTexture* st, GSTexture* dt)
|
||||||
|
|
||||||
m_ctx->UpdateSubresource(m_fxaa.cb, 0, NULL, &cb, 0, 0);
|
m_ctx->UpdateSubresource(m_fxaa.cb, 0, NULL, &cb, 0, 0);
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_fxaa.ps, m_fxaa.cb, true);
|
StretchRect(st, sr, dTex, dr, m_fxaa.ps, m_fxaa.cb, true);
|
||||||
|
|
||||||
//st->Save("c:\\temp1\\1.bmp");
|
//st->Save("c:\\temp1\\1.bmp");
|
||||||
//dt->Save("c:\\temp1\\2.bmp");
|
//dTex->Save("c:\\temp1\\2.bmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::DoShadeBoost(GSTexture* st, GSTexture* dt)
|
void GSDevice11::DoShadeBoost(GSTexture* st, GSTexture* dTex)
|
||||||
{
|
{
|
||||||
GSVector2i s = dt->GetSize();
|
GSVector2i s = dTex->GetSize();
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0, 0, s.x, s.y);
|
GSVector4 dr(0, 0, s.x, s.y);
|
||||||
|
@ -823,7 +823,7 @@ void GSDevice11::DoShadeBoost(GSTexture* st, GSTexture* dt)
|
||||||
|
|
||||||
m_ctx->UpdateSubresource(m_shadeboost.cb, 0, NULL, &cb, 0, 0);
|
m_ctx->UpdateSubresource(m_shadeboost.cb, 0, NULL, &cb, 0, 0);
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_shadeboost.ps, m_shadeboost.cb, true);
|
StretchRect(st, sr, dTex, dr, m_shadeboost.ps, m_shadeboost.cb, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice11::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
|
void GSDevice11::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
|
||||||
|
|
|
@ -34,11 +34,11 @@ 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* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
void DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
||||||
void DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset = 0);
|
void DoInterlace(GSTexture* st, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||||
void DoFXAA(GSTexture* st, GSTexture* dt);
|
void DoFXAA(GSTexture* st, GSTexture* dTex);
|
||||||
void DoShadeBoost(GSTexture* st, GSTexture* dt);
|
void DoShadeBoost(GSTexture* st, GSTexture* dTex);
|
||||||
void DoExternalFX(GSTexture* st, GSTexture* dt);
|
void DoExternalFX(GSTexture* st, GSTexture* dTex);
|
||||||
|
|
||||||
void InitExternalFX();
|
void InitExternalFX();
|
||||||
void InitFXAA(); // Bug workaround! Stack corruption? Heap corruption? No idea
|
void InitFXAA(); // Bug workaround! Stack corruption? Heap corruption? No idea
|
||||||
|
@ -186,11 +186,11 @@ public:
|
||||||
|
|
||||||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0);
|
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0);
|
||||||
|
|
||||||
void CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r);
|
void CopyRect(GSTexture* st, GSTexture* dTex, const GSVector4i& r);
|
||||||
|
|
||||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
|
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, bool linear = true);
|
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, bool linear = true);
|
||||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear = true);
|
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, ID3D11PixelShader* ps, ID3D11Buffer* ps_cb, ID3D11BlendState* bs, bool linear = true);
|
||||||
|
|
||||||
void IASetVertexBuffer(const void* vertex, size_t stride, size_t count);
|
void IASetVertexBuffer(const void* vertex, size_t stride, size_t count);
|
||||||
bool IAMapVertexBuffer(void** vertex, size_t stride, size_t count);
|
bool IAMapVertexBuffer(void** vertex, size_t stride, size_t count);
|
||||||
|
|
|
@ -808,30 +808,30 @@ GSTexture* GSDevice9::CopyOffscreen(GSTexture* src, const GSVector4& sr, int w,
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
|
void GSDevice9::CopyRect(GSTexture* st, GSTexture* dTex, const GSVector4i& r)
|
||||||
{
|
{
|
||||||
if(!st || !dt)
|
if(!st || !dTex)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_dev->StretchRect(*(GSTexture9*)st, r, *(GSTexture9*)dt, r, D3DTEXF_NONE);
|
m_dev->StretchRect(*(GSTexture9*)st, r, *(GSTexture9*)dTex, r, D3DTEXF_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear)
|
void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, int shader, bool linear)
|
||||||
{
|
{
|
||||||
StretchRect(st, sr, dt, dr, m_convert.ps[shader], NULL, 0, linear);
|
StretchRect(st, sr, dTex, dr, m_convert.ps[shader], NULL, 0, linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear)
|
void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear)
|
||||||
{
|
{
|
||||||
StretchRect(st, sr, dt, dr, ps, ps_cb, ps_cb_len, &m_convert.bs, linear);
|
StretchRect(st, sr, dTex, dr, ps, ps_cb, ps_cb_len, &m_convert.bs, linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, Direct3DBlendState9* bs, bool linear)
|
void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, Direct3DBlendState9* bs, bool linear)
|
||||||
{
|
{
|
||||||
if(!st || !dt)
|
if(!st || !dTex)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return;
|
return;
|
||||||
|
@ -839,13 +839,13 @@ void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, c
|
||||||
|
|
||||||
BeginScene();
|
BeginScene();
|
||||||
|
|
||||||
GSVector2i ds = dt->GetSize();
|
GSVector2i ds = dTex->GetSize();
|
||||||
|
|
||||||
// om
|
// om
|
||||||
|
|
||||||
OMSetDepthStencilState(&m_convert.dss);
|
OMSetDepthStencilState(&m_convert.dss);
|
||||||
OMSetBlendState(bs, 0);
|
OMSetBlendState(bs, 0);
|
||||||
OMSetRenderTargets(dt, NULL);
|
OMSetRenderTargets(dTex, NULL);
|
||||||
|
|
||||||
// ia
|
// ia
|
||||||
|
|
||||||
|
@ -891,13 +891,13 @@ void GSDevice9::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, c
|
||||||
EndScene();
|
EndScene();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
void GSDevice9::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
||||||
{
|
{
|
||||||
ClearRenderTarget(dt, c);
|
ClearRenderTarget(dTex, c);
|
||||||
|
|
||||||
if(st[1] && !slbg)
|
if(st[1] && !slbg)
|
||||||
{
|
{
|
||||||
StretchRect(st[1], sr[1], dt, dr[1], m_merge.ps[0], NULL, true);
|
StretchRect(st[1], sr[1], dTex, dr[1], m_merge.ps[0], NULL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(st[0])
|
if(st[0])
|
||||||
|
@ -906,13 +906,13 @@ void GSDevice9::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVector
|
||||||
|
|
||||||
cb.BGColor = c;
|
cb.BGColor = c;
|
||||||
|
|
||||||
StretchRect(st[0], sr[0], dt, dr[0], m_merge.ps[mmod ? 1 : 0], (const float*)&cb, 1, &m_merge.bs, true);
|
StretchRect(st[0], sr[0], dTex, dr[0], m_merge.ps[mmod ? 1 : 0], (const float*)&cb, 1, &m_merge.bs, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset)
|
void GSDevice9::DoInterlace(GSTexture* st, GSTexture* dTex, int shader, bool linear, float yoffset)
|
||||||
{
|
{
|
||||||
GSVector4 s = GSVector4(dt->GetSize());
|
GSVector4 s = GSVector4(dTex->GetSize());
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
||||||
|
@ -922,7 +922,7 @@ void GSDevice9::DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linea
|
||||||
cb.ZrH = GSVector2(0, 1.0f / s.y);
|
cb.ZrH = GSVector2(0, 1.0f / s.y);
|
||||||
cb.hH = (float)s.y / 2;
|
cb.hH = (float)s.y / 2;
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_interlace.ps[shader], (const float*)&cb, 1, linear);
|
StretchRect(st, sr, dTex, dr, m_interlace.ps[shader], (const float*)&cb, 1, linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::InitExternalFX()
|
void GSDevice9::InitExternalFX()
|
||||||
|
@ -939,9 +939,9 @@ void GSDevice9::InitExternalFX()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::DoExternalFX(GSTexture* st, GSTexture* dt)
|
void GSDevice9::DoExternalFX(GSTexture* st, GSTexture* dTex)
|
||||||
{
|
{
|
||||||
GSVector2i s = dt->GetSize();
|
GSVector2i s = dTex->GetSize();
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0, 0, s.x, s.y);
|
GSVector4 dr(0, 0, s.x, s.y);
|
||||||
|
@ -954,7 +954,7 @@ void GSDevice9::DoExternalFX(GSTexture* st, GSTexture* dt)
|
||||||
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
|
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
|
||||||
cb.rcpFrameOpt = GSVector4::zero();
|
cb.rcpFrameOpt = GSVector4::zero();
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_shaderfx.ps, (const float*)&cb, 2, true);
|
StretchRect(st, sr, dTex, dr, m_shaderfx.ps, (const float*)&cb, 2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::InitFXAA()
|
void GSDevice9::InitFXAA()
|
||||||
|
@ -971,9 +971,9 @@ void GSDevice9::InitFXAA()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::DoFXAA(GSTexture* st, GSTexture* dt)
|
void GSDevice9::DoFXAA(GSTexture* st, GSTexture* dTex)
|
||||||
{
|
{
|
||||||
GSVector2i s = dt->GetSize();
|
GSVector2i s = dTex->GetSize();
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0, 0, s.x, s.y);
|
GSVector4 dr(0, 0, s.x, s.y);
|
||||||
|
@ -985,12 +985,12 @@ void GSDevice9::DoFXAA(GSTexture* st, GSTexture* dt)
|
||||||
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
|
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
|
||||||
cb.rcpFrameOpt = GSVector4::zero();
|
cb.rcpFrameOpt = GSVector4::zero();
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_fxaa.ps, (const float*)&cb, 2, true);
|
StretchRect(st, sr, dTex, dr, m_fxaa.ps, (const float*)&cb, 2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::DoShadeBoost(GSTexture* st, GSTexture* dt)
|
void GSDevice9::DoShadeBoost(GSTexture* st, GSTexture* dTex)
|
||||||
{
|
{
|
||||||
GSVector2i s = dt->GetSize();
|
GSVector2i s = dTex->GetSize();
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0, 0, s.x, s.y);
|
GSVector4 dr(0, 0, s.x, s.y);
|
||||||
|
@ -1000,7 +1000,7 @@ void GSDevice9::DoShadeBoost(GSTexture* st, GSTexture* dt)
|
||||||
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
|
cb.rcpFrame = GSVector4(1.0f / s.x, 1.0f / s.y, 0.0f, 0.0f);
|
||||||
cb.rcpFrameOpt = GSVector4::zero();
|
cb.rcpFrameOpt = GSVector4::zero();
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_shadeboost.ps, (const float*)&cb, 1, true);
|
StretchRect(st, sr, dTex, dr, m_shadeboost.ps, (const float*)&cb, 1, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDevice9::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
|
void GSDevice9::SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm)
|
||||||
|
|
|
@ -74,11 +74,11 @@ 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* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
void DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
||||||
void DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset = 0);
|
void DoInterlace(GSTexture* st, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||||
void DoFXAA(GSTexture* st, GSTexture* dt);
|
void DoFXAA(GSTexture* st, GSTexture* dTex);
|
||||||
void DoShadeBoost(GSTexture* st, GSTexture* dt);
|
void DoShadeBoost(GSTexture* st, GSTexture* dTex);
|
||||||
void DoExternalFX(GSTexture* st, GSTexture* dt);
|
void DoExternalFX(GSTexture* st, GSTexture* dTex);
|
||||||
|
|
||||||
void InitExternalFX();
|
void InitExternalFX();
|
||||||
void InitFXAA();
|
void InitFXAA();
|
||||||
|
@ -211,11 +211,11 @@ public:
|
||||||
|
|
||||||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0);
|
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0);
|
||||||
|
|
||||||
void CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r);
|
void CopyRect(GSTexture* st, GSTexture* dTex, const GSVector4i& r);
|
||||||
|
|
||||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
|
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear = true);
|
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, bool linear = true);
|
||||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, IDirect3DPixelShader9* ps, const float* ps_cb, int ps_cb_len, Direct3DBlendState9* bs, bool linear = true);
|
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, 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);
|
void IASetVertexBuffer(const void* vertex, size_t stride, size_t count);
|
||||||
bool IAMapVertexBuffer(void** vertex, size_t stride, size_t count);
|
bool IAMapVertexBuffer(void** vertex, size_t stride, size_t count);
|
||||||
|
|
|
@ -29,8 +29,8 @@ 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* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c) {}
|
void DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c) {}
|
||||||
void DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset = 0) {}
|
void DoInterlace(GSTexture* st, GSTexture* dTex, int shader, bool linear, float yoffset = 0) {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GSDeviceNull() {}
|
GSDeviceNull() {}
|
||||||
|
|
|
@ -702,12 +702,12 @@ GSTexture* GSDeviceOGL::CopyOffscreen(GSTexture* src, const GSVector4& sr, int w
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy a sub part of a texture into another
|
// Copy a sub part of a texture into another
|
||||||
void GSDeviceOGL::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
|
void GSDeviceOGL::CopyRect(GSTexture* st, GSTexture* dTex, const GSVector4i& r)
|
||||||
{
|
{
|
||||||
ASSERT(st && dt);
|
ASSERT(st && dTex);
|
||||||
|
|
||||||
const GLuint& sid = st->GetID();
|
const GLuint& sid = st->GetID();
|
||||||
const GLuint& did = dt->GetID();
|
const GLuint& did = dTex->GetID();
|
||||||
|
|
||||||
#ifdef ENABLE_OGL_DEBUG
|
#ifdef ENABLE_OGL_DEBUG
|
||||||
GL_PUSH(format("CopyRect from %d to %d", sid, did).c_str());
|
GL_PUSH(format("CopyRect from %d to %d", sid, did).c_str());
|
||||||
|
@ -733,25 +733,25 @@ void GSDeviceOGL::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
|
||||||
GL_POP();
|
GL_POP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear)
|
void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, int shader, bool linear)
|
||||||
{
|
{
|
||||||
StretchRect(st, sr, dt, dr, m_convert.ps[shader], linear);
|
StretchRect(st, sr, dTex, dr, m_convert.ps[shader], linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, GLuint ps, bool linear)
|
void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, GLuint ps, bool linear)
|
||||||
{
|
{
|
||||||
StretchRect(st, sr, dt, dr, ps, m_convert.bs, linear);
|
StretchRect(st, sr, dTex, dr, ps, m_convert.bs, linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, GLuint ps, GSBlendStateOGL* bs, bool linear)
|
void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, GLuint ps, GSBlendStateOGL* bs, bool linear)
|
||||||
{
|
{
|
||||||
if(!st || !dt)
|
if(!st || !dTex)
|
||||||
{
|
{
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_PUSH(format("StretchRect from %d to %d", st->GetID(), dt->GetID()).c_str());
|
GL_PUSH(format("StretchRect from %d to %d", st->GetID(), dTex->GetID()).c_str());
|
||||||
|
|
||||||
// ************************************
|
// ************************************
|
||||||
// Init
|
// Init
|
||||||
|
@ -759,7 +759,7 @@ void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt,
|
||||||
|
|
||||||
BeginScene();
|
BeginScene();
|
||||||
|
|
||||||
GSVector2i ds = dt->GetSize();
|
GSVector2i ds = dTex->GetSize();
|
||||||
|
|
||||||
// WARNING: setup of the program must be done first. So you can setup
|
// WARNING: setup of the program must be done first. So you can setup
|
||||||
// 1/ subroutine uniform
|
// 1/ subroutine uniform
|
||||||
|
@ -775,7 +775,7 @@ void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt,
|
||||||
|
|
||||||
OMSetDepthStencilState(m_convert.dss, 0);
|
OMSetDepthStencilState(m_convert.dss, 0);
|
||||||
OMSetBlendState(bs, 0);
|
OMSetBlendState(bs, 0);
|
||||||
OMSetRenderTargets(dt, NULL);
|
OMSetRenderTargets(dTex, NULL);
|
||||||
OMSetColorMaskState();
|
OMSetColorMaskState();
|
||||||
|
|
||||||
// ************************************
|
// ************************************
|
||||||
|
@ -802,7 +802,7 @@ void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt,
|
||||||
// 2/ in case some GSdx code expect thing in dx order.
|
// 2/ in case some GSdx code expect thing in dx order.
|
||||||
// Only flipping the backbuffer is transparent (I hope)...
|
// Only flipping the backbuffer is transparent (I hope)...
|
||||||
GSVector4 flip_sr = sr;
|
GSVector4 flip_sr = sr;
|
||||||
if (static_cast<GSTextureOGL*>(dt)->IsBackbuffer()) {
|
if (static_cast<GSTextureOGL*>(dTex)->IsBackbuffer()) {
|
||||||
flip_sr.y = sr.w;
|
flip_sr.y = sr.w;
|
||||||
flip_sr.w = sr.y;
|
flip_sr.w = sr.y;
|
||||||
}
|
}
|
||||||
|
@ -844,36 +844,36 @@ void GSDeviceOGL::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt,
|
||||||
GL_POP();
|
GL_POP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
void GSDeviceOGL::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
||||||
{
|
{
|
||||||
GL_PUSH("DoMerge");
|
GL_PUSH("DoMerge");
|
||||||
|
|
||||||
OMSetColorMaskState();
|
OMSetColorMaskState();
|
||||||
|
|
||||||
ClearRenderTarget(dt, c);
|
ClearRenderTarget(dTex, c);
|
||||||
|
|
||||||
if(st[1] && !slbg)
|
if(st[1] && !slbg)
|
||||||
{
|
{
|
||||||
StretchRect(st[1], sr[1], dt, dr[1], m_merge_obj.ps[0]);
|
StretchRect(st[1], sr[1], dTex, dr[1], m_merge_obj.ps[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(st[0])
|
if(st[0])
|
||||||
{
|
{
|
||||||
m_merge_obj.cb->upload(&c.v);
|
m_merge_obj.cb->upload(&c.v);
|
||||||
|
|
||||||
StretchRect(st[0], sr[0], dt, dr[0], m_merge_obj.ps[mmod ? 1 : 0], m_merge_obj.bs);
|
StretchRect(st[0], sr[0], dTex, dr[0], m_merge_obj.ps[mmod ? 1 : 0], m_merge_obj.bs);
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_POP();
|
GL_POP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset)
|
void GSDeviceOGL::DoInterlace(GSTexture* st, GSTexture* dTex, int shader, bool linear, float yoffset)
|
||||||
{
|
{
|
||||||
GL_PUSH("DoInterlace");
|
GL_PUSH("DoInterlace");
|
||||||
|
|
||||||
OMSetColorMaskState();
|
OMSetColorMaskState();
|
||||||
|
|
||||||
GSVector4 s = GSVector4(dt->GetSize());
|
GSVector4 s = GSVector4(dTex->GetSize());
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
||||||
|
@ -885,12 +885,12 @@ void GSDeviceOGL::DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool lin
|
||||||
|
|
||||||
m_interlace.cb->upload(&cb);
|
m_interlace.cb->upload(&cb);
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_interlace.ps[shader], linear);
|
StretchRect(st, sr, dTex, dr, m_interlace.ps[shader], linear);
|
||||||
|
|
||||||
GL_POP();
|
GL_POP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::DoFXAA(GSTexture* st, GSTexture* dt)
|
void GSDeviceOGL::DoFXAA(GSTexture* st, GSTexture* dTex)
|
||||||
{
|
{
|
||||||
// Lazy compile
|
// Lazy compile
|
||||||
if (!m_fxaa.ps) {
|
if (!m_fxaa.ps) {
|
||||||
|
@ -907,17 +907,17 @@ void GSDeviceOGL::DoFXAA(GSTexture* st, GSTexture* dt)
|
||||||
|
|
||||||
OMSetColorMaskState();
|
OMSetColorMaskState();
|
||||||
|
|
||||||
GSVector2i s = dt->GetSize();
|
GSVector2i s = dTex->GetSize();
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0, 0, s.x, s.y);
|
GSVector4 dr(0, 0, s.x, s.y);
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_fxaa.ps, true);
|
StretchRect(st, sr, dTex, dr, m_fxaa.ps, true);
|
||||||
|
|
||||||
GL_POP();
|
GL_POP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::DoExternalFX(GSTexture* st, GSTexture* dt)
|
void GSDeviceOGL::DoExternalFX(GSTexture* st, GSTexture* dTex)
|
||||||
{
|
{
|
||||||
// Lazy compile
|
// Lazy compile
|
||||||
if (!m_shaderfx.ps) {
|
if (!m_shaderfx.ps) {
|
||||||
|
@ -945,7 +945,7 @@ void GSDeviceOGL::DoExternalFX(GSTexture* st, GSTexture* dt)
|
||||||
|
|
||||||
OMSetColorMaskState();
|
OMSetColorMaskState();
|
||||||
|
|
||||||
GSVector2i s = dt->GetSize();
|
GSVector2i s = dTex->GetSize();
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0, 0, s.x, s.y);
|
GSVector4 dr(0, 0, s.x, s.y);
|
||||||
|
@ -958,18 +958,18 @@ void GSDeviceOGL::DoExternalFX(GSTexture* st, GSTexture* dt)
|
||||||
|
|
||||||
m_shaderfx.cb->upload(&cb);
|
m_shaderfx.cb->upload(&cb);
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_shaderfx.ps, true);
|
StretchRect(st, sr, dTex, dr, m_shaderfx.ps, true);
|
||||||
|
|
||||||
GL_POP();
|
GL_POP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::DoShadeBoost(GSTexture* st, GSTexture* dt)
|
void GSDeviceOGL::DoShadeBoost(GSTexture* st, GSTexture* dTex)
|
||||||
{
|
{
|
||||||
GL_PUSH("DoShadeBoost");
|
GL_PUSH("DoShadeBoost");
|
||||||
|
|
||||||
OMSetColorMaskState();
|
OMSetColorMaskState();
|
||||||
|
|
||||||
GSVector2i s = dt->GetSize();
|
GSVector2i s = dTex->GetSize();
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0, 0, s.x, s.y);
|
GSVector4 dr(0, 0, s.x, s.y);
|
||||||
|
@ -981,7 +981,7 @@ void GSDeviceOGL::DoShadeBoost(GSTexture* st, GSTexture* dt)
|
||||||
|
|
||||||
m_shadeboost.cb->upload(&cb);
|
m_shadeboost.cb->upload(&cb);
|
||||||
|
|
||||||
StretchRect(st, sr, dt, dr, m_shadeboost.ps, true);
|
StretchRect(st, sr, dTex, dr, m_shadeboost.ps, true);
|
||||||
|
|
||||||
GL_POP();
|
GL_POP();
|
||||||
}
|
}
|
||||||
|
|
|
@ -536,11 +536,11 @@ class GSDeviceOGL : 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);
|
||||||
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* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
void DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
||||||
void DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset = 0);
|
void DoInterlace(GSTexture* st, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||||
void DoFXAA(GSTexture* st, GSTexture* dt);
|
void DoFXAA(GSTexture* st, GSTexture* dTex);
|
||||||
void DoShadeBoost(GSTexture* st, GSTexture* dt);
|
void DoShadeBoost(GSTexture* st, GSTexture* dTex);
|
||||||
void DoExternalFX(GSTexture* st, GSTexture* dt);
|
void DoExternalFX(GSTexture* st, GSTexture* dTex);
|
||||||
|
|
||||||
void OMAttachRt(GSTextureOGL* rt = NULL);
|
void OMAttachRt(GSTextureOGL* rt = NULL);
|
||||||
void OMAttachDs(GSTextureOGL* ds = NULL);
|
void OMAttachDs(GSTextureOGL* ds = NULL);
|
||||||
|
@ -587,10 +587,10 @@ class GSDeviceOGL : public GSDevice
|
||||||
|
|
||||||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0);
|
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0);
|
||||||
|
|
||||||
void CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r);
|
void CopyRect(GSTexture* st, GSTexture* dTex, const GSVector4i& r);
|
||||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
|
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, GLuint ps, bool linear = true);
|
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, GLuint ps, bool linear = true);
|
||||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, GLuint ps, GSBlendStateOGL* bs, bool linear = true);
|
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, GLuint ps, GSBlendStateOGL* bs, bool linear = true);
|
||||||
|
|
||||||
void SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm);
|
void SetupDATE(GSTexture* rt, GSTexture* ds, const GSVertexPT1* vertices, bool datm);
|
||||||
|
|
||||||
|
|
|
@ -102,13 +102,13 @@ GSTexture* GSDeviceSW::CopyOffscreen(GSTexture* src, const GSVector4& sr, int w,
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceSW::CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r)
|
void GSDeviceSW::CopyRect(GSTexture* st, GSTexture* dTex, const GSVector4i& r)
|
||||||
{
|
{
|
||||||
GSTexture::GSMap m;
|
GSTexture::GSMap m;
|
||||||
|
|
||||||
if(st->Map(m, &r))
|
if(st->Map(m, &r))
|
||||||
{
|
{
|
||||||
dt->Update(r, m.bits, m.pitch);
|
dTex->Update(r, m.bits, m.pitch);
|
||||||
|
|
||||||
st->Unmap();
|
st->Unmap();
|
||||||
}
|
}
|
||||||
|
@ -207,21 +207,21 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class SHADER> static void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, const SHADER& shader, bool linear)
|
template<class SHADER> static void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, const SHADER& shader, bool linear)
|
||||||
{
|
{
|
||||||
GSVector4i r(dr.ceil());
|
GSVector4i r(dr.ceil());
|
||||||
|
|
||||||
r = r.rintersect(GSVector4i(dt->GetSize()).zwxy());
|
r = r.rintersect(GSVector4i(dTex->GetSize()).zwxy());
|
||||||
|
|
||||||
if(r.rempty()) return;
|
if(r.rempty()) return;
|
||||||
|
|
||||||
GSTexture::GSMap dm;
|
GSTexture::GSMap dm;
|
||||||
|
|
||||||
if(!dt->Map(dm, &r)) return;
|
if(!dTex->Map(dm, &r)) return;
|
||||||
|
|
||||||
GSTexture::GSMap sm;
|
GSTexture::GSMap sm;
|
||||||
|
|
||||||
if(!st->Map(sm, NULL)) {dt->Unmap(); return;}
|
if(!st->Map(sm, NULL)) {dTex->Unmap(); return;}
|
||||||
|
|
||||||
GSVector2i ssize = st->GetSize();
|
GSVector2i ssize = st->GetSize();
|
||||||
|
|
||||||
|
@ -298,33 +298,33 @@ template<class SHADER> static void StretchRect(GSTexture* st, const GSVector4& s
|
||||||
}
|
}
|
||||||
|
|
||||||
st->Unmap();
|
st->Unmap();
|
||||||
dt->Unmap();
|
dTex->Unmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceSW::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader, bool linear)
|
void GSDeviceSW::StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, int shader, bool linear)
|
||||||
{
|
{
|
||||||
// TODO: if dt == m_backbuffer && m_backbuffer is special
|
// TODO: if dTex == m_backbuffer && m_backbuffer is special
|
||||||
|
|
||||||
if(shader == 0)
|
if(shader == 0)
|
||||||
{
|
{
|
||||||
if((sr == GSVector4(0, 0, 1, 1) & dr == GSVector4(dt->GetSize()).zwxy()).alltrue() && st->GetSize() == dt->GetSize())
|
if((sr == GSVector4(0, 0, 1, 1) & dr == GSVector4(dTex->GetSize()).zwxy()).alltrue() && st->GetSize() == dTex->GetSize())
|
||||||
{
|
{
|
||||||
// shortcut
|
// shortcut
|
||||||
|
|
||||||
CopyRect(st, dt, GSVector4i(dt->GetSize()).zwxy());
|
CopyRect(st, dTex, GSVector4i(dTex->GetSize()).zwxy());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShaderCopy s;
|
ShaderCopy s;
|
||||||
|
|
||||||
::StretchRect(st, sr, dt, dr, s, linear);
|
::StretchRect(st, sr, dTex, dr, s, linear);
|
||||||
}
|
}
|
||||||
else if(shader == 1)
|
else if(shader == 1)
|
||||||
{
|
{
|
||||||
ShaderAlphaBlend s;
|
ShaderAlphaBlend s;
|
||||||
|
|
||||||
::StretchRect(st, sr, dt, dr, s, linear);
|
::StretchRect(st, sr, dTex, dr, s, linear);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -349,13 +349,13 @@ void GSDeviceSW::OMSetRenderTargets(GSTexture* rt, GSTexture* ds, const GSVector
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
void GSDeviceSW::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
void GSDeviceSW::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c)
|
||||||
{
|
{
|
||||||
ClearRenderTarget(dt, c);
|
ClearRenderTarget(dTex, c);
|
||||||
|
|
||||||
if(st[1] && !slbg)
|
if(st[1] && !slbg)
|
||||||
{
|
{
|
||||||
StretchRect(st[1], sr[1], dt, dr[1]);
|
StretchRect(st[1], sr[1], dTex, dr[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(st[0])
|
if(st[0])
|
||||||
|
@ -366,7 +366,7 @@ void GSDeviceSW::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVecto
|
||||||
|
|
||||||
ShaderAlpha2xBlend s;
|
ShaderAlpha2xBlend s;
|
||||||
|
|
||||||
::StretchRect(st[0], sr[0], dt, dr[0], s, true);
|
::StretchRect(st[0], sr[0], dTex, dr[0], s, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -374,23 +374,23 @@ void GSDeviceSW::DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dt, GSVecto
|
||||||
|
|
||||||
ShaderFactorBlend s((uint32)(int)(c.a * 255));
|
ShaderFactorBlend s((uint32)(int)(c.a * 255));
|
||||||
|
|
||||||
::StretchRect(st[0], sr[0], dt, dr[0], s, true);
|
::StretchRect(st[0], sr[0], dTex, dr[0], s, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// dt->Save("c:\\1.bmp");
|
// dTex->Save("c:\\1.bmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceSW::DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset)
|
void GSDeviceSW::DoInterlace(GSTexture* st, GSTexture* dTex, int shader, bool linear, float yoffset)
|
||||||
{
|
{
|
||||||
GSVector4 s = GSVector4(dt->GetSize());
|
GSVector4 s = GSVector4(dTex->GetSize());
|
||||||
|
|
||||||
GSVector4 sr(0, 0, 1, 1);
|
GSVector4 sr(0, 0, 1, 1);
|
||||||
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
GSVector4 dr(0.0f, yoffset, s.x, s.y + yoffset);
|
||||||
|
|
||||||
if(shader == 0 || shader == 1)
|
if(shader == 0 || shader == 1)
|
||||||
{
|
{
|
||||||
// TODO: 0/1 => update even/odd lines of dt
|
// TODO: 0/1 => update even/odd lines of dTex
|
||||||
}
|
}
|
||||||
else if(shader == 2)
|
else if(shader == 2)
|
||||||
{
|
{
|
||||||
|
@ -398,7 +398,7 @@ void GSDeviceSW::DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool line
|
||||||
}
|
}
|
||||||
else if(shader == 3)
|
else if(shader == 3)
|
||||||
{
|
{
|
||||||
StretchRect(st, sr, dt, dr, 0, linear);
|
StretchRect(st, sr, dTex, dr, 0, linear);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -28,8 +28,8 @@ 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* st[2], GSVector4* sr, GSTexture* dt, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
void DoMerge(GSTexture* st[2], GSVector4* sr, GSTexture* dTex, GSVector4* dr, bool slbg, bool mmod, const GSVector4& c);
|
||||||
void DoInterlace(GSTexture* st, GSTexture* dt, int shader, bool linear, float yoffset = 0);
|
void DoInterlace(GSTexture* st, GSTexture* dTex, int shader, bool linear, float yoffset = 0);
|
||||||
|
|
||||||
void Clear(GSTexture* t, uint32 c);
|
void Clear(GSTexture* t, uint32 c);
|
||||||
|
|
||||||
|
@ -52,8 +52,8 @@ public:
|
||||||
|
|
||||||
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0);
|
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sr, int w, int h, int format = 0);
|
||||||
|
|
||||||
void CopyRect(GSTexture* st, GSTexture* dt, const GSVector4i& r);
|
void CopyRect(GSTexture* st, GSTexture* dTex, const GSVector4i& r);
|
||||||
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dt, const GSVector4& dr, int shader = 0, bool linear = true);
|
void StretchRect(GSTexture* st, const GSVector4& sr, GSTexture* dTex, const GSVector4& dr, int shader = 0, bool linear = true);
|
||||||
|
|
||||||
void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1);
|
void PSSetShaderResources(GSTexture* sr0, GSTexture* sr1);
|
||||||
void PSSetShaderResource(int i, GSTexture* sr);
|
void PSSetShaderResource(int i, GSTexture* sr);
|
||||||
|
|
|
@ -173,7 +173,7 @@ void GSDrawScanline::SetupPrim(const GSVertexSW* vertex, const uint32* index, co
|
||||||
m_local.d8.stq = dt8;
|
m_local.d8.stq = dt8;
|
||||||
}
|
}
|
||||||
|
|
||||||
GSVector8 dt(dscan.t);
|
GSVector8 dTex(dscan.t);
|
||||||
|
|
||||||
for(int j = 0, k = sel.fst ? 2 : 3; j < k; j++)
|
for(int j = 0, k = sel.fst ? 2 : 3; j < k; j++)
|
||||||
{
|
{
|
||||||
|
@ -181,9 +181,9 @@ void GSDrawScanline::SetupPrim(const GSVertexSW* vertex, const uint32* index, co
|
||||||
|
|
||||||
switch(j)
|
switch(j)
|
||||||
{
|
{
|
||||||
case 0: dstq = dt.xxxx(); break;
|
case 0: dstq = dTex.xxxx(); break;
|
||||||
case 1: dstq = dt.yyyy(); break;
|
case 1: dstq = dTex.yyyy(); break;
|
||||||
case 2: dstq = dt.zzzz(); break;
|
case 2: dstq = dTex.zzzz(); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < 8; i++)
|
for(int i = 0; i < 8; i++)
|
||||||
|
|
|
@ -828,13 +828,13 @@ void GSRasterizer::DrawSprite(const GSVertexSW* vertex, const uint32* index)
|
||||||
|
|
||||||
GSVertexSW dv = v[1] - v[0];
|
GSVertexSW dv = v[1] - v[0];
|
||||||
|
|
||||||
GSVector4 dt = dv.t / dv.p.xyxy();
|
GSVector4 dTex = dv.t / dv.p.xyxy();
|
||||||
|
|
||||||
GSVertexSW dedge;
|
GSVertexSW dedge;
|
||||||
GSVertexSW dscan;
|
GSVertexSW dscan;
|
||||||
|
|
||||||
dedge.t = GSVector4::zero().insert32<1, 1>(dt);
|
dedge.t = GSVector4::zero().insert32<1, 1>(dTex);
|
||||||
dscan.t = GSVector4::zero().insert32<0, 0>(dt);
|
dscan.t = GSVector4::zero().insert32<0, 0>(dTex);
|
||||||
|
|
||||||
GSVector4 prestep = GSVector4(r.left, r.top) - scan.p;
|
GSVector4 prestep = GSVector4(r.left, r.top) - scan.p;
|
||||||
|
|
||||||
|
|
|
@ -745,7 +745,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
||||||
GSVector4 sr(0, 0, w, h);
|
GSVector4 sr(0, 0, w, h);
|
||||||
|
|
||||||
GSTexture* st = src->m_texture ? src->m_texture : dst->m_texture;
|
GSTexture* st = src->m_texture ? src->m_texture : dst->m_texture;
|
||||||
GSTexture* dt = m_renderer->m_dev->CreateRenderTarget(w, h, false);
|
GSTexture* dTex = m_renderer->m_dev->CreateRenderTarget(w, h, false);
|
||||||
// GH: by default (m_paltex == 0) GSdx converts texture to the 32 bit format
|
// GH: by default (m_paltex == 0) GSdx converts texture to the 32 bit format
|
||||||
// However it is different here. We want to reuse a Render Target as a texture.
|
// However it is different here. We want to reuse a Render Target as a texture.
|
||||||
// Because the texture is already on the GPU, CPU can't convert it.
|
// Because the texture is already on the GPU, CPU can't convert it.
|
||||||
|
@ -754,26 +754,26 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
|
||||||
|
|
||||||
if(!src->m_texture)
|
if(!src->m_texture)
|
||||||
{
|
{
|
||||||
src->m_texture = dt;
|
src->m_texture = dTex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((sr == dr).alltrue())
|
if((sr == dr).alltrue())
|
||||||
{
|
{
|
||||||
m_renderer->m_dev->CopyRect(st, dt, GSVector4i(0, 0, w, h));
|
m_renderer->m_dev->CopyRect(st, dTex, GSVector4i(0, 0, w, h));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sr.z /= st->GetWidth();
|
sr.z /= st->GetWidth();
|
||||||
sr.w /= st->GetHeight();
|
sr.w /= st->GetHeight();
|
||||||
|
|
||||||
m_renderer->m_dev->StretchRect(st, sr, dt, dr);
|
m_renderer->m_dev->StretchRect(st, sr, dTex, dr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dt != src->m_texture)
|
if(dTex != src->m_texture)
|
||||||
{
|
{
|
||||||
m_renderer->m_dev->Recycle(src->m_texture);
|
m_renderer->m_dev->Recycle(src->m_texture);
|
||||||
|
|
||||||
src->m_texture = dt;
|
src->m_texture = dTex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( src->m_texture )
|
if( src->m_texture )
|
||||||
|
|
Loading…
Reference in New Issue