gsdx: by default new will throw std::bad_alloc

So catch/use it and don't bother with GSDXErrorOOM
This commit is contained in:
Gregory Hainaut committed 2016-10-13 20:44:59 +02:00
1 parent c440c7c93a
commit fbf7ccbdda
8 files changed
+15 -32

No files matched your search

+3 -14
View File
@@ -1110,7 +1110,6 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
{
const GSLocalMemory::psm_t& psm = GSLocalMemory::m_psm[TEX0.PSM];
Source* src = new Source(m_renderer, TEX0, TEXA, m_temp);
if (src == NULL) throw GSDXErrorOOM();
int tw = 1 << TEX0.TW;
int th = 1 << TEX0.TH;
@@ -1431,11 +1430,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
src->m_texture = m_renderer->m_dev->CreateTexture(tw, th);
}
if(src->m_texture == NULL)
{
delete src;
throw GSDXErrorOOM();
}
ASSERT(src->m_texture);
if(psm.pal > 0)
{
@@ -1449,8 +1444,9 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
GSTextureCache::Target* GSTextureCache::CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type)
{
ASSERT(type == RenderTarget || type == DepthStencil);
Target* t = new Target(m_renderer, TEX0, m_temp, CanConvertDepth());
if (t == NULL) throw GSDXErrorOOM();
// FIXME: initial data should be unswizzled from local mem in Update() if dirty
@@ -1467,12 +1463,6 @@ GSTextureCache::Target* GSTextureCache::CreateTarget(const GIFRegTEX0& TEX0, int
t->m_texture = m_renderer->m_dev->CreateDepthStencil(w, h, true);
}
if(t->m_texture == NULL)
{
delete t;
throw GSDXErrorOOM();
}
m_dst[type].push_front(t);
return t;
@@ -1880,7 +1870,6 @@ void GSTextureCache::Target::Update()
TEXA.TA1 = 0x80;
GSTexture* t = m_renderer->m_dev->CreateTexture(w, h);
if (t == NULL) return;
const GSOffset* off = m_renderer->m_mem.GetOffset(m_TEX0.TBP0, m_TEX0.TBW, m_TEX0.PSM);