mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-20 13:53:14 +01:00
Added ability to expose internal data (D3D device/GL context).
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#ifndef BGFX_DEFINES_H_HEADER_GUARD
|
||||
#define BGFX_DEFINES_H_HEADER_GUARD
|
||||
|
||||
#define BGFX_API_VERSION UINT32_C(2)
|
||||
#define BGFX_API_VERSION UINT32_C(3)
|
||||
|
||||
///
|
||||
#define BGFX_STATE_RGB_WRITE UINT64_C(0x0000000000000001) //!< Enable RGB write.
|
||||
|
||||
@@ -45,10 +45,10 @@ namespace bgfx
|
||||
///
|
||||
struct PlatformData
|
||||
{
|
||||
void* ndt; //!< Native display type
|
||||
void* nwh; //!< Native window handle
|
||||
void* context; //!< GL context, or D3D device
|
||||
void* backBuffer; //!< GL backbuffer, or D3D render target view
|
||||
void* ndt; //!< Native display type.
|
||||
void* nwh; //!< Native window handle.
|
||||
void* context; //!< GL context, or D3D device.
|
||||
void* backBuffer; //!< GL backbuffer, or D3D render target view.
|
||||
void* backBufferDS; //!< Backbuffer depth/stencil.
|
||||
};
|
||||
|
||||
@@ -58,7 +58,19 @@ namespace bgfx
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_set_platform_data`.
|
||||
///
|
||||
void setPlatformData(const PlatformData& _hooks);
|
||||
void setPlatformData(const PlatformData& _data);
|
||||
|
||||
///
|
||||
struct InternalData
|
||||
{
|
||||
void* context; //!< GL context, or D3D device.
|
||||
};
|
||||
|
||||
/// Get internal data for interop.
|
||||
///
|
||||
/// @attention C99 equivalent is `bgfx_get_internal_data`.
|
||||
///
|
||||
const InternalData* getInternalData();
|
||||
|
||||
} // namespace bgfx
|
||||
|
||||
|
||||
@@ -433,7 +433,8 @@ typedef struct bgfx_allocator_vtbl
|
||||
typedef struct bgfx_interface_vtbl
|
||||
{
|
||||
bgfx_render_frame_t (*render_frame)();
|
||||
void (*set_platform_data)(bgfx_platform_data_t* _pd);
|
||||
void (*set_platform_data)(const bgfx_platform_data_t* _data);
|
||||
const bgfx_internal_data_t* (*get_platform_data)();
|
||||
void (*vertex_decl_begin)(bgfx_vertex_decl_t* _decl, bgfx_renderer_type_t _renderer);
|
||||
void (*vertex_decl_add)(bgfx_vertex_decl_t* _decl, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt);
|
||||
void (*vertex_decl_skip)(bgfx_vertex_decl_t* _decl, uint8_t _num);
|
||||
|
||||
@@ -41,6 +41,14 @@ typedef struct bgfx_platform_data
|
||||
|
||||
} bgfx_platform_data_t;
|
||||
|
||||
BGFX_C_API void bgfx_set_platform_data(bgfx_platform_data_t* _pd);
|
||||
BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t* _data);
|
||||
|
||||
typedef struct bgfx_internal_data
|
||||
{
|
||||
void* context;
|
||||
|
||||
} bgfx_internal_data_t;
|
||||
|
||||
BGFX_C_API const bgfx_internal_data_t* bgfx_get_internal_data();
|
||||
|
||||
#endif // BGFX_PLATFORM_C99_H_HEADER_GUARD
|
||||
|
||||
Reference in New Issue
Block a user