Prevent crash in CD3D9RenderTarget::generateSurfaces when a CD3D9Texture has no IDirect3DTexture9.

Increase log-warning level from information to error when CD3D9Texture::generateRenderTarget fails to generate a IDirect3DTexture9.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5614 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2018-05-24 10:53:43 +00:00
parent a7a90ff191
commit 609a6474f0
2 changed files with 16 additions and 14 deletions

View File

@ -236,22 +236,24 @@ namespace irr
if (!Surface[i] && Texture[i])
{
IDirect3DTexture9* currentTexture = static_cast<CD3D9Texture*>(Texture[i])->getDX9Texture();
IDirect3DSurface9* currentSurface = 0;
currentTexture->GetSurfaceLevel(0, &currentSurface);
Surface[i] = currentSurface;
if ( currentTexture )
{
IDirect3DSurface9* currentSurface = 0;
currentTexture->GetSurfaceLevel(0, &currentSurface);
Surface[i] = currentSurface;
}
}
}
if (!DepthStencilSurface && DepthStencil)
{
IDirect3DTexture9* currentTexture = static_cast<CD3D9Texture*>(DepthStencil)->getDX9Texture();
IDirect3DSurface9* currentSurface = 0;
currentTexture->GetSurfaceLevel(0, &currentSurface);
DepthStencilSurface = currentSurface;
if ( currentTexture )
{
IDirect3DSurface9* currentSurface = 0;
currentTexture->GetSurfaceLevel(0, &currentSurface);
DepthStencilSurface = currentSurface;
}
}
}
}

View File

@ -353,13 +353,13 @@ void CD3D9Texture::generateRenderTarget()
if (FAILED(hr))
{
if (D3DERR_INVALIDCALL == hr)
os::Printer::log("Could not create render target texture", "Invalid Call");
os::Printer::log("Could not create render target texture", "Invalid Call", irr::ELL_ERROR);
else if (D3DERR_OUTOFVIDEOMEMORY == hr)
os::Printer::log("Could not create render target texture", "Out of Video Memory");
os::Printer::log("Could not create render target texture", "Out of Video Memory", irr::ELL_ERROR);
else if (E_OUTOFMEMORY == hr)
os::Printer::log("Could not create render target texture", "Out of Memory");
os::Printer::log("Could not create render target texture", "Out of Memory", irr::ELL_ERROR);
else
os::Printer::log("Could not create render target texture");
os::Printer::log("Could not create render target texture", irr::ELL_ERROR);
}
}
}