diff options
Diffstat (limited to '3rdparty/bgfx/src/bgfx.cpp')
-rw-r--r-- | 3rdparty/bgfx/src/bgfx.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/3rdparty/bgfx/src/bgfx.cpp b/3rdparty/bgfx/src/bgfx.cpp index aae0311ebd5..e16d4f71c3f 100644 --- a/3rdparty/bgfx/src/bgfx.cpp +++ b/3rdparty/bgfx/src/bgfx.cpp @@ -2259,13 +2259,10 @@ again: uint8_t num; _cmdbuf.read(num); - TextureHandle textureHandles[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; - for (uint32_t ii = 0; ii < num; ++ii) - { - _cmdbuf.read(textureHandles[ii]); - } + Attachment attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; + _cmdbuf.read(attachment, sizeof(Attachment) * num); - m_renderCtx->createFrameBuffer(handle, num, textureHandles); + m_renderCtx->createFrameBuffer(handle, num, attachment); } } break; @@ -3112,14 +3109,27 @@ again: FrameBufferHandle createFrameBuffer(uint8_t _num, const TextureHandle* _handles, bool _destroyTextures) { + Attachment attachment[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS]; + for (uint8_t ii = 0; ii < _num; ++ii) + { + Attachment& at = attachment[ii]; + at.handle = _handles[ii]; + at.mip = 0; + at.layer = 0; + } + return createFrameBuffer(_num, attachment, _destroyTextures); + } + + FrameBufferHandle createFrameBuffer(uint8_t _num, const Attachment* _attachment, bool _destroyTextures) + { BGFX_CHECK_MAIN_THREAD(); BX_CHECK(_num != 0, "Number of frame buffer attachments can't be 0."); BX_CHECK(_num <= BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS, "Number of frame buffer attachments is larger than allowed %d (max: %d)." , _num , BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS ); - BX_CHECK(NULL != _handles, "_handles can't be NULL"); - return s_ctx->createFrameBuffer(_num, _handles, _destroyTextures); + BX_CHECK(NULL != _attachment, "_attachment can't be NULL"); + return s_ctx->createFrameBuffer(_num, _attachment, _destroyTextures); } FrameBufferHandle createFrameBuffer(void* _nwh, uint16_t _width, uint16_t _height, TextureFormat::Enum _depthFormat) @@ -4114,10 +4124,10 @@ BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backb return handle.c; } -BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTextures) +BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTextures) { union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle; - handle.cpp = bgfx::createFrameBuffer(_num, (const bgfx::TextureHandle*)_handles, _destroyTextures); + handle.cpp = bgfx::createFrameBuffer(_num, (const bgfx::Attachment*)_attachment, _destroyTextures); return handle.c; } @@ -4560,7 +4570,7 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) BGFX_IMPORT_FUNC(destroy_texture) \ BGFX_IMPORT_FUNC(create_frame_buffer) \ BGFX_IMPORT_FUNC(create_frame_buffer_scaled) \ - BGFX_IMPORT_FUNC(create_frame_buffer_from_handles) \ + BGFX_IMPORT_FUNC(create_frame_buffer_from_attachment) \ BGFX_IMPORT_FUNC(create_frame_buffer_from_nwh) \ BGFX_IMPORT_FUNC(destroy_frame_buffer) \ BGFX_IMPORT_FUNC(create_uniform) \ |