diff --git a/premake/bgfx.lua b/premake/bgfx.lua index c0ba2b9b1..711bc2689 100644 --- a/premake/bgfx.lua +++ b/premake/bgfx.lua @@ -8,7 +8,7 @@ project "bgfx" } buildoptions { - "-Wall", +-- "-Wall", } defines { diff --git a/src/bgfx_p.h b/src/bgfx_p.h index b02f41bd2..9ab0ada95 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -174,6 +174,13 @@ namespace bgfx return _offset+align-(_offset%align); } + BX_FORCE_INLINE uint32_t castfi(float _value) + { + union { float fl; uint32_t ui; } un; + un.fl = _value; + return un.ui; + } + void dump(const VertexDecl& _decl); struct TextVideoMem diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index afe5ffc5d..16b4db3d3 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -108,13 +108,13 @@ namespace bgfx struct RendererContext { RendererContext() - : m_initialized(false) + : m_flags(BGFX_RESET_NONE) + , m_initialized(false) , m_fmtNULL(false) , m_fmtDF16(false) , m_fmtDF24(false) , m_fmtINTZ(false) , m_fmtRAWZ(false) - , m_flags(BGFX_RESET_NONE) , m_rtMsaa(false) { m_rt.idx = invalidHandle; @@ -1693,8 +1693,7 @@ namespace bgfx if ( (BGFX_STATE_PT_POINTS|BGFX_STATE_POINT_SIZE_MASK) & changedFlags) { - float pointSize = (float)( (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT); - DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_POINTSIZE, *( (DWORD*)&pointSize) ) ); + DX_CHECK(s_renderCtx.m_device->SetRenderState(D3DRS_POINTSIZE, castfi( (float)( (newFlags&BGFX_STATE_POINT_SIZE_MASK)>>BGFX_STATE_POINT_SIZE_SHIFT) ) ) ); } #if BX_PLATFORM_WINDOWS diff --git a/src/renderer_d3d9.h b/src/renderer_d3d9.h index 5f70fc4c8..9ba5d8eeb 100644 --- a/src/renderer_d3d9.h +++ b/src/renderer_d3d9.h @@ -90,15 +90,26 @@ namespace bgfx # define PIX_ENDEVENT() #endif // BGFX_CONFIG_DEBUG_PIX -#define DX_RELEASE(_ptr, _expected) \ - do { \ - if (NULL != _ptr) \ - { \ - ULONG count = _ptr->Release(); \ - BX_CHECK(_expected == count, "RefCount is %d (expected %d).", count, _expected); \ - _ptr = NULL; \ - } \ - } while (0) +#if BGFX_CONFIG_DEBUG +# define DX_RELEASE(_ptr, _expected) \ + do { \ + if (NULL != _ptr) \ + { \ + ULONG count = _ptr->Release(); \ + BX_CHECK(_expected == count, "RefCount is %d (expected %d).", count, _expected); \ + _ptr = NULL; \ + } \ + } while (0) +#else +# define DX_RELEASE(_ptr, _expected) \ + do { \ + if (NULL != _ptr) \ + { \ + _ptr->Release(); \ + _ptr = NULL; \ + } \ + } while (0) +#endif // BGFX_CONFIG_DEBUG struct Msaa {