Make CD3D9RenderTarget::setTexture code more similar to COpenGLCoreRenderTarget::setTexture.
Add log warnings when users try to set depth/stencil textures which have no depth color format. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@5845 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
8a33852395
commit
3469582bac
|
@ -51,15 +51,12 @@ namespace irr
|
|||
|
||||
void CD3D9RenderTarget::setTexture(const core::array<ITexture*>& texture, ITexture* depthStencil, const core::array<E_CUBE_SURFACE>& cubeSurfaces)
|
||||
{
|
||||
bool textureUpdate = (Texture != texture) || (CubeSurfaces != cubeSurfaces) ? true : false;
|
||||
bool depthStencilUpdate = (DepthStencil != depthStencil) ? true : false;
|
||||
bool needSizeUpdate = false;
|
||||
|
||||
if (textureUpdate || depthStencilUpdate)
|
||||
{
|
||||
// Set color attachments.
|
||||
|
||||
if (textureUpdate)
|
||||
if ((Texture != texture) || (CubeSurfaces != cubeSurfaces))
|
||||
{
|
||||
needSizeUpdate = true;
|
||||
CubeSurfaces = cubeSurfaces;
|
||||
|
||||
if (texture.size() > Driver->ActiveRenderTarget.size())
|
||||
|
@ -136,7 +133,7 @@ namespace irr
|
|||
|
||||
// Set depth and stencil attachments.
|
||||
|
||||
if (depthStencilUpdate)
|
||||
if (DepthStencil != depthStencil)
|
||||
{
|
||||
if (DepthStencilSurface)
|
||||
{
|
||||
|
@ -152,22 +149,17 @@ namespace irr
|
|||
DepthStencilSurface = 0;
|
||||
}
|
||||
|
||||
needSizeUpdate = true;
|
||||
CD3D9Texture* currentTexture = (depthStencil && depthStencil->getDriverType() == DriverType) ? static_cast<CD3D9Texture*>(depthStencil) : 0;
|
||||
|
||||
IDirect3DTexture9* textureID = 0;
|
||||
|
||||
if (currentTexture)
|
||||
{
|
||||
if (currentTexture->getType() == ETT_2D)
|
||||
textureID = currentTexture->getDX9Texture();
|
||||
else
|
||||
os::Printer::log("This driver doesn't support depth/stencil to cubemaps.", ELL_WARNING);
|
||||
}
|
||||
|
||||
{
|
||||
IDirect3DTexture9* textureID = currentTexture->getDX9Texture();
|
||||
if (textureID)
|
||||
{
|
||||
const ECOLOR_FORMAT textureFormat = (depthStencil) ? depthStencil->getColorFormat() : ECF_UNKNOWN;
|
||||
|
||||
const ECOLOR_FORMAT textureFormat = depthStencil->getColorFormat();
|
||||
if (IImage::isDepthFormat(textureFormat))
|
||||
{
|
||||
DepthStencil = depthStencil;
|
||||
|
@ -178,9 +170,19 @@ namespace irr
|
|||
|
||||
DepthStencilSurface = currentSurface;
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("Ignoring depth/stencil texture without depth color format.", ELL_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
os::Printer::log("This driver doesn't support depth/stencil to cubemaps.", ELL_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
if (needSizeUpdate)
|
||||
{
|
||||
// Set size required for a viewport.
|
||||
|
||||
bool sizeDetected = false;
|
||||
|
|
|
@ -134,6 +134,10 @@ public:
|
|||
DepthStencil = depthStencil;
|
||||
DepthStencil->grab();
|
||||
}
|
||||
else
|
||||
{
|
||||
os::Printer::log("Ignoring depth/stencil texture without depth color format.", ELL_WARNING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue