Branimir Karadžić 7 lat temu
rodzic
commit
ee2fddfa07

+ 17 - 15
src/renderer_d3d.h

@@ -19,16 +19,18 @@
 #	define DX_CHECK_EXTRA_ARGS
 #	define DX_CHECK_EXTRA_ARGS
 #endif // BGFX_CONFIG_DEBUG && BGFX_CONFIG_RENDERER_DIRECT3D9
 #endif // BGFX_CONFIG_DEBUG && BGFX_CONFIG_RENDERER_DIRECT3D9
 
 
-#ifndef D3DCOLOR_ARGB
-#	define D3DCOLOR_ARGB(_a, _r, _g, _b) ( (DWORD)( ( ( (_a)&0xff)<<24)|( ( (_r)&0xff)<<16)|( ( (_g)&0xff)<<8)|( (_b)&0xff) ) )
-#endif // D3DCOLOR_ARGB
-
-#ifndef D3DCOLOR_RGBA
-#	define D3DCOLOR_RGBA(_r, _g, _b, _a) D3DCOLOR_ARGB(_a, _r, _g, _b)
-#endif // D3DCOLOR_RGBA
-
 namespace bgfx
 namespace bgfx
 {
 {
+	constexpr uint32_t toRgba8(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a)
+	{
+		return uint32_t(0
+			| ( (_r)<<24)
+			| ( (_g)<<16)
+			| ( (_b)<< 8)
+			| ( (_a)    )
+			);
+	}
+
 #if BX_PLATFORM_XBOXONE
 #if BX_PLATFORM_XBOXONE
 	typedef ::IGraphicsUnknown IUnknown;
 	typedef ::IGraphicsUnknown IUnknown;
 #else
 #else
@@ -101,13 +103,13 @@ namespace bgfx
 #	define PIX_ENDEVENT()
 #	define PIX_ENDEVENT()
 #endif // BGFX_CONFIG_DEBUG_PIX
 #endif // BGFX_CONFIG_DEBUG_PIX
 
 
-#define D3DCOLOR_FRAME   D3DCOLOR_RGBA(0xff, 0xd7, 0xc9, 0xff)
-#define D3DCOLOR_VIEW    D3DCOLOR_RGBA(0xe4, 0xb4, 0x8e, 0xff)
-#define D3DCOLOR_VIEW_L  D3DCOLOR_RGBA(0xf9, 0xee, 0xe5, 0xff)
-#define D3DCOLOR_VIEW_R  D3DCOLOR_RGBA(0xe8, 0xd3, 0xc0, 0xff)
-#define D3DCOLOR_DRAW    D3DCOLOR_RGBA(0xc6, 0xe5, 0xb9, 0xff)
-#define D3DCOLOR_COMPUTE D3DCOLOR_RGBA(0xa7, 0xdb, 0xd8, 0xff)
-#define D3DCOLOR_MARKER  D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff)
+#define D3DCOLOR_FRAME   toRgba8(0xff, 0xd7, 0xc9, 0xff)
+#define D3DCOLOR_VIEW    toRgba8(0xe4, 0xb4, 0x8e, 0xff)
+#define D3DCOLOR_VIEW_L  toRgba8(0xf9, 0xee, 0xe5, 0xff)
+#define D3DCOLOR_VIEW_R  toRgba8(0xe8, 0xd3, 0xc0, 0xff)
+#define D3DCOLOR_DRAW    toRgba8(0xc6, 0xe5, 0xb9, 0xff)
+#define D3DCOLOR_COMPUTE toRgba8(0xa7, 0xdb, 0xd8, 0xff)
+#define D3DCOLOR_MARKER  toRgba8(0xff, 0x00, 0x00, 0xff)
 
 
 	inline int getRefCount(IUnknown* _interface)
 	inline int getRefCount(IUnknown* _interface)
 	{
 	{

+ 1 - 1
src/renderer_d3d11.cpp

@@ -6439,7 +6439,7 @@ namespace bgfx { namespace d3d11
 
 
 				if (NULL != m_renderdocdll)
 				if (NULL != m_renderdocdll)
 				{
 				{
-					tvm.printf(tvm.m_width-27, 0, 0x1f, " [F11 - RenderDoc capture] ");
+					tvm.printf(tvm.m_width-27, 0, 0x4f, " [F11 - RenderDoc capture] ");
 				}
 				}
 
 
 				tvm.printf(10, pos++, 0x8b, "      Indices: %7d ", statsNumIndices);
 				tvm.printf(10, pos++, 0x8b, "      Indices: %7d ", statsNumIndices);

+ 1 - 1
src/renderer_d3d12.cpp

@@ -6657,7 +6657,7 @@ data.NumQualityLevels = 0;
 
 
 				if (NULL != m_renderdocdll)
 				if (NULL != m_renderdocdll)
 				{
 				{
-					tvm.printf(tvm.m_width-27, 0, 0x1f, " [F11 - RenderDoc capture] ");
+					tvm.printf(tvm.m_width-27, 0, 0x4f, " [F11 - RenderDoc capture] ");
 				}
 				}
 
 
 				tvm.printf(10, pos++, 0x8b, "      Indices: %7d ", statsNumIndices);
 				tvm.printf(10, pos++, 0x8b, "      Indices: %7d ", statsNumIndices);

+ 7 - 6
src/renderer_d3d9.cpp

@@ -1964,7 +1964,7 @@ namespace bgfx { namespace d3d9
 					}
 					}
 					else
 					else
 					{
 					{
-						color = D3DCOLOR_RGBA(_clear.m_index[0], _clear.m_index[1], _clear.m_index[2], _clear.m_index[3]);
+						color = toRgba8(_clear.m_index[0], _clear.m_index[1], _clear.m_index[2], _clear.m_index[3]);
 					}
 					}
 
 
 					flags |= D3DCLEAR_TARGET;
 					flags |= D3DCLEAR_TARGET;
@@ -4071,11 +4071,12 @@ namespace bgfx { namespace d3d9
 							&&  blendFactor != draw.m_rgba)
 							&&  blendFactor != draw.m_rgba)
 							{
 							{
 								const uint32_t rgba = draw.m_rgba;
 								const uint32_t rgba = draw.m_rgba;
-								D3DCOLOR color = D3DCOLOR_RGBA(rgba>>24
-															, (rgba>>16)&0xff
-															, (rgba>> 8)&0xff
-															, (rgba    )&0xff
-															);
+								D3DCOLOR color = toRgba8(
+									   rgba>>24
+									, (rgba>>16)&0xff
+									, (rgba>> 8)&0xff
+									, (rgba    )&0xff
+									);
 								DX_CHECK(device->SetRenderState(D3DRS_BLENDFACTOR, color) );
 								DX_CHECK(device->SetRenderState(D3DRS_BLENDFACTOR, color) );
 							}
 							}
 						}
 						}

+ 1 - 1
src/renderer_gl.cpp

@@ -7735,7 +7735,7 @@ namespace bgfx { namespace gl
 
 
 				if (NULL != m_renderdocdll)
 				if (NULL != m_renderdocdll)
 				{
 				{
-					tvm.printf(tvm.m_width-27, 0, 0x1f, " [F11 - RenderDoc capture] ");
+					tvm.printf(tvm.m_width-27, 0, 0x4f, " [F11 - RenderDoc capture] ");
 				}
 				}
 
 
 				tvm.printf(10, pos++, 0x8b, "      Indices: %7d ", statsNumIndices);
 				tvm.printf(10, pos++, 0x8b, "      Indices: %7d ", statsNumIndices);

+ 4 - 4
src/renderer_vk.cpp

@@ -4046,7 +4046,7 @@ BX_UNUSED(currentSamplerStateIdx);
 // 						wchar_t* viewNameW = s_viewNameW[view];
 // 						wchar_t* viewNameW = s_viewNameW[view];
 // 						viewNameW[3] = L' ';
 // 						viewNameW[3] = L' ';
 // 						PIX_ENDEVENT();
 // 						PIX_ENDEVENT();
-// 						PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+// 						PIX_BEGINEVENT(toRgba8(0xff, 0x00, 0x00, 0xff), viewNameW);
 					}
 					}
 
 
 					commandListChanged = true;
 					commandListChanged = true;
@@ -4406,7 +4406,7 @@ BX_UNUSED(presentMin, presentMax);
 
 
 		if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
 		if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
 		{
 		{
-//			PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
+//			PIX_BEGINEVENT(toRgba8(0x40, 0x40, 0x40, 0xff), L"debugstats");
 
 
 //			m_needPresent = true;
 //			m_needPresent = true;
 			TextVideoMem& tvm = m_textVideoMem;
 			TextVideoMem& tvm = m_textVideoMem;
@@ -4530,7 +4530,7 @@ BX_UNUSED(presentMin, presentMax);
 
 
  				if (NULL != m_renderdocdll)
  				if (NULL != m_renderdocdll)
  				{
  				{
- 					tvm.printf(tvm.m_width-27, 0, 0x1f, " [F11 - RenderDoc capture] ");
+ 					tvm.printf(tvm.m_width-27, 0, 0x4f, " [F11 - RenderDoc capture] ");
  				}
  				}
 
 
 				tvm.printf(10, pos++, 0x8b, "      Indices: %7d ", statsNumIndices);
 				tvm.printf(10, pos++, 0x8b, "      Indices: %7d ", statsNumIndices);
@@ -4570,7 +4570,7 @@ BX_UNUSED(presentMin, presentMax);
 		}
 		}
 		else if (_render->m_debug & BGFX_DEBUG_TEXT)
 		else if (_render->m_debug & BGFX_DEBUG_TEXT)
 		{
 		{
-//			PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
+//			PIX_BEGINEVENT(toRgba8(0x40, 0x40, 0x40, 0xff), L"debugtext");
 
 
 			blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
 			blit(this, _textVideoMemBlitter, _render->m_textVideoMem);