gsdx: extend CopyOffscreen with a new shader parameter

Currently we're trying to infer the conversion shader based on the output format

It only works if the input data is RGBA8. It might not be true in the future
This commit is contained in:
Gregory Hainaut 2015-05-19 12:42:14 +02:00
parent 9554b5dd56
commit 1837001e75
9 changed files with 14 additions and 14 deletions

View File

@ -141,7 +141,7 @@ public:
virtual GSTexture* Resolve(GSTexture* t) {return NULL;}
virtual GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0) {return NULL;}
virtual GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0, int ps_shader = 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& dRect, int shader = 0, bool linear = true) {}

View File

@ -565,7 +565,7 @@ GSTexture* GSDevice11::Resolve(GSTexture* t)
return NULL;
}
GSTexture* GSDevice11::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format)
GSTexture* GSDevice11::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format, int ps_shader)
{
GSTexture* dst = NULL;

View File

@ -184,7 +184,7 @@ public:
GSTexture* Resolve(GSTexture* t);
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0);
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0, int ps_shader = 0);
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r);

View File

@ -768,7 +768,7 @@ GSTexture* GSDevice9::Resolve(GSTexture* t)
return NULL;
}
GSTexture* GSDevice9::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format)
GSTexture* GSDevice9::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format, int ps_shader)
{
GSTexture* dst = NULL;

View File

@ -209,7 +209,7 @@ public:
GSTexture* Resolve(GSTexture* t);
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0);
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0, int ps_shader = 0);
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r);

View File

@ -666,19 +666,19 @@ GSTexture* GSDeviceOGL::CreateOffscreen(int w, int h, int format)
}
// blit a texture into an offscreen buffer
GSTexture* GSDeviceOGL::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format)
GSTexture* GSDeviceOGL::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format, int ps_shader)
{
if (format == 0)
format = GL_RGBA8;
ASSERT(src);
ASSERT(format == GL_RGBA8 || format == GL_R16UI);
if(format == 0) format = GL_RGBA8;
if(format != GL_RGBA8 && format != GL_R16UI) return NULL;
GSTexture* dst = CreateOffscreen(w, h, format);
GSVector4 dRect(0, 0, w, h);
StretchRect(src, sRect, dst, dRect, m_convert.ps[format == GL_R16UI ? 1 : 0]);
StretchRect(src, sRect, dst, dRect, m_convert.ps[ps_shader]);
return dst;
}

View File

@ -585,7 +585,7 @@ class GSDeviceOGL : public GSDevice
void InitPrimDateTexture(GSTexture* rt);
void RecycleDateTexture();
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0);
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0, int ps_shader = 0);
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r);
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader = 0, bool linear = true);

View File

@ -90,7 +90,7 @@ void GSDeviceSW::ClearStencil(GSTexture* t, uint8 c)
Clear(t, c);
}
GSTexture* GSDeviceSW::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format)
GSTexture* GSDeviceSW::CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format, int ps_shader)
{
GSTexture* dst = CreateOffscreen(w, h, format);

View File

@ -50,7 +50,7 @@ public:
void ClearDepth(GSTexture* t, float c);
void ClearStencil(GSTexture* t, uint8 c);
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0);
GSTexture* CopyOffscreen(GSTexture* src, const GSVector4& sRect, int w, int h, int format = 0, int ps_shader = 0);
void CopyRect(GSTexture* sTex, GSTexture* dTex, const GSVector4i& r);
void StretchRect(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, int shader = 0, bool linear = true);