Sfoglia il codice sorgente

Fixed MinGW compile errors.

bkaradzic 13 anni fa
parent
commit
8bac68fe7f
4 ha cambiato i file con 31 aggiunte e 14 eliminazioni
  1. 1 1
      premake/bgfx.lua
  2. 7 0
      src/bgfx_p.h
  3. 3 4
      src/renderer_d3d9.cpp
  4. 20 9
      src/renderer_d3d9.h

+ 1 - 1
premake/bgfx.lua

@@ -8,7 +8,7 @@ project "bgfx"
 	}
 
 	buildoptions {
-		"-Wall",
+--		"-Wall",
 	}
 
 	defines {

+ 7 - 0
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

+ 3 - 4
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

+ 20 - 9
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
 	{