Browse Source

Fixed render debug events colors.

Branimir Karadžić 9 years ago
parent
commit
e0aeb630ad
5 changed files with 32 additions and 23 deletions
  1. 8 0
      src/renderer_d3d.h
  2. 13 9
      src/renderer_d3d11.cpp
  3. 4 4
      src/renderer_d3d12.cpp
  4. 5 5
      src/renderer_d3d9.cpp
  5. 2 5
      tools/texturev/texturev.cpp

+ 8 - 0
src/renderer_d3d.h

@@ -96,6 +96,14 @@ namespace bgfx
 #	define PIX_ENDEVENT()
 #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)
+
 	inline int getRefCount(IUnknown* _interface)
 	{
 		_interface->AddRef();

+ 13 - 9
src/renderer_d3d11.cpp

@@ -2032,7 +2032,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 				uint32_t size = _size*sizeof(wchar_t);
 				wchar_t* name = (wchar_t*)alloca(size);
 				mbstowcs(name, _marker, size-2);
-				PIX_SETMARKER(D3DCOLOR_RGBA(0xff, 0xff, 0xff, 0xff), name);
+				PIX_SETMARKER(D3DCOLOR_MARKER, name);
 			}
 		}
 
@@ -5146,7 +5146,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 			renderDocTriggerCapture();
 		}
 
-		PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
+		PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
 		BGFX_GPU_PROFILER_BEGIN_DYNAMIC("rendererSubmit");
 
 		ID3D11DeviceContext* deviceCtx = m_deviceCtx;
@@ -5297,7 +5297,11 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 							wchar_t* viewNameW = s_viewNameW[view];
 							viewNameW[3] = L' ';
 							viewNameW[4] = eye ? L'R' : L'L';
-							PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+							PIX_BEGINEVENT(0 == ( (view*2+eye)&1)
+								? D3DCOLOR_VIEW_L
+								: D3DCOLOR_VIEW_R
+								, viewNameW
+								);
 						}
 
 						if (m_ovr.isEnabled() )
@@ -5318,7 +5322,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 							wchar_t* viewNameW = s_viewNameW[view];
 							viewNameW[3] = L' ';
 							viewNameW[4] = L' ';
-							PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+							PIX_BEGINEVENT(D3DCOLOR_VIEW, viewNameW);
 						}
 					}
 
@@ -5429,7 +5433,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 							wchar_t* viewNameW = s_viewNameW[view];
 							viewNameW[3] = L'C';
 							PIX_ENDEVENT();
-							PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+							PIX_BEGINEVENT(D3DCOLOR_COMPUTE, viewNameW);
 						}
 
 						deviceCtx->IASetVertexBuffers(0, 2, s_zero.m_buffer, s_zero.m_zero, s_zero.m_zero);
@@ -5581,7 +5585,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 						wchar_t* viewNameW = s_viewNameW[view];
 						viewNameW[3] = L' ';
 						PIX_ENDEVENT();
-						PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+						PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
 					}
 
 					programIdx = invalidHandle;
@@ -6030,7 +6034,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 					wchar_t* viewNameW = s_viewNameW[view];
 					viewNameW[3] = L'C';
 					PIX_ENDEVENT();
-					PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+					PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
 				}
 
 				invalidateCompute();
@@ -6100,7 +6104,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 
 		if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
 		{
-			PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
+			PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
 
 			TextVideoMem& tvm = m_textVideoMem;
 
@@ -6234,7 +6238,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 		}
 		else if (_render->m_debug & BGFX_DEBUG_TEXT)
 		{
-			PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
+			PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
 
 			blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
 

+ 4 - 4
src/renderer_d3d12.cpp

@@ -4697,7 +4697,7 @@ data.NumQualityLevels = 0;
 
 	void RendererContextD3D12::submit(Frame* _render, ClearQuad& /*_clearQuad*/, TextVideoMemBlitter& _textVideoMemBlitter)
 	{
-//		PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
+//		PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
 
 		updateResolution(_render->m_resolution);
 
@@ -5133,7 +5133,7 @@ data.NumQualityLevels = 0;
 // 						wchar_t* viewNameW = s_viewNameW[view];
 // 						viewNameW[3] = L' ';
 // 						PIX_ENDEVENT();
-// 						PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
+// 						PIX_BEGINEVENT(D3DCOLOR_DRAW, viewNameW);
 					}
 
 					commandListChanged = true;
@@ -5433,7 +5433,7 @@ data.NumQualityLevels = 0;
 
 		if (_render->m_debug & (BGFX_DEBUG_IFH | BGFX_DEBUG_STATS) )
 		{
-//			PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
+//			PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
 
 			TextVideoMem& tvm = m_textVideoMem;
 
@@ -5599,7 +5599,7 @@ data.NumQualityLevels = 0;
 		}
 		else if (_render->m_debug & BGFX_DEBUG_TEXT)
 		{
-//			PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
+//			PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
 
 			blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
 

+ 5 - 5
src/renderer_d3d9.cpp

@@ -1191,7 +1191,7 @@ namespace bgfx { namespace d3d9
 			uint32_t size = _size*sizeof(wchar_t);
 			wchar_t* name = (wchar_t*)alloca(size);
 			mbstowcs(name, _marker, size-2);
-			PIX_SETMARKER(D3DCOLOR_RGBA(0xff, 0xff, 0xff, 0xff), name);
+			PIX_SETMARKER(D3DCOLOR_MARKER, name);
 #endif // BGFX_CONFIG_DEBUG_PIX
 			BX_UNUSED(_marker, _size);
 		}
@@ -3522,7 +3522,7 @@ namespace bgfx { namespace d3d9
 	{
 		IDirect3DDevice9* device = m_device;
 
-		PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), L"rendererSubmit");
+		PIX_BEGINEVENT(D3DCOLOR_FRAME, L"rendererSubmit");
 
 		updateResolution(_render->m_resolution);
 
@@ -3633,7 +3633,7 @@ namespace bgfx { namespace d3d9
 					currentState.m_stencil    = newStencil;
 
 					PIX_ENDEVENT();
-					PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), s_viewNameW[key.m_view]);
+					PIX_BEGINEVENT(D3DCOLOR_VIEW, s_viewNameW[key.m_view]);
 					if (item > 0)
 					{
 						BGFX_PROFILER_END();
@@ -4224,7 +4224,7 @@ namespace bgfx { namespace d3d9
 
 		if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
 		{
-			PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugstats");
+			PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugstats");
 
 			TextVideoMem& tvm = m_textVideoMem;
 
@@ -4314,7 +4314,7 @@ namespace bgfx { namespace d3d9
 		}
 		else if (_render->m_debug & BGFX_DEBUG_TEXT)
 		{
-			PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), L"debugtext");
+			PIX_BEGINEVENT(D3DCOLOR_FRAME, L"debugtext");
 
 			blit(this, _textVideoMemBlitter, _render->m_textVideoMem);
 

+ 2 - 5
tools/texturev/texturev.cpp

@@ -557,7 +557,7 @@ void associate()
 	bx::Error err;
 	if (bx::open(&writer, temp, false, &err) )
 	{
-		bx::write(&writer, str.c_str(), str.length(), &err);
+		bx::write(&writer, str.c_str(), uint32_t(str.length()), &err);
 		bx::close(&writer);
 
 		if (err.isOk() )
@@ -588,7 +588,7 @@ void associate()
 	bx::Error err;
 	if (bx::open(&writer, "/tmp/texturev.sh", false, &err) )
 	{
-		bx::write(&writer, str.c_str(), str.length(), &err);
+		bx::write(&writer, str.c_str(), uint32_t(str.length()), &err);
 		bx::close(&writer);
 
 		if (err.isOk() )
@@ -696,9 +696,6 @@ int _main_(int _argc, char** _argv)
 			, true
 			);
 
-	bgfx::destroyShader(vsTexture);
-	bgfx::destroyShader(fsTexture);
-
 	bgfx::ProgramHandle textureCubeProgram = bgfx::createProgram(
 			  bgfx::createShader(vs_texture_cube)
 			, bgfx::createShader(fs_texture_cube)