gsdx hw: allow to create sparse texture at device level

Obviously texture allocation should be updated too
This commit is contained in:
Gregory Hainaut 2019-02-07 12:08:44 +01:00 committed by lightningterror
parent 3408d1a873
commit 643ed528c2
5 changed files with 18 additions and 3 deletions

View File

@ -201,6 +201,16 @@ void GSDevice::PurgePool()
} }
} }
GSTexture* GSDevice::CreateSparseRenderTarget(int w, int h, int format)
{
return FetchSurface(HasColorSparse() ? GSTexture::SparseRenderTarget : GSTexture::RenderTarget, w, h, format);
}
GSTexture* GSDevice::CreateSparseDepthStencil(int w, int h, int format)
{
return FetchSurface(HasDepthSparse() ? GSTexture::SparseDepthStencil : GSTexture::DepthStencil, w, h, format);
}
GSTexture* GSDevice::CreateRenderTarget(int w, int h, int format) GSTexture* GSDevice::CreateRenderTarget(int w, int h, int format)
{ {
return FetchSurface(GSTexture::RenderTarget, w, h, format); return FetchSurface(GSTexture::RenderTarget, w, h, format);

View File

@ -167,11 +167,16 @@ public:
virtual void DrawIndexedPrimitive(int offset, int count) {} virtual void DrawIndexedPrimitive(int offset, int count) {}
virtual void EndScene(); virtual void EndScene();
virtual bool HasDepthSparse() { return false; }
virtual bool HasColorSparse() { return false; }
virtual void ClearRenderTarget(GSTexture* t, const GSVector4& c) {} virtual void ClearRenderTarget(GSTexture* t, const GSVector4& c) {}
virtual void ClearRenderTarget(GSTexture* t, uint32 c) {} virtual void ClearRenderTarget(GSTexture* t, uint32 c) {}
virtual void ClearDepth(GSTexture* t) {} virtual void ClearDepth(GSTexture* t) {}
virtual void ClearStencil(GSTexture* t, uint8 c) {} virtual void ClearStencil(GSTexture* t, uint8 c) {}
GSTexture* CreateSparseRenderTarget(int w, int h, int format = 0);
GSTexture* CreateSparseDepthStencil(int w, int h, int format = 0);
GSTexture* CreateRenderTarget(int w, int h, int format = 0); GSTexture* CreateRenderTarget(int w, int h, int format = 0);
GSTexture* CreateDepthStencil(int w, int h, int format = 0); GSTexture* CreateDepthStencil(int w, int h, int format = 0);
GSTexture* CreateTexture(int w, int h, int format = 0); GSTexture* CreateTexture(int w, int h, int format = 0);

View File

@ -34,7 +34,7 @@ protected:
public: public:
struct GSMap {uint8* bits; int pitch;}; struct GSMap {uint8* bits; int pitch;};
enum {RenderTarget = 1, DepthStencil, Texture, Offscreen, Backbuffer}; enum {RenderTarget = 1, DepthStencil, Texture, Offscreen, Backbuffer, SparseRenderTarget, SparseDepthStencil};
public: public:
GSTexture(); GSTexture();

View File

@ -735,7 +735,7 @@ GSTexture* GSDevice11::CreateSurface(int type, int w, int h, int format)
GSTexture* GSDevice11::FetchSurface(int type, int w, int h, int format) GSTexture* GSDevice11::FetchSurface(int type, int w, int h, int format)
{ {
if (format == 0) if (format == 0)
format = (type == GSTexture::DepthStencil) ? DXGI_FORMAT_R32G8X24_TYPELESS : DXGI_FORMAT_R8G8B8A8_UNORM; format = (type == GSTexture::DepthStencil || type == GSTexture::SparseDepthStencil) ? DXGI_FORMAT_R32G8X24_TYPELESS : DXGI_FORMAT_R8G8B8A8_UNORM;
return __super::FetchSurface(type, w, h, format); return __super::FetchSurface(type, w, h, format);
} }

View File

@ -258,7 +258,7 @@ GSTexture* GSDeviceOGL::CreateSurface(int type, int w, int h, int fmt)
GSTexture* GSDeviceOGL::FetchSurface(int type, int w, int h, int format) GSTexture* GSDeviceOGL::FetchSurface(int type, int w, int h, int format)
{ {
if (format == 0) if (format == 0)
format = (type == GSTexture::DepthStencil) ? GL_DEPTH32F_STENCIL8 : GL_RGBA8; format = (type == GSTexture::DepthStencil || type == GSTexture::SparseDepthStencil) ? GL_DEPTH32F_STENCIL8 : GL_RGBA8;
GSTexture* t = GSDevice::FetchSurface(type, w, h, format); GSTexture* t = GSDevice::FetchSurface(type, w, h, format);