Cleanup.
This commit is contained in:
parent
db1c11d249
commit
8ab0a4eea5
@ -1759,11 +1759,17 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
|
||||
void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE
|
||||
{
|
||||
// Resource ref. counts might be messed up outside of bgfx.
|
||||
// Disabling ref. count check once texture is overridden.
|
||||
setGraphicsDebuggerPresent(true);
|
||||
m_textures[_handle.idx].overrideInternal(_ptr);
|
||||
}
|
||||
|
||||
uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE
|
||||
{
|
||||
// Resource ref. counts might be messed up outside of bgfx.
|
||||
// Disabling ref. count check once texture is overridden.
|
||||
setGraphicsDebuggerPresent(true);
|
||||
return uintptr_t(m_textures[_handle.idx].m_ptr);
|
||||
}
|
||||
|
||||
|
@ -999,11 +999,17 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
void overrideInternal(TextureHandle _handle, uintptr_t _ptr) BX_OVERRIDE
|
||||
{
|
||||
BX_UNUSED(_handle, _ptr);
|
||||
// Resource ref. counts might be messed up outside of bgfx.
|
||||
// Disabling ref. count check once texture is overridden.
|
||||
setGraphicsDebuggerPresent(true);
|
||||
m_textures[_handle.idx].overrideInternal(_ptr);
|
||||
}
|
||||
|
||||
uintptr_t getInternal(TextureHandle _handle) BX_OVERRIDE
|
||||
{
|
||||
// Resource ref. counts might be messed up outside of bgfx.
|
||||
// Disabling ref. count check once texture is overridden.
|
||||
setGraphicsDebuggerPresent(true);
|
||||
return uintptr_t(m_textures[_handle.idx].m_ptr);
|
||||
}
|
||||
|
||||
|
@ -325,12 +325,22 @@ namespace bgfx { namespace d3d9
|
||||
|
||||
void destroy()
|
||||
{
|
||||
DX_RELEASE(m_ptr, 0);
|
||||
if (0 == (m_flags & BGFX_TEXTURE_INTERNAL_SHARED) )
|
||||
{
|
||||
DX_RELEASE(m_ptr, 0);
|
||||
}
|
||||
DX_RELEASE(m_surface, 0);
|
||||
DX_RELEASE(m_staging, 0);
|
||||
m_textureFormat = TextureFormat::Unknown;
|
||||
}
|
||||
|
||||
void overrideInternal(uintptr_t _ptr)
|
||||
{
|
||||
destroy();
|
||||
m_flags |= BGFX_TEXTURE_INTERNAL_SHARED;
|
||||
m_ptr = (IDirect3DBaseTexture9*)_ptr;
|
||||
}
|
||||
|
||||
void updateBegin(uint8_t _side, uint8_t _mip);
|
||||
void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
|
||||
void updateEnd();
|
||||
|
@ -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);
|
||||
|
@ -1122,6 +1122,7 @@ namespace bgfx { namespace gl
|
||||
bool init(GLenum _target, uint32_t _width, uint32_t _height, uint32_t _depth, TextureFormat::Enum _format, uint8_t _numMips, uint32_t _flags);
|
||||
void create(const Memory* _mem, uint32_t _flags, uint8_t _skip);
|
||||
void destroy();
|
||||
void overrideInternal(uintptr_t _ptr);
|
||||
void update(uint8_t _side, uint8_t _mip, const Rect& _rect, uint16_t _z, uint16_t _depth, uint16_t _pitch, const Memory* _mem);
|
||||
void setSamplerState(uint32_t _flags, const float _rgba[4]);
|
||||
void commit(uint32_t _stage, uint32_t _flags, const float _palette[][4]);
|
||||
|
Loading…
Reference in New Issue
Block a user