Commit 68f10e78 authored by hybrid's avatar hybrid

Check if low-level texture for RTT was created, otherwise return nullptr to...

Check if low-level texture for RTT was created, otherwise return nullptr to signal failure in RTT creation. Thanks to stefbuet for pointing out this problem.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3693 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 73d2385d
...@@ -809,13 +809,21 @@ bool CD3D8Driver::setRenderTarget(video::ITexture* texture, ...@@ -809,13 +809,21 @@ bool CD3D8Driver::setRenderTarget(video::ITexture* texture,
//! Creates a render target texture. //! Creates a render target texture.
ITexture* CD3D8Driver::addRenderTargetTexture(const core::dimension2d<u32>& size, ITexture* CD3D8Driver::addRenderTargetTexture(
const io::path& name, const core::dimension2d<u32>& size, const io::path& name,
const ECOLOR_FORMAT format) const ECOLOR_FORMAT format)
{ {
ITexture* tex = new CD3D8Texture(this, size, name); CD3D8Texture* tex = new CD3D8Texture(this, size, name);
addTexture(tex); if (tex)
tex->drop(); {
if (!tex->Texture)
{
tex->drop();
return 0;
}
addTexture(tex);
tex->drop();
}
return tex; return tex;
} }
......
...@@ -3156,9 +3156,14 @@ ITexture* CD3D9Driver::addRenderTargetTexture(const core::dimension2d<u32>& size ...@@ -3156,9 +3156,14 @@ ITexture* CD3D9Driver::addRenderTargetTexture(const core::dimension2d<u32>& size
const io::path& name, const io::path& name,
const ECOLOR_FORMAT format) const ECOLOR_FORMAT format)
{ {
ITexture* tex = new CD3D9Texture(this, size, name, format); CD3D9Texture* tex = new CD3D9Texture(this, size, name, format);
if (tex) if (tex)
{ {
if (!tex->Texture)
{
tex->drop();
return 0;
}
checkDepthBuffer(tex); checkDepthBuffer(tex);
addTexture(tex); addTexture(tex);
tex->drop(); tex->drop();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment