D3D9: Fixed assert when frame buffer texture is resized.

This commit is contained in:
Branimir Karadžić 2016-07-28 21:19:08 -07:00
parent 86084dc65f
commit f2e46a5c65
2 changed files with 13 additions and 3 deletions

View File

@ -1041,7 +1041,7 @@ namespace bgfx { namespace d3d9
tc.m_mem = NULL;
bx::write(&writer, tc);
texture.destroy();
texture.destroy(true);
texture.create(mem, texture.m_flags, 0);
release(mem);

View File

@ -323,11 +323,21 @@ namespace bgfx { namespace d3d9
void create(const Memory* _mem, uint32_t _flags, uint8_t _skip);
void destroy()
void destroy(bool _resize = false)
{
if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED) )
{
DX_RELEASE(m_ptr, 0);
if (_resize)
{
// BK - at the time of resize there might be one reference held by frame buffer
// surface. This frame buffer will be recreated later, and release reference
// to existing surface. That's why here we don't care about ref count.
m_ptr->Release();
}
else
{
DX_RELEASE(m_ptr, 0);
}
}
DX_RELEASE(m_surface, 0);
DX_RELEASE(m_staging, 0);