gsdx: throw oom exception + error

Texture can't be NULL anymore, so we can remove a couples of check
This commit is contained in:
Gregory Hainaut committed 2016-05-05 18:53:51 +02:00
1 parent d58b71688b
commit e890ce989c
5 files changed
+28 -31

No files matched your search

+5 -18
View File
@@ -87,7 +87,7 @@ void GSTextureCache::RemoveAll()
GSTextureCache::Source* GSTextureCache::LookupDepthSource(const GIFRegTEX0& TEX0, const GIFRegTEXA& TEXA, const GSVector4i& r, bool palette)
{
if (!CanConvertDepth()) return NULL;
if (!CanConvertDepth()) throw GSDXRecoverableError();
const GSLocalMemory::psm_t& psm_s = GSLocalMemory::m_psm[TEX0.PSM];
@@ -332,11 +332,6 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const GIFRegTEX0& TEX0, con
#endif
src = CreateSource(TEX0, TEXA, dst, half_right);
if(src == NULL)
{
return NULL;
}
} else {
GL_CACHE("TC: src hit: %d (0x%x, F:0x%x)",
src->m_texture ? src->m_texture->GetID() : 0,
@@ -432,9 +427,6 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
dst = CreateTarget(TEX0, w, h, type);
if(dst == NULL)
return NULL;
// In theory new textures contain invalidated data. Still in theory a new target
// must contains the content of the GS memory.
// In practice, TC will wrongly invalidate some RT. For example due to write on the alpha
@@ -594,11 +586,6 @@ GSTextureCache::Target* GSTextureCache::LookupTarget(const GIFRegTEX0& TEX0, int
dst = CreateTarget(TEX0, w, h, RenderTarget);
if(dst == NULL)
{
return NULL;
}
m_renderer->m_dev->ClearRenderTarget(dst->m_texture, 0); // new frame buffers after reset should be cleared, don't display memory garbage
if (m_preload_frame) {
@@ -1076,6 +1063,7 @@ 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;
@@ -1370,9 +1358,8 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
if(src->m_texture == NULL)
{
ASSERT(0);
delete src;
return NULL;
throw GSDXErrorOOM();
}
if(psm.pal > 0)
@@ -1388,6 +1375,7 @@ GSTextureCache::Source* GSTextureCache::CreateSource(const GIFRegTEX0& TEX0, con
GSTextureCache::Target* GSTextureCache::CreateTarget(const GIFRegTEX0& TEX0, int w, int h, int type)
{
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
@@ -1406,9 +1394,8 @@ GSTextureCache::Target* GSTextureCache::CreateTarget(const GIFRegTEX0& TEX0, int
if(t->m_texture == NULL)
{
ASSERT(0);
delete t;
return NULL;
throw GSDXErrorOOM();
}
m_dst[type].push_front(t);