This commit is contained in:
Branimir Karadžić 2014-03-04 22:20:37 -08:00
Родитель fc3e657b40
Коммит dea6567b5b
5 изменённых файлов: 500 добавлений и 475 удалений

Просмотреть файл

@ -105,11 +105,6 @@
# define BGFX_CONFIG_DEBUG_PIX BGFX_CONFIG_DEBUG
#endif // BGFX_CONFIG_DEBUG_PIX
/// AMD gDEBugger markers
#ifndef BGFX_CONFIG_DEBUG_GREMEDY
# define BGFX_CONFIG_DEBUG_GREMEDY 0
#endif // BGFX_CONFIG_DEBUG_GREMEDY
/// DX11 object names
#ifndef BGFX_CONFIG_DEBUG_OBJECT_NAME
# define BGFX_CONFIG_DEBUG_OBJECT_NAME BGFX_CONFIG_DEBUG

Просмотреть файл

@ -163,6 +163,10 @@ typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsiz
typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC)(GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
typedef void (GL_APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void *string);
typedef void (GL_APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void);
typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
#endif // GL_IMPORT_TYPEDEFS
#if BGFX_USE_GL_DYNAMIC_LIB
@ -316,10 +320,14 @@ GL_IMPORT_EXT__(true, PFNGLGENRENDERBUFFERSPROC, glGenRenderbu
GL_IMPORT_EXT__(true, PFNGLDELETERENDERBUFFERSPROC, glDeleteRenderbuffers);
GL_IMPORT_EXT__(true, PFNGLRENDERBUFFERSTORAGEPROC, glRenderbufferStorage);
GL_IMPORT_EXT__(true, PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC, glRenderbufferStorageMultisample);
# else // GLES
GL_IMPORT______(false, PFNGLCLEARDEPTHFPROC, glClearDepthf);
# endif // BGFX_CONFIG_RENDERER_OPENGL
GL_IMPORT______(true, PFNGLINSERTEVENTMARKEREXTPROC, glInsertEventMarker);
GL_IMPORT______(true, PFNGLPUSHGROUPMARKEREXTPROC, glPushGroupMarker);
GL_IMPORT______(true, PFNGLPOPGROUPMARKEREXTPROC, glPopGroupMarker);
#endif // BGFX_USE_GL_DYNAMIC_LIB
GL_IMPORT______(true, PFNGLSTRINGMARKERGREMEDYPROC, glStringMarkerGREMEDY);
@ -339,6 +347,10 @@ GL_IMPORT_OES__(true, PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC, glCompressedT
GL_IMPORT_EXT__(true, PFNGLTEXSTORAGE2DPROC, glTexStorage2D);
GL_IMPORT_EXT__(true, PFNGLTEXSTORAGE3DPROC, glTexStorage3D);
GL_IMPORT_EXT__(true, PFNGLINSERTEVENTMARKEREXTPROC, glInsertEventMarker);
GL_IMPORT_EXT__(true, PFNGLPUSHGROUPMARKEREXTPROC, glPushGroupMarker);
GL_IMPORT_EXT__(true, PFNGLPOPGROUPMARKEREXTPROC, glPopGroupMarker);
GL_IMPORT_OES__(true, PFNGLGETPROGRAMBINARYPROC, glGetProgramBinary);
GL_IMPORT_OES__(true, PFNGLPROGRAMBINARYPROC, glProgramBinary);

Просмотреть файл

@ -326,16 +326,17 @@ namespace bgfx
template <typename Ty>
static BX_NO_INLINE void setDebugObjectName(Ty* _interface, const char* _format, ...)
{
#if BGFX_CONFIG_DEBUG_OBJECT_NAME
char temp[2048];
va_list argList;
va_start(argList, _format);
int size = uint32_min(sizeof(temp)-1, vsnprintf(temp, sizeof(temp), _format, argList) );
va_end(argList);
temp[size] = '\0';
if (BX_ENABLED(BGFX_CONFIG_DEBUG_OBJECT_NAME) )
{
char temp[2048];
va_list argList;
va_start(argList, _format);
int size = bx::uint32_min(sizeof(temp)-1, vsnprintf(temp, sizeof(temp), _format, argList) );
va_end(argList);
temp[size] = '\0';
_interface->SetPrivateData(WKPDID_D3DDebugObjectName, size, temp);
#endif // BGFX_CONFIG_DEBUG_OBJECT_NAME
_interface->SetPrivateData(WKPDID_D3DDebugObjectName, size, temp);
}
}
struct RendererContext
@ -357,21 +358,22 @@ namespace bgfx
m_d3d11dll = bx::dlopen("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 = bx::dlopen("d3d9.dll");
BGFX_FATAL(NULL != m_d3d9dll, Fatal::UnableToInitialize, "Failed to load d3d9.dll.");
if (BX_ENABLED(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 = bx::dlopen("d3d9.dll");
BGFX_FATAL(NULL != m_d3d9dll, Fatal::UnableToInitialize, "Failed to load d3d9.dll.");
m_D3DPERF_SetMarker = (D3DPERF_SetMarkerFunc)bx::dlsym(m_d3d9dll, "D3DPERF_SetMarker");
m_D3DPERF_BeginEvent = (D3DPERF_BeginEventFunc)bx::dlsym(m_d3d9dll, "D3DPERF_BeginEvent");
m_D3DPERF_EndEvent = (D3DPERF_EndEventFunc)bx::dlsym(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
m_D3DPERF_SetMarker = (D3DPERF_SetMarkerFunc)bx::dlsym(m_d3d9dll, "D3DPERF_SetMarker");
m_D3DPERF_BeginEvent = (D3DPERF_BeginEventFunc)bx::dlsym(m_d3d9dll, "D3DPERF_BeginEvent");
m_D3DPERF_EndEvent = (D3DPERF_EndEventFunc)bx::dlsym(m_d3d9dll, "D3DPERF_EndEvent");
BX_CHECK(NULL != m_D3DPERF_SetMarker
&& NULL != m_D3DPERF_BeginEvent
&& NULL != m_D3DPERF_EndEvent
, "Failed to initialize PIX events."
);
}
PFN_D3D11_CREATE_DEVICE d3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)bx::dlsym(m_d3d11dll, "D3D11CreateDevice");
BGFX_FATAL(NULL != d3D11CreateDevice, Fatal::UnableToInitialize, "Function D3D11CreateDevice not found.");
@ -415,13 +417,12 @@ namespace bgfx
, desc.SharedSystemMemory
);
#if BGFX_CONFIG_DEBUG_PERFHUD
if (0 != strstr(description, "PerfHUD") )
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PERFHUD)
&& 0 != strstr(description, "PerfHUD") )
{
m_adapter = adapter;
m_driverType = D3D_DRIVER_TYPE_REFERENCE;
}
#endif // BGFX_CONFIG_DEBUG_PERFHUD
}
DX_RELEASE(adapter, adapter == m_adapter ? 1 : 0);
@ -1271,6 +1272,8 @@ namespace bgfx
, &m_ptr
) );
}
setDebugObjectName(m_ptr, "IndexBuffer (dynamic %d)", m_dynamic);
}
void IndexBuffer::update(uint32_t _offset, uint32_t _size, void* _data)
@ -2205,13 +2208,13 @@ namespace bgfx
void Context::rendererSetMarker(const char* _marker, uint32_t _size)
{
#if BGFX_CONFIG_DEBUG_PIX
uint32_t size = _size*sizeof(wchar_t);
wchar_t* name = (wchar_t*)alloca(size);
mbstowcs(name, _marker, size-2);
PIX_SETMARKER(D3DCOLOR_RGBA(0xff, 0xff, 0xff, 0xff), name);
#endif // BGFX_CONFIG_DEBUG_PIX
BX_UNUSED(_marker, _size);
if (BX_ENABLED(BGFX_CONFIG_DEBUG_PIX) )
{
uint32_t size = _size*sizeof(wchar_t);
wchar_t* name = (wchar_t*)alloca(size);
mbstowcs(name, _marker, size-2);
PIX_SETMARKER(D3DCOLOR_RGBA(0xff, 0xff, 0xff, 0xff), name);
}
}
void Context::rendererSubmit()

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -307,10 +307,6 @@ typedef uint64_t GLuint64;
# include "glcontext_eagl.h"
#endif // BX_PLATFORM_
#if BGFX_CONFIG_DEBUG_GREMEDY && (BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX)
# include <gl/GRemedyGLExtensions.h>
#endif // BGFX_CONFIG_DEBUG_GREMEDY && (BX_PLATFORM_WINDOWS || BX_PLATFORM_LINUX)
#if BGFX_USE_WGL
# include "glcontext_wgl.h"
#endif // BGFX_USE_WGL
@ -343,17 +339,6 @@ namespace bgfx
# define GL_CHECK(_call) _call
#endif // BGFX_CONFIG_DEBUG
#if BGFX_CONFIG_DEBUG_GREMEDY
# define _GREMEDY_SETMARKER(_string) glStringMarkerGREMEDY(0, _string)
# define _GREMEDY_FRAMETERMINATOR() glFrameTerminatorGREMEDY()
#else
# define _GREMEDY_SETMARKER(_string) do { BX_UNUSED(_string); } while(0)
# define _GREMEDY_FRAMETERMINATOR() do {} while(0)
#endif // BGFX_CONFIG_DEBUG_GREMEDY
#define GREMEDY_SETMARKER(_string) _GREMEDY_SETMARKER(_string)
#define GREMEDY_FRAMETERMINATOR() _GREMEDY_FRAMETERMINATOR()
#define GL_IMPORT_TYPEDEFS 1
#define GL_IMPORT(_optional, _proto, _func, _import) extern _proto _func
#include "glimports.h"