readtexture mip / gl metal noop support
This commit is contained in:
parent
9a0e685861
commit
061b805cfb
@ -2383,7 +2383,6 @@ namespace bgfx { namespace gl
|
||||
{
|
||||
if (m_readBackSupported)
|
||||
{
|
||||
_mip;
|
||||
const TextureGL& texture = m_textures[_handle.idx];
|
||||
const bool compressed = isCompressed(TextureFormat::Enum(texture.m_textureFormat) );
|
||||
|
||||
@ -2392,14 +2391,14 @@ namespace bgfx { namespace gl
|
||||
if (compressed)
|
||||
{
|
||||
GL_CHECK(glGetCompressedTexImage(texture.m_target
|
||||
, 0
|
||||
, _mip
|
||||
, _data
|
||||
) );
|
||||
}
|
||||
else
|
||||
{
|
||||
GL_CHECK(glGetTexImage(texture.m_target
|
||||
, 0
|
||||
, _mip
|
||||
, texture.m_fmt
|
||||
, texture.m_type
|
||||
, _data
|
||||
|
@ -796,7 +796,7 @@ namespace bgfx { namespace mtl
|
||||
{
|
||||
}
|
||||
|
||||
void readTexture(TextureHandle _handle, void* _data) BX_OVERRIDE
|
||||
void readTexture(TextureHandle _handle, void* _data, uint8_t _mip) BX_OVERRIDE
|
||||
{
|
||||
m_commandBuffer.commit();
|
||||
m_commandBuffer.waitUntilCompleted();
|
||||
@ -804,13 +804,15 @@ namespace bgfx { namespace mtl
|
||||
|
||||
const TextureMtl& texture = m_textures[_handle.idx];
|
||||
|
||||
uint32_t width = texture.m_ptr.width();
|
||||
uint32_t height = texture.m_ptr.height();
|
||||
BX_CHECK(_mip<texture.m_numMips,"Invalid mip: %d num mips:",_mip,texture.m_numMips);
|
||||
|
||||
uint32_t width = texture.m_ptr.width() >> _mip;
|
||||
uint32_t height = texture.m_ptr.height() >> _mip;
|
||||
const uint8_t bpp = getBitsPerPixel(TextureFormat::Enum(texture.m_textureFormat) );
|
||||
|
||||
MTLRegion region = { { 0, 0, 0 }, { width, height, 1 } };
|
||||
|
||||
texture.m_ptr.getBytes(_data, width*bpp/8, 0, region, 0, 0);
|
||||
texture.m_ptr.getBytes(_data, width*bpp/8, 0, region, _mip, 0);
|
||||
|
||||
m_commandBuffer = m_commandQueue.commandBuffer();
|
||||
retain(m_commandBuffer); //NOTE: keep alive to be useable at 'flip'
|
||||
|
@ -136,7 +136,7 @@ namespace bgfx { namespace noop
|
||||
{
|
||||
}
|
||||
|
||||
void readTexture(TextureHandle /*_handle*/, void* /*_data*/) BX_OVERRIDE
|
||||
void readTexture(TextureHandle /*_handle*/, void* /*_data*/, uint8_t /*_mip*/) BX_OVERRIDE
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user