implemented overrideInternal for Metal

The internal pointer is interpreted as being of type id<MTLTexture>.
This commit is contained in:
Oliver Collyer 2020-01-04 18:57:17 +00:00 committed by Бранимир Караџић
parent aeb77dde38
commit 7b7dca065b
2 changed files with 13 additions and 4 deletions

View File

@ -968,7 +968,10 @@ namespace bgfx { namespace mtl
void destroy()
{
MTL_RELEASE(m_ptr);
if (0 == (m_flags & BGFX_SAMPLER_INTERNAL_SHARED))
{
MTL_RELEASE(m_ptr);
}
MTL_RELEASE(m_ptrStencil);
for (uint32_t ii = 0; ii < m_numMips; ++ii)
{
@ -976,6 +979,13 @@ namespace bgfx { namespace mtl
}
}
void overrideInternal(uintptr_t _ptr)
{
destroy();
m_flags |= BGFX_SAMPLER_INTERNAL_SHARED;
m_ptr = id<MTLTexture>(_ptr);
}
void update(
uint8_t _side
, uint8_t _mip

View File

@ -894,13 +894,12 @@ namespace bgfx { namespace mtl
void overrideInternal(TextureHandle _handle, uintptr_t _ptr) override
{
BX_UNUSED(_handle, _ptr);
m_textures[_handle.idx].overrideInternal(_ptr);
}
uintptr_t getInternal(TextureHandle _handle) override
{
BX_UNUSED(_handle);
return 0;
return uintptr_t(id<MTLTexture>(m_textures[_handle.idx].m_ptr));
}
void destroyTexture(TextureHandle _handle) override