Added BGFX_CONFIG_DEBUG configurable thru compiler options.

This commit is contained in:
bkaradzic 2012-05-21 18:53:51 -07:00
parent a58537ebd1
commit 8199e07fa6
6 changed files with 24 additions and 19 deletions

View File

@ -418,9 +418,6 @@ namespace bgfx
/// ///
void saveScreenShot(const char* _filePath); void saveScreenShot(const char* _filePath);
///
void renderFrame();
} // namespace bgfx } // namespace bgfx
#endif // __BGFX_H__ #endif // __BGFX_H__

View File

@ -574,7 +574,7 @@ namespace bgfx
void dump(const VertexDecl& _decl) void dump(const VertexDecl& _decl)
{ {
#if BGFX_DEBUG #if BGFX_CONFIG_DEBUG
BX_TRACE("vertexdecl %08x (%08x), stride %d" BX_TRACE("vertexdecl %08x (%08x), stride %d"
, _decl.m_hash , _decl.m_hash
, hash(_decl.m_attributes, sizeof(_decl.m_attributes) ) , hash(_decl.m_attributes, sizeof(_decl.m_attributes) )
@ -600,7 +600,7 @@ namespace bgfx
); );
} }
} }
#endif // BGFX_DEBUG #endif // BGFX_CONFIG_DEBUG
} }
const uint32_t g_constantTypeSize[ConstantType::Count] = const uint32_t g_constantTypeSize[ConstantType::Count] =

View File

@ -16,9 +16,11 @@
extern void dbgPrintf(const char* _format, ...); extern void dbgPrintf(const char* _format, ...);
extern void dbgPrintfData(const void* _data, uint32_t _size, const char* _format, ...); extern void dbgPrintfData(const void* _data, uint32_t _size, const char* _format, ...);
#define BGFX_DEBUG 0 #ifndef BGFX_CONFIG_DEBUG
# define BGFX_CONFIG_DEBUG 0
#endif // BGFX_CONFIG_DEBUG
#if BGFX_DEBUG #if BGFX_CONFIG_DEBUG
# define BX_TRACE(_format, ...) \ # define BX_TRACE(_format, ...) \
do { \ do { \
dbgPrintf(BX_FILE_LINE_LITERAL "BGFX " _format "\n", ##__VA_ARGS__); \ dbgPrintf(BX_FILE_LINE_LITERAL "BGFX " _format "\n", ##__VA_ARGS__); \
@ -208,6 +210,7 @@ namespace bgfx
extern void release(Memory* _mem); extern void release(Memory* _mem);
extern void saveTga(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data); extern void saveTga(const char* _filePath, uint32_t _width, uint32_t _height, uint32_t _pitch, const void* _data);
extern const char* getAttribName(Attrib::Enum _attr); extern const char* getAttribName(Attrib::Enum _attr);
extern void renderFrame();
inline uint32_t uint16_min(uint16_t _a, uint16_t _b) inline uint32_t uint16_min(uint16_t _a, uint16_t _b)
{ {
@ -1877,7 +1880,7 @@ namespace bgfx
void dumpViewStats() void dumpViewStats()
{ {
#if 0 // BGFX_DEBUG #if 0 // BGFX_CONFIG_DEBUG
for (uint8_t view = 0; view < BGFX_CONFIG_MAX_VIEWS; ++view) for (uint8_t view = 0; view < BGFX_CONFIG_MAX_VIEWS; ++view)
{ {
if (0 < m_seq[view]) if (0 < m_seq[view])
@ -1885,7 +1888,7 @@ namespace bgfx
BX_TRACE("%d: %d", view, m_seq[view]); BX_TRACE("%d: %d", view, m_seq[view]);
} }
} }
#endif // BGFX_DEBUG #endif // BGFX_CONFIG_DEBUG
} }
void freeAllHandles(Frame* _frame) void freeAllHandles(Frame* _frame)
@ -2488,9 +2491,14 @@ namespace bgfx
case WM_SIZING: case WM_SIZING:
{ {
RECT clientRect;
GetClientRect(_hwnd, &clientRect);
uint32_t width = clientRect.right-clientRect.left;
uint32_t height = clientRect.bottom-clientRect.top;
RECT& rect = *(RECT*)_lparam; RECT& rect = *(RECT*)_lparam;
uint32_t width = rect.right-rect.left; uint32_t frameWidth = rect.right-rect.left - width;
uint32_t height = rect.bottom-rect.top; uint32_t frameHeight = rect.bottom-rect.top - height;
switch (_wparam) switch (_wparam)
{ {
@ -2512,8 +2520,8 @@ namespace bgfx
break; break;
} }
rect.right = rect.left + width; rect.right = rect.left + width + frameWidth;
rect.bottom = rect.top + height; rect.bottom = rect.top + height + frameHeight;
SetWindowPos(_hwnd SetWindowPos(_hwnd
, HWND_TOP , HWND_TOP

View File

@ -74,7 +74,7 @@ namespace bgfx
BX_CHECK(SUCCEEDED(__hr__), #_call " FAILED 0x%08x\n", (uint32_t)__hr__); \ BX_CHECK(SUCCEEDED(__hr__), #_call " FAILED 0x%08x\n", (uint32_t)__hr__); \
} while (0) } while (0)
#if BGFX_DEBUG #if BGFX_CONFIG_DEBUG
# define DX_CHECK(_call) _DX_CHECK(_call) # define DX_CHECK(_call) _DX_CHECK(_call)
# define PIX_SETMARKER(_col, _name) _PIX_SETMARKER(_col, _name) # define PIX_SETMARKER(_col, _name) _PIX_SETMARKER(_col, _name)
# define PIX_BEGINEVENT(_col, _name) _PIX_BEGINEVENT(_col, _name) # define PIX_BEGINEVENT(_col, _name) _PIX_BEGINEVENT(_col, _name)
@ -84,7 +84,7 @@ namespace bgfx
# define PIX_SETMARKER(_col, _name) # define PIX_SETMARKER(_col, _name)
# define PIX_BEGINEVENT(_col, _name) # define PIX_BEGINEVENT(_col, _name)
# define PIX_ENDEVENT() # define PIX_ENDEVENT()
#endif // BGFX_DEBUG #endif // BGFX_CONFIG_DEBUG
#define DX_RELEASE(_ptr, _expected) \ #define DX_RELEASE(_ptr, _expected) \
do { \ do { \

View File

@ -1074,7 +1074,7 @@ namespace bgfx
{ {
s_renderCtx.init(); s_renderCtx.init();
#if BGFX_DEBUG #if BGFX_CONFIG_DEBUG
GLint numCmpFormats; GLint numCmpFormats;
GL_CHECK(glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCmpFormats) ); GL_CHECK(glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCmpFormats) );
@ -1100,7 +1100,7 @@ namespace bgfx
GL_GET(GL_MAX_TEXTURE_SIZE, 64); GL_GET(GL_MAX_TEXTURE_SIZE, 64);
GL_GET(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 0); GL_GET(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, 0);
GL_GET(GL_MAX_RENDERBUFFER_SIZE, 1); GL_GET(GL_MAX_RENDERBUFFER_SIZE, 1);
#endif // BGFX_DEBUG #endif // BGFX_CONFIG_DEBUG
const char* extensions = (const char*)glGetString(GL_EXTENSIONS); const char* extensions = (const char*)glGetString(GL_EXTENSIONS);

View File

@ -57,11 +57,11 @@ namespace bgfx
BX_CHECK(0 == err, #_call "; glError 0x%x %d", err, err); \ BX_CHECK(0 == err, #_call "; glError 0x%x %d", err, err); \
} while (0) } while (0)
#if BGFX_DEBUG #if BGFX_CONFIG_DEBUG
# define GL_CHECK(_call) _call // _GL_CHECK(_call) # define GL_CHECK(_call) _call // _GL_CHECK(_call)
#else #else
# define GL_CHECK(_call) _call # define GL_CHECK(_call) _call
#endif // BGFX_DEBUG #endif // BGFX_CONFIG_DEBUG
struct ConstantBuffer; struct ConstantBuffer;