mirror of
https://github.com/libretro/pcsx2.git
synced 2024-12-28 04:35:08 +00:00
gsdx: add draw exception (OOM and Recoverable)
The exception will free the unused (but allocated) texture aka the emergency break ;) Recoverable could be useful for unsupported draw call
This commit is contained in:
parent
c8dddfed06
commit
37c7fa7663
@ -202,6 +202,17 @@ void GSDevice::AgePool()
|
||||
}
|
||||
}
|
||||
|
||||
void GSDevice::PurgePool()
|
||||
{
|
||||
// OOM emergency. Let's free this useless pool
|
||||
while(m_pool.size() > 0)
|
||||
{
|
||||
delete m_pool.back();
|
||||
|
||||
m_pool.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
GSTexture* GSDevice::CreateRenderTarget(int w, int h, bool msaa, int format)
|
||||
{
|
||||
return FetchSurface(GSTexture::RenderTarget, w, h, msaa, format);
|
||||
|
@ -194,6 +194,7 @@ public:
|
||||
bool IsRBSwapped() {return m_rbswapped;}
|
||||
|
||||
void AgePool();
|
||||
void PurgePool();
|
||||
|
||||
virtual void PrintMemoryUsage();
|
||||
};
|
||||
|
@ -645,3 +645,8 @@ void GSRenderer::KeyEvent(GSKeyEventData* e)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void GSRenderer::PurgePool()
|
||||
{
|
||||
m_dev->PurgePool();
|
||||
}
|
||||
|
@ -79,6 +79,8 @@ public:
|
||||
virtual bool BeginCapture();
|
||||
virtual void EndCapture();
|
||||
|
||||
void PurgePool();
|
||||
|
||||
public:
|
||||
std::mutex m_pGSsetTitle_Crit;
|
||||
|
||||
|
@ -1475,7 +1475,15 @@ void GSState::FlushPrim()
|
||||
|
||||
m_vt.Update(m_vertex.buff, m_index.buff, m_index.tail, GSUtil::GetPrimClass(PRIM->PRIM));
|
||||
|
||||
Draw();
|
||||
try {
|
||||
Draw();
|
||||
} catch (GSDXRecoverableError&) {
|
||||
// could be an unsupported draw call
|
||||
} catch (GSDXErrorOOM&) {
|
||||
// Texture Out Of Memory
|
||||
PurgePool();
|
||||
fprintf(stderr, "GSDX OUT OF MEMORY\n");
|
||||
}
|
||||
|
||||
m_perfmon.Put(GSPerfMon::Draw, 1);
|
||||
m_perfmon.Put(GSPerfMon::Prim, m_index.tail / GSUtil::GetVertexCount(PRIM->PRIM));
|
||||
|
@ -249,6 +249,7 @@ public:
|
||||
virtual void FlushPrim();
|
||||
virtual void FlushWrite();
|
||||
virtual void Draw() = 0;
|
||||
virtual void PurgePool() = 0;
|
||||
virtual void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r) {}
|
||||
virtual void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut = false) {}
|
||||
|
||||
|
@ -79,5 +79,6 @@ public:
|
||||
|
||||
struct GSDXError {};
|
||||
struct GSDXRecoverableError : GSDXError {};
|
||||
struct GSDXErrorOOM : GSDXError {};
|
||||
|
||||
extern GSdxApp theApp;
|
||||
|
Loading…
Reference in New Issue
Block a user