diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 36c86cb5..cb425141 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -4162,10 +4162,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); void TextureD3D11::destroy() { s_renderD3D11->m_srvUavLru.invalidateWithParent(getHandle().idx); + DX_RELEASE(m_srv, 0); + DX_RELEASE(m_uav, 0); if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED) ) { - DX_RELEASE(m_srv, 0); - DX_RELEASE(m_uav, 0); DX_RELEASE(m_ptr, 0); } } @@ -4175,6 +4175,8 @@ BX_PRAGMA_DIAGNOSTIC_POP(); destroy(); m_flags |= BGFX_TEXTURE_INTERNAL_SHARED; m_ptr = (ID3D11Resource*)_ptr; + + s_renderD3D11->m_device->CreateShaderResourceView(m_ptr, NULL, &m_srv); } void TextureD3D11::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)