This commit is contained in:
Branimir Karadžić
2016-01-27 14:50:57 -08:00
parent db1c11d249
commit 8ab0a4eea5
5 changed files with 35 additions and 4 deletions

View File

@@ -2230,7 +2230,7 @@ namespace bgfx { namespace gl
void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE
{
BX_UNUSED(_handle, _ptr);
m_textures[_handle.idx].overrideInternal(_ptr);
}
uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE
@@ -4271,7 +4271,8 @@ namespace bgfx { namespace gl
void TextureGL::destroy()
{
if (0 != m_id)
if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED)
&& 0 != m_id)
{
GL_CHECK(glBindTexture(m_target, 0) );
GL_CHECK(glDeleteTextures(1, &m_id) );
@@ -4285,6 +4286,13 @@ namespace bgfx { namespace gl
}
}
void TextureGL::overrideInternal(uintptr_t _ptr)
{
destroy();
m_flags |= BGFX_TEXTURE_INTERNAL_SHARED;
m_id = (GLuint)_ptr;
}
void TextureGL::update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem)
{
BX_UNUSED(_z, _depth);