Added ability to set view name for profiling events.

This commit is contained in:
bkaradzic 2013-06-09 15:28:25 -07:00
parent 493766caa6
commit a5c6c0bf5b
12 changed files with 197 additions and 77 deletions

View File

@ -706,8 +706,10 @@ namespace bgfx
void updateTexture3D(TextureHandle _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const Memory* _mem);
/// Update Cube texture.
///
/// @param _side Cubemap side, where 0 is +X, 1 is -X, 2 is +Y, 3 is
/// -Y, 4 is +Z, and 5 is -Z.
///
void updateTextureCube(TextureHandle _handle, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const Memory* _mem);
/// Destroy texture.
@ -725,6 +727,16 @@ namespace bgfx
/// Destroy shader uniform parameter.
void destroyUniform(UniformHandle _handle);
/// Set view name.
///
/// @param _id view id.
/// @param _name View name.
///
/// NOTE:
/// This is debug only feature.
///
void setViewName(uint8_t _id, const char* _name);
/// Set view rectangle. Draw primitive outside view will be clipped.
void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height);

View File

@ -748,6 +748,13 @@ namespace bgfx
m_submit->m_transientVb = createTransientVertexBuffer(BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE);
m_submit->m_transientIb = createTransientIndexBuffer(BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE);
frame();
for (uint8_t ii = 0; ii < BGFX_CONFIG_MAX_VIEWS; ++ii)
{
char name[256];
bx::snprintf(name, sizeof(name), "%02d view", ii);
setViewName(ii, name);
}
}
void Context::shutdown()
@ -1271,6 +1278,12 @@ namespace bgfx
s_ctx.destroyUniform(_handle);
}
void setViewName(uint8_t _id, const char* _name)
{
BGFX_CHECK_MAIN_THREAD();
s_ctx.setViewName(_id, _name);
}
void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
BGFX_CHECK_MAIN_THREAD();
@ -1445,9 +1458,6 @@ namespace bgfx
void saveScreenShot(const char* _filePath)
{
BGFX_CHECK_MAIN_THREAD();
uint32_t len = (uint32_t)strlen(_filePath)+1;
const Memory* mem = alloc(len);
memcpy(mem->data, _filePath, mem->size);
return s_ctx.saveScreenShot(mem);
s_ctx.saveScreenShot(_filePath);
}
}

View File

@ -478,6 +478,7 @@ namespace bgfx
UpdateTexture,
CreateRenderTarget,
CreateUniform,
UpdateViewName,
End,
RendererShutdownEnd,
DestroyVertexDecl,
@ -520,10 +521,12 @@ namespace bgfx
read(reinterpret_cast<uint8_t*>(&_in), sizeof(Type) );
}
void skip(uint32_t _size)
const uint8_t* skip(uint32_t _size)
{
BX_CHECK(m_pos < m_size, "");
const uint8_t* result = &m_buffer[m_pos];
m_pos += _size;
return result;
}
void reset()
@ -2161,7 +2164,7 @@ namespace bgfx
cmdbuf.write(handle);
cmdbuf.write(_type);
cmdbuf.write(_num);
uint8_t len = (uint8_t)strlen(_name);
uint8_t len = (uint8_t)strlen(_name)+1;
cmdbuf.write(len);
cmdbuf.write(_name, len);
}
@ -2176,10 +2179,12 @@ namespace bgfx
m_submit->free(_handle);
}
void saveScreenShot(const Memory* _mem)
void saveScreenShot(const char* _filePath)
{
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::SaveScreenShot);
cmdbuf.write(_mem);
uint16_t len = (uint16_t)strlen(_filePath)+1;
cmdbuf.write(len);
cmdbuf.write(_filePath, len);
}
void setUniform(UniformHandle _handle, const void* _value, uint16_t _num)
@ -2194,6 +2199,15 @@ namespace bgfx
BX_CHECK(false, "NOT IMPLEMENTED!");
}
void setViewName(uint8_t _id, const char* _name)
{
CommandBuffer& cmdbuf = getCommandBuffer(CommandBuffer::UpdateViewName);
cmdbuf.write(_id);
uint16_t len = (uint16_t)strlen(_name)+1;
cmdbuf.write(len);
cmdbuf.write(_name, len);
}
void setViewRect(uint8_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
Rect& rect = m_rect[_id];
@ -2461,7 +2475,8 @@ namespace bgfx
void rendererDestroyRenderTarget(RenderTargetHandle _handle);
void rendererCreateUniform(UniformHandle _handle, UniformType::Enum _type, uint16_t _num, const char* _name);
void rendererDestroyUniform(UniformHandle _handle);
void rendererSaveScreenShot(Memory* _mem);
void rendererSaveScreenShot(const char* _filePath);
void rendererUpdateViewName(uint8_t _id, const char* _name);
void rendererUpdateUniform(uint16_t _loc, const void* _data, uint32_t _size);
void rendererUpdateUniforms(ConstantBuffer* _constantBuffer, uint32_t _begin, uint32_t _end)
@ -2906,9 +2921,7 @@ namespace bgfx
uint8_t len;
_cmdbuf.read(len);
char name[256];
_cmdbuf.read(name, len);
name[len] = '\0';
const char* name = (const char*)_cmdbuf.skip(len);
rendererCreateUniform(handle, type, num, name);
}
@ -2925,12 +2938,26 @@ namespace bgfx
case CommandBuffer::SaveScreenShot:
{
Memory* mem;
_cmdbuf.read(mem);
uint16_t len;
_cmdbuf.read(len);
rendererSaveScreenShot(mem);
const char* filePath = (const char*)_cmdbuf.skip(len);
release(mem);
rendererSaveScreenShot(filePath);
}
break;
case CommandBuffer::UpdateViewName:
{
uint8_t id;
_cmdbuf.read(id);
uint16_t len;
_cmdbuf.read(len);
const char* name = (const char*)_cmdbuf.skip(len);
rendererUpdateViewName(id, name);
}
break;

View File

@ -93,7 +93,7 @@
/// DX9 PIX markers
#ifndef BGFX_CONFIG_DEBUG_PIX
# define BGFX_CONFIG_DEBUG_PIX 0
# define BGFX_CONFIG_DEBUG_PIX BGFX_CONFIG_DEBUG
#endif // BGFX_CONFIG_DEBUG_PIX
/// AMD gDEBugger markers

View File

@ -36,6 +36,28 @@ namespace bgfx
# define DX_CHECK(_call) _call
#endif // BGFX_CONFIG_DEBUG
typedef int (WINAPI *D3DPERF_BeginEventFunc)(DWORD _color, LPCWSTR _wszName);
typedef int (WINAPI *D3DPERF_EndEventFunc)();
typedef void (WINAPI *D3DPERF_SetMarkerFunc)(DWORD _color, LPCWSTR _wszName);
typedef void (WINAPI *D3DPERF_SetRegionFunc)(DWORD _color, LPCWSTR _wszName);
typedef BOOL (WINAPI *D3DPERF_QueryRepeatFrameFunc)();
typedef void (WINAPI *D3DPERF_SetOptionsFunc)(DWORD _options);
typedef DWORD (WINAPI *D3DPERF_GetStatusFunc)();
#define _PIX_SETMARKER(_col, _name) s_renderCtx.m_D3DPERF_SetMarker(_col, _name)
#define _PIX_BEGINEVENT(_col, _name) s_renderCtx.m_D3DPERF_BeginEvent(_col, _name)
#define _PIX_ENDEVENT() s_renderCtx.m_D3DPERF_EndEvent()
#if BGFX_CONFIG_DEBUG_PIX
# define PIX_SETMARKER(_color, _name) _PIX_SETMARKER(_color, _name)
# define PIX_BEGINEVENT(_color, _name) _PIX_BEGINEVENT(_color, _name)
# define PIX_ENDEVENT() _PIX_ENDEVENT()
#else
# define PIX_SETMARKER(_color, _name)
# define PIX_BEGINEVENT(_color, _name)
# define PIX_ENDEVENT()
#endif // BGFX_CONFIG_DEBUG_PIX
#if BGFX_CONFIG_DEBUG
# define DX_CHECK_REFCOUNT(_ptr, _expected) \
do { \

View File

@ -10,6 +10,8 @@
namespace bgfx
{
static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][256];
typedef HRESULT (WINAPI * PFN_CREATEDXGIFACTORY)(REFIID _riid, void** _factory);
static const D3D11_PRIMITIVE_TOPOLOGY s_primType[] =
@ -321,6 +323,22 @@ namespace bgfx
m_d3d11dll = LoadLibrary("d3d11.dll");
BGFX_FATAL(NULL != m_d3d11dll, Fatal::UnableToInitialize, "Failed to load d3d11.dll.");
#if BGFX_CONFIG_DEBUG_PIX
// D3D11_1.h has ID3DUserDefinedAnnotation
// http://msdn.microsoft.com/en-us/library/windows/desktop/hh446881%28v=vs.85%29.aspx
m_d3d9dll = LoadLibrary("d3d9.dll");
BGFX_FATAL(NULL != m_d3d9dll, Fatal::UnableToInitialize, "Failed to load d3d9.dll.");
m_D3DPERF_SetMarker = (D3DPERF_SetMarkerFunc)GetProcAddress(m_d3d9dll, "D3DPERF_SetMarker");
m_D3DPERF_BeginEvent = (D3DPERF_BeginEventFunc)GetProcAddress(m_d3d9dll, "D3DPERF_BeginEvent");
m_D3DPERF_EndEvent = (D3DPERF_EndEventFunc)GetProcAddress(m_d3d9dll, "D3DPERF_EndEvent");
BX_CHECK(NULL != m_D3DPERF_SetMarker
&& NULL != m_D3DPERF_BeginEvent
&& NULL != m_D3DPERF_EndEvent
, "Failed to initialize PIX events."
);
#endif // BGFX_CONFIG_DEBUG_PIX
PFN_D3D11_CREATE_DEVICE d3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(m_d3d11dll, "D3D11CreateDevice");
BGFX_FATAL(NULL != d3D11CreateDevice, Fatal::UnableToInitialize, "Function D3D11CreateDevice not found.");
@ -1030,7 +1048,7 @@ namespace bgfx
}
}
void saveScreenShot(Memory* _mem)
void saveScreenShot(const char* _filePath)
{
ID3D11Texture2D* backBuffer;
DX_CHECK(m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)&backBuffer) );
@ -1070,7 +1088,7 @@ namespace bgfx
D3D11_MAPPED_SUBRESOURCE mapped;
DX_CHECK(m_deviceCtx->Map(texture, 0, D3D11_MAP_READ, 0, &mapped) );
g_callback->screenShot( (const char*)_mem->data
g_callback->screenShot(_filePath
, backBufferDesc.Width
, backBufferDesc.Height
, mapped.RowPitch
@ -1086,6 +1104,13 @@ namespace bgfx
DX_RELEASE(backBuffer, 0);
}
#if BGFX_CONFIG_DEBUG_PIX
HMODULE m_d3d9dll;
D3DPERF_SetMarkerFunc m_D3DPERF_SetMarker;
D3DPERF_BeginEventFunc m_D3DPERF_BeginEvent;
D3DPERF_EndEventFunc m_D3DPERF_EndEvent;
#endif // BGFX_CONFIG_DEBUG_PIX
HMODULE m_d3d11dll;
HMODULE m_dxgidll;
D3D_DRIVER_TYPE m_driverType;
@ -2211,9 +2236,14 @@ namespace bgfx
s_renderCtx.m_uniforms[_handle.idx].destroy();
}
void Context::rendererSaveScreenShot(Memory* _mem)
void Context::rendererSaveScreenShot(const char* _filePath)
{
s_renderCtx.saveScreenShot(_mem);
s_renderCtx.saveScreenShot(_filePath);
}
void Context::rendererUpdateViewName(uint8_t _id, const char* _name)
{
mbstowcs(&s_viewNameW[_id][0], _name, 256*sizeof(wchar_t) );
}
void Context::rendererUpdateUniform(uint16_t _loc, const void* _data, uint32_t _size)
@ -2223,6 +2253,8 @@ namespace bgfx
void Context::rendererSubmit()
{
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
ID3D11DeviceContext* deviceCtx = s_renderCtx.m_deviceCtx;
s_renderCtx.updateResolution(m_render->m_resolution);
@ -2295,6 +2327,9 @@ namespace bgfx
currentState.m_flags = newFlags;
currentState.m_stencil = newStencil;
PIX_ENDEVENT();
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), s_viewNameW[key.m_view]);
view = key.m_view;
programIdx = invalidHandle;
@ -2721,7 +2756,7 @@ namespace bgfx
if (m_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{
// PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), "debugstats");
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
TextVideoMem& tvm = s_renderCtx.m_textVideoMem;
@ -2785,15 +2820,15 @@ namespace bgfx
m_textVideoMemBlitter.blit(tvm);
// PIX_ENDEVENT();
PIX_ENDEVENT();
}
else if (m_render->m_debug & BGFX_DEBUG_TEXT)
{
// PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), "debugtext");
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
m_textVideoMemBlitter.blit(m_render->m_textVideoMem);
// PIX_ENDEVENT();
PIX_ENDEVENT();
}
}
}

View File

@ -10,6 +10,9 @@
#include <d3d11.h>
#include "renderer_d3d.h"
#define D3DCOLOR_ARGB(_a, _r, _g, _b) ( (DWORD)( ( ( (_a)&0xff)<<24)|( ( (_r)&0xff)<<16)|( ( (_g)&0xff)<<8)|( (_b)&0xff) ) )
#define D3DCOLOR_RGBA(_r, _g, _b, _a) D3DCOLOR_ARGB(_a, _r, _g, _b)
namespace bgfx
{
template <typename Ty>

View File

@ -10,6 +10,8 @@
namespace bgfx
{
static wchar_t s_viewNameW[BGFX_CONFIG_MAX_VIEWS][256];
static const D3DPRIMITIVETYPE s_primType[] =
{
D3DPT_TRIANGLELIST,
@ -250,10 +252,18 @@ namespace bgfx
m_d3d9dll = LoadLibrary("d3d9.dll");
BGFX_FATAL(NULL != m_d3d9dll, Fatal::UnableToInitialize, "Failed to load d3d9.dll.");
#if BGFX_CONFIG_DEBUG_PIX
m_D3DPERF_SetMarker = (D3DPERF_SetMarkerFunc)GetProcAddress(m_d3d9dll, "D3DPERF_SetMarker");
m_D3DPERF_BeginEvent = (D3DPERF_BeginEventFunc)GetProcAddress(m_d3d9dll, "D3DPERF_BeginEvent");
m_D3DPERF_EndEvent = (D3DPERF_EndEventFunc)GetProcAddress(m_d3d9dll, "D3DPERF_EndEvent");
BX_CHECK(NULL != m_D3DPERF_SetMarker
&& NULL != m_D3DPERF_BeginEvent
&& NULL != m_D3DPERF_EndEvent
, "Failed to initialize PIX events."
);
#endif // BGFX_CONFIG_DEBUG_PIX
#if BGFX_CONFIG_RENDERER_DIRECT3D9EX
Direct3DCreate9ExFn direct3DCreate9Ex = (Direct3DCreate9ExFn)GetProcAddress(m_d3d9dll, "Direct3DCreate9Ex");
BGFX_FATAL(NULL != direct3DCreate9Ex, Fatal::UnableToInitialize, "Function Direct3DCreate9Ex not found.");
@ -797,7 +807,7 @@ namespace bgfx
}
}
void saveScreenShot(Memory* _mem)
void saveScreenShot(const char* _filePath)
{
#if BX_PLATFORM_WINDOWS
IDirect3DSurface9* surface;
@ -832,7 +842,7 @@ namespace bgfx
uint8_t* data = (uint8_t*)rect.pBits;
uint32_t bytesPerPixel = rect.Pitch/dm.Width;
g_callback->screenShot( (const char*)_mem->data
g_callback->screenShot(_filePath
, m_params.BackBufferWidth
, m_params.BackBufferHeight
, rect.Pitch
@ -849,9 +859,11 @@ namespace bgfx
#if BX_PLATFORM_WINDOWS
D3DCAPS9 m_caps;
# if BGFX_CONFIG_DEBUG_PIX
D3DPERF_SetMarkerFunc m_D3DPERF_SetMarker;
D3DPERF_BeginEventFunc m_D3DPERF_BeginEvent;
D3DPERF_EndEventFunc m_D3DPERF_EndEvent;
# endif // BGFX_CONFIG_DEBUG_PIX
#endif // BX_PLATFORM_WINDOWS
#if BGFX_CONFIG_RENDERER_DIRECT3D9EX
@ -2122,9 +2134,14 @@ namespace bgfx
g_free(s_renderCtx.m_uniforms[_handle.idx]);
}
void Context::rendererSaveScreenShot(Memory* _mem)
void Context::rendererSaveScreenShot(const char* _filePath)
{
s_renderCtx.saveScreenShot(_mem);
s_renderCtx.saveScreenShot(_filePath);
}
void Context::rendererUpdateViewName(uint8_t _id, const char* _name)
{
mbstowcs(&s_viewNameW[_id][0], _name, 256*sizeof(wchar_t) );
}
void Context::rendererUpdateUniform(uint16_t _loc, const void* _data, uint32_t _size)
@ -2136,7 +2153,7 @@ namespace bgfx
{
IDirect3DDevice9* device = s_renderCtx.m_device;
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), "rendererSubmit");
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
s_renderCtx.updateResolution(m_render->m_resolution);
@ -2209,7 +2226,7 @@ namespace bgfx
currentState.m_stencil = newStencil;
PIX_ENDEVENT();
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), "view");
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), s_viewNameW[key.m_view]);
view = key.m_view;
programIdx = invalidHandle;
@ -2761,7 +2778,7 @@ namespace bgfx
if (m_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), "debugstats");
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
TextVideoMem& tvm = s_renderCtx.m_textVideoMem;
@ -2823,7 +2840,7 @@ namespace bgfx
}
else if (m_render->m_debug & BGFX_DEBUG_TEXT)
{
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), "debugtext");
PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
m_textVideoMemBlitter.blit(m_render->m_textVideoMem);

View File

@ -28,18 +28,6 @@ typedef HRESULT (WINAPI *Direct3DCreate9ExFn)(UINT SDKVersion, IDirect3D9Ex**);
typedef IDirect3D9* (WINAPI *Direct3DCreate9Fn)(UINT SDKVersion);
# endif // BGFX_CONFIG_RENDERER_DIRECT3D9EX
typedef int (WINAPI *D3DPERF_BeginEventFunc)(D3DCOLOR col, LPCWSTR wszName);
typedef int (WINAPI *D3DPERF_EndEventFunc)();
typedef void (WINAPI *D3DPERF_SetMarkerFunc)(D3DCOLOR col, LPCWSTR wszName);
typedef void (WINAPI *D3DPERF_SetRegionFunc)(D3DCOLOR col, LPCWSTR wszName);
typedef BOOL (WINAPI *D3DPERF_QueryRepeatFrameFunc)();
typedef void (WINAPI *D3DPERF_SetOptionsFunc)(DWORD dwOptions);
typedef DWORD (WINAPI *D3DPERF_GetStatusFunc)();
# define _PIX_SETMARKER(_col, _name) s_renderCtx.m_D3DPERF_SetMarker(_col, L#_name)
# define _PIX_BEGINEVENT(_col, _name) s_renderCtx.m_D3DPERF_BeginEvent(_col, L#_name)
# define _PIX_ENDEVENT() s_renderCtx.m_D3DPERF_EndEvent()
#elif BX_PLATFORM_XBOX360
# include <xgraphics.h>
# define D3DUSAGE_DYNAMIC 0 // not supported on X360
@ -60,16 +48,6 @@ typedef DWORD (WINAPI *D3DPERF_GetStatusFunc)();
namespace bgfx
{
#if BGFX_CONFIG_DEBUG_PIX
# define PIX_SETMARKER(_col, _name) _PIX_SETMARKER(_col, _name)
# define PIX_BEGINEVENT(_col, _name) _PIX_BEGINEVENT(_col, _name)
# define PIX_ENDEVENT() _PIX_ENDEVENT()
#else
# define PIX_SETMARKER(_col, _name)
# define PIX_BEGINEVENT(_col, _name)
# define PIX_ENDEVENT()
#endif // BGFX_CONFIG_DEBUG_PIX
# ifndef D3DFMT_ATI1
# define D3DFMT_ATI1 ( (D3DFORMAT)BX_MAKEFOURCC('A', 'T', 'I', '1') )
# endif // D3DFMT_ATI1

View File

@ -12,6 +12,8 @@
namespace bgfx
{
static char s_viewName[BGFX_CONFIG_MAX_VIEWS][256];
struct Extension
{
enum Enum
@ -143,6 +145,16 @@ namespace bgfx
static PFNGLDRAWELEMENTSINSTANCEDBGFXPROC s_drawElementsInstanced = stubDrawElementsInstanced;
#endif // BGFX_CONFIG_RENDERER_OPENGLES3
#if BGFX_CONFIG_DEBUG_GREMEDY
static void GL_APIENTRY stubStringMarkerGREMEDY(GLsizei /*_len*/, const GLvoid* /*_string*/)
{
}
static void GL_APIENTRY stubFrameTerminatorGREMEDY()
{
}
#endif // BGFX_CONFIG_DEBUG_GREMEDY
typedef void (*PostSwapBuffersFn)(uint32_t _width, uint32_t _height);
static void rgbaToBgra(uint8_t* _data, uint32_t _width, uint32_t _height)
@ -472,7 +484,7 @@ namespace bgfx
}
}
void saveScreenShot(Memory* _mem)
void saveScreenShot(const char* _filePath)
{
uint32_t length = m_resolution.m_width*m_resolution.m_height*4;
uint8_t* data = (uint8_t*)g_realloc(NULL, length);
@ -495,7 +507,7 @@ namespace bgfx
rgbaToBgra(data, width, height);
}
g_callback->screenShot( (const char*)_mem->data
g_callback->screenShot(_filePath
, width
, height
, width*4
@ -515,6 +527,15 @@ namespace bgfx
m_version = getGLString(GL_VERSION);
m_glslVersion = getGLString(GL_SHADING_LANGUAGE_VERSION);
#if BGFX_CONFIG_DEBUG_GREMEDY
if (NULL == glStringMarkerGREMEDY
|| NULL == glFrameTerminatorGREMEDY)
{
glStringMarkerGREMEDY = stubStringMarkerGREMEDY;
glFrameTerminatorGREMEDY = stubFrameTerminatorGREMEDY;
}
#endif // BGFX_CONFIG_DEBUG_GREMEDY
#if BGFX_CONFIG_RENDERER_OPENGL
m_queries.create();
#endif // BGFX_CONFIG_RENDERER_OPENGL
@ -2559,9 +2580,14 @@ namespace bgfx
g_free(s_renderCtx.m_uniforms[_handle.idx]);
}
void Context::rendererSaveScreenShot(Memory* _mem)
void Context::rendererSaveScreenShot(const char* _filePath)
{
s_renderCtx.saveScreenShot(_mem);
s_renderCtx.saveScreenShot(_filePath);
}
void Context::rendererUpdateViewName(uint8_t _id, const char* _name)
{
bx::strlcpy(&s_viewName[_id][0], _name, sizeof(s_viewName[0][0]) );
}
void Context::rendererUpdateUniform(uint16_t _loc, const void* _data, uint32_t _size)
@ -2657,7 +2683,7 @@ namespace bgfx
changedStencil = packStencil(BGFX_STENCIL_MASK, BGFX_STENCIL_MASK);
currentState.m_flags = newFlags;
GREMEDY_SETMARKER("view");
GREMEDY_SETMARKER(s_viewName[key.m_view]);
view = key.m_view;
programIdx = invalidHandle;

View File

@ -253,22 +253,8 @@ namespace bgfx
#endif // BGFX_CONFIG_DEBUG
#if BGFX_CONFIG_DEBUG_GREMEDY
# define _GREMEDY_SETMARKER(_string) \
do \
{ \
if (NULL != glStringMarkerGREMEDY) \
{ \
glStringMarkerGREMEDY( (GLsizei)strlen(_string), _string); \
} \
} while(0)
# define _GREMEDY_FRAMETERMINATOR() \
do \
{ \
if (NULL != glStringMarkerGREMEDY) \
{ \
glFrameTerminatorGREMEDY(); \
} \
} while(0)
# define _GREMEDY_SETMARKER(_string) glStringMarkerGREMEDY(0, _string)
# define _GREMEDY_FRAMETERMINATOR() glFrameTerminatorGREMEDY()
#else
# define _GREMEDY_SETMARKER(_string) do {} while(0)
# define _GREMEDY_FRAMETERMINATOR() do {} while(0)

View File

@ -156,7 +156,11 @@ namespace bgfx
{
}
void Context::rendererSaveScreenShot(Memory* /*_mem*/)
void Context::rendererSaveScreenShot(const char* /*_filePath*/)
{
}
void Context::rendererUpdateViewName(uint8_t /*_id*/, const char* /*_name*/)
{
}