diff --git a/include/bgfx.h b/include/bgfx.h index a189e3d1b..71ef8e5f5 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -418,9 +418,6 @@ namespace bgfx /// void saveScreenShot(const char* _filePath); - /// - void renderFrame(); - } // namespace bgfx #endif // __BGFX_H__ diff --git a/src/bgfx.cpp b/src/bgfx.cpp index a770458f2..4127b7d06 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -574,7 +574,7 @@ namespace bgfx void dump(const VertexDecl& _decl) { -#if BGFX_DEBUG +#if BGFX_CONFIG_DEBUG BX_TRACE("vertexdecl %08x (%08x), stride %d" , _decl.m_hash , 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] = diff --git a/src/bgfx_p.h b/src/bgfx_p.h index b9e45673a..66f3667b1 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -16,9 +16,11 @@ extern void dbgPrintf(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, ...) \ do { \ dbgPrintf(BX_FILE_LINE_LITERAL "BGFX " _format "\n", ##__VA_ARGS__); \ @@ -208,6 +210,7 @@ namespace bgfx extern void release(Memory* _mem); 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 void renderFrame(); inline uint32_t uint16_min(uint16_t _a, uint16_t _b) { @@ -1877,7 +1880,7 @@ namespace bgfx void dumpViewStats() { -#if 0 // BGFX_DEBUG +#if 0 // BGFX_CONFIG_DEBUG for (uint8_t view = 0; view < BGFX_CONFIG_MAX_VIEWS; ++view) { if (0 < m_seq[view]) @@ -1885,7 +1888,7 @@ namespace bgfx BX_TRACE("%d: %d", view, m_seq[view]); } } -#endif // BGFX_DEBUG +#endif // BGFX_CONFIG_DEBUG } void freeAllHandles(Frame* _frame) @@ -2488,9 +2491,14 @@ namespace bgfx 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; - uint32_t width = rect.right-rect.left; - uint32_t height = rect.bottom-rect.top; + uint32_t frameWidth = rect.right-rect.left - width; + uint32_t frameHeight = rect.bottom-rect.top - height; switch (_wparam) { @@ -2512,8 +2520,8 @@ namespace bgfx break; } - rect.right = rect.left + width; - rect.bottom = rect.top + height; + rect.right = rect.left + width + frameWidth; + rect.bottom = rect.top + height + frameHeight; SetWindowPos(_hwnd , HWND_TOP diff --git a/src/renderer_d3d9.h b/src/renderer_d3d9.h index 7e7b27cad..73c1d4178 100644 --- a/src/renderer_d3d9.h +++ b/src/renderer_d3d9.h @@ -74,7 +74,7 @@ namespace bgfx BX_CHECK(SUCCEEDED(__hr__), #_call " FAILED 0x%08x\n", (uint32_t)__hr__); \ } while (0) -#if BGFX_DEBUG +#if BGFX_CONFIG_DEBUG # define DX_CHECK(_call) _DX_CHECK(_call) # define PIX_SETMARKER(_col, _name) _PIX_SETMARKER(_col, _name) # define PIX_BEGINEVENT(_col, _name) _PIX_BEGINEVENT(_col, _name) @@ -84,7 +84,7 @@ namespace bgfx # define PIX_SETMARKER(_col, _name) # define PIX_BEGINEVENT(_col, _name) # define PIX_ENDEVENT() -#endif // BGFX_DEBUG +#endif // BGFX_CONFIG_DEBUG #define DX_RELEASE(_ptr, _expected) \ do { \ diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 3e2502770..0250f583d 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -1074,7 +1074,7 @@ namespace bgfx { s_renderCtx.init(); -#if BGFX_DEBUG +#if BGFX_CONFIG_DEBUG GLint 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_VERTEX_TEXTURE_IMAGE_UNITS, 0); GL_GET(GL_MAX_RENDERBUFFER_SIZE, 1); -#endif // BGFX_DEBUG +#endif // BGFX_CONFIG_DEBUG const char* extensions = (const char*)glGetString(GL_EXTENSIONS); diff --git a/src/renderer_gl.h b/src/renderer_gl.h index 6b948e64d..8af26f085 100644 --- a/src/renderer_gl.h +++ b/src/renderer_gl.h @@ -57,11 +57,11 @@ namespace bgfx BX_CHECK(0 == err, #_call "; glError 0x%x %d", err, err); \ } while (0) -#if BGFX_DEBUG +#if BGFX_CONFIG_DEBUG # define GL_CHECK(_call) _call // _GL_CHECK(_call) #else # define GL_CHECK(_call) _call -#endif // BGFX_DEBUG +#endif // BGFX_CONFIG_DEBUG struct ConstantBuffer;