diff --git a/include/bgfx/bgfxdefines.h b/include/bgfx/bgfxdefines.h index c0ab33d6d..7d2b21662 100644 --- a/include/bgfx/bgfxdefines.h +++ b/include/bgfx/bgfxdefines.h @@ -6,7 +6,7 @@ #ifndef BGFX_DEFINES_H_HEADER_GUARD #define BGFX_DEFINES_H_HEADER_GUARD -#define BGFX_API_VERSION UINT32_C(27) +#define BGFX_API_VERSION UINT32_C(28) /// #define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write. diff --git a/include/bgfx/c99/bgfx.h b/include/bgfx/c99/bgfx.h index 4b8bf627b..046932441 100644 --- a/include/bgfx/c99/bgfx.h +++ b/include/bgfx/c99/bgfx.h @@ -704,7 +704,7 @@ BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _m BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); /**/ -BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data); +BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, uint8_t _mip); /**/ BGFX_C_API uint32_t bgfx_read_frame_buffer(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, void* _data); diff --git a/include/bgfx/c99/bgfxplatform.h b/include/bgfx/c99/bgfxplatform.h index f1b0642c3..2b7643ef1 100644 --- a/include/bgfx/c99/bgfxplatform.h +++ b/include/bgfx/c99/bgfxplatform.h @@ -138,6 +138,8 @@ typedef struct bgfx_interface_vtbl void (*update_texture_2d)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); void (*update_texture_3d)(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem); void (*update_texture_cube)(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch); + uint32_t (*read_texture)(bgfx_texture_handle_t _handle, void* _data, uint8_t _mip); + uint32_t (*read_frame_buffer)(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, void* _data); void (*destroy_texture)(bgfx_texture_handle_t _handle); bgfx_frame_buffer_handle_t (*create_frame_buffer)(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint32_t _textureFlags); bgfx_frame_buffer_handle_t (*create_frame_buffer_scaled)(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint32_t _textureFlags); diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 38e34bfa2..a2de875dd 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -4287,10 +4287,10 @@ BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t bgfx::updateTextureCube(handle.cpp, _layer, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch); } -BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data) +BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, uint8_t _mip) { union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle }; - return bgfx::readTexture(handle.cpp, _data); + return bgfx::readTexture(handle.cpp, _data, _mip); } BGFX_C_API uint32_t bgfx_read_frame_buffer(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment, void* _data) @@ -4772,6 +4772,8 @@ BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version) BGFX_IMPORT_FUNC(update_texture_2d) \ BGFX_IMPORT_FUNC(update_texture_3d) \ BGFX_IMPORT_FUNC(update_texture_cube) \ + BGFX_IMPORT_FUNC(read_texture) \ + BGFX_IMPORT_FUNC(read_frame_buffer) \ BGFX_IMPORT_FUNC(destroy_texture) \ BGFX_IMPORT_FUNC(create_frame_buffer) \ BGFX_IMPORT_FUNC(create_frame_buffer_scaled) \