bool GFXD3D11TextureManager::_refreshTexture(GFXTextureObject *texture) { U32 usedStrategies = 0; GFXD3D11TextureObject *realTex = static_cast<GFXD3D11TextureObject *>(texture); if(texture->mProfile->doStoreBitmap()) { if(texture->mBitmap) _loadTexture(texture, texture->mBitmap); if(texture->mDDS) _loadTexture(texture, texture->mDDS); usedStrategies++; } if(texture->mProfile->isRenderTarget() || texture->mProfile->isDynamic() || texture->mProfile->isZTarget()) { realTex->release(); _innerCreateTexture(realTex, texture->getHeight(), texture->getWidth(), texture->getDepth(), texture->mFormat, texture->mProfile, texture->mMipLevels, false, texture->mAntialiasLevel); usedStrategies++; } AssertFatal(usedStrategies < 2, "GFXD3D11TextureManager::_refreshTexture - Inconsistent profile flags!"); return true; }
//----------------------------------------------------------------------------- // createTexture //----------------------------------------------------------------------------- GFXTextureObject *GFXD3D11TextureManager::_createTextureObject( U32 height, U32 width, U32 depth, GFXFormat format, GFXTextureProfile *profile, U32 numMipLevels, bool forceMips, S32 antialiasLevel, GFXTextureObject *inTex ) { GFXD3D11TextureObject *retTex; if ( inTex ) { AssertFatal(static_cast<GFXD3D11TextureObject*>( inTex ), "GFXD3D11TextureManager::_createTexture() - Bad inTex type!"); retTex = static_cast<GFXD3D11TextureObject*>( inTex ); retTex->release(); } else { retTex = new GFXD3D11TextureObject(GFX, profile); retTex->registerResourceWithDevice(GFX); } _innerCreateTexture(retTex, height, width, depth, format, profile, numMipLevels, forceMips, antialiasLevel); return retTex; }
bool GFXD3D11TextureManager::_freeTexture(GFXTextureObject *texture, bool zombify) { AssertFatal(dynamic_cast<GFXD3D11TextureObject *>(texture),"Not an actual d3d texture object!"); GFXD3D11TextureObject *tex = static_cast<GFXD3D11TextureObject *>( texture ); // If it's a managed texture and we're zombifying, don't blast it, D3D allows // us to keep it. if(zombify && tex->isManaged) return true; tex->release(); return true; }