Exposed internal profiler callbacks.

This commit is contained in:
Branimir Karadžić
2017-10-06 18:07:40 -07:00
parent c0cf48425d
commit 4cdab3e971
6 changed files with 143 additions and 32 deletions

View File

@@ -423,6 +423,53 @@ namespace bgfx
, va_list _argList
) = 0;
/// Profiler region begin.
///
/// @param[in] _name Region name, contains dynamic string.
/// @param[in] _abgr Color of profiler region.
/// @param[in] _filePath File path where profilerBegin was called.
/// @param[in] _line Line where profilerBegin was called.
///
/// @remarks
/// Not thread safe and it can be called from any thread.
///
/// @attention C99 equivalent is `bgfx_callback_vtbl.profiler_begin`.
///
virtual void profilerBegin(
const char* _name
, uint32_t _abgr
, const char* _filePath
, uint16_t _line
) = 0;
/// Profiler region begin with string literal name.
///
/// @param[in] _name Region name, contains string literal.
/// @param[in] _abgr Color of profiler region.
/// @param[in] _filePath File path where profilerBeginLiteral was called.
/// @param[in] _line Line where profilerBeginLiteral was called.
///
/// @remarks
/// Not thread safe and it can be called from any thread.
///
/// @attention C99 equivalent is `bgfx_callback_vtbl.profiler_begin_literal`.
///
virtual void profilerBeginLiteral(
const char* _name
, uint32_t _abgr
, const char* _filePath
, uint16_t _line
) = 0;
/// Profiler region end.
///
/// @remarks
/// Not thread safe and it can be called from any thread.
///
/// @attention C99 equivalent is `bgfx_callback_vtbl.profiler_end`.
///
virtual void profilerEnd() = 0;
/// Return size of for cached item. Return 0 if no cached item was
/// found.
///

View File

@@ -530,6 +530,9 @@ typedef struct bgfx_callback_vtbl
{
void (*fatal)(bgfx_callback_interface_t* _this, bgfx_fatal_t _code, const char* _str);
void (*trace_vargs)(bgfx_callback_interface_t* _this, const char* _filePath, uint16_t _line, const char* _format, va_list _argList);
void (*profiler_begin)(bgfx_callback_interface_t* _this, const char* _name, uint32_t _abgr, const char* _filePath, uint16_t _line);
void (*profiler_begin_literal)(bgfx_callback_interface_t* _this, const char* _name, uint32_t _abgr, const char* _filePath, uint16_t _line);
void (*profiler_end)(bgfx_callback_interface_t* _this);
uint32_t (*cache_read_size)(bgfx_callback_interface_t* _this, uint64_t _id);
bool (*cache_read)(bgfx_callback_interface_t* _this, uint64_t _id, void* _data, uint32_t _size);
void (*cache_write)(bgfx_callback_interface_t* _this, uint64_t _id, const void* _data, uint32_t _size);