diff options
Diffstat (limited to '3rdparty/bgfx/src')
-rw-r--r-- | 3rdparty/bgfx/src/renderer_mtl.h | 10 | ||||
-rw-r--r-- | 3rdparty/bgfx/src/renderer_mtl.mm | 7 |
2 files changed, 17 insertions, 0 deletions
diff --git a/3rdparty/bgfx/src/renderer_mtl.h b/3rdparty/bgfx/src/renderer_mtl.h index 42145e0c036..13f1bf6b7af 100644 --- a/3rdparty/bgfx/src/renderer_mtl.h +++ b/3rdparty/bgfx/src/renderer_mtl.h @@ -87,6 +87,16 @@ namespace bgfx { namespace mtl destinationSlice:_destinationSlice destinationLevel:_destinationLevel destinationOrigin:_destinationOrigin]; } + void synchronizeTexture(id<MTLTexture> _texture, NSUInteger _slice, NSUInteger _level) + { + [m_obj synchronizeTexture:_texture slice:_slice level:_level]; + } + + void synchronizeResource(id<MTLResource> _resource) + { + [m_obj synchronizeResource:_resource]; + } + void endEncoding() { [m_obj endEncoding]; diff --git a/3rdparty/bgfx/src/renderer_mtl.mm b/3rdparty/bgfx/src/renderer_mtl.mm index b2dcdd36900..ce2bf3b8b51 100644 --- a/3rdparty/bgfx/src/renderer_mtl.mm +++ b/3rdparty/bgfx/src/renderer_mtl.mm @@ -3023,16 +3023,23 @@ namespace bgfx { namespace mtl uint32_t width = bx::uint32_min(srcWidth, dstWidth); uint32_t height = bx::uint32_min(srcHeight, dstHeight); uint32_t depth = bx::uint32_min(srcDepth, dstDepth); + bool readBack = !!(dst.m_flags & BGFX_TEXTURE_READ_BACK); if ( MTLTextureType3D == src.m_ptr.textureType()) { m_blitCommandEncoder.copyFromTexture(src.m_ptr, 0, 0, MTLOriginMake(blit.m_srcX, blit.m_srcY, blit.m_srcZ), MTLSizeMake(width, height, bx::uint32_imax(depth, 1)), dst.m_ptr, 0, 0, MTLOriginMake(blit.m_dstX, blit.m_dstY, blit.m_dstZ)); + if (m_macOS11Runtime &&readBack) { + m_blitCommandEncoder.synchronizeResource(dst.m_ptr); + } } else { m_blitCommandEncoder.copyFromTexture(src.m_ptr, blit.m_srcZ, blit.m_srcMip, MTLOriginMake(blit.m_srcX, blit.m_srcY, 0), MTLSizeMake(width, height, 1), dst.m_ptr, blit.m_dstZ, blit.m_dstMip, MTLOriginMake(blit.m_dstX, blit.m_dstY, 0)); + if (m_macOS11Runtime && readBack) { + m_blitCommandEncoder.synchronizeTexture(dst.m_ptr, 0, blit.m_dstMip); + } } } |