Branimir Karadžić 8 years ago
parent
commit
e67dcff430
4 changed files with 62 additions and 60 deletions
  1. 11 11
      src/renderer_d3d11.cpp
  2. 13 12
      src/renderer_d3d12.cpp
  3. 5 4
      src/renderer_d3d9.cpp
  4. 33 33
      src/renderer_vk.cpp

+ 11 - 11
src/renderer_d3d11.cpp

@@ -833,7 +833,7 @@ namespace bgfx { namespace d3d11
 
 			if (NULL == m_d3d11dll)
 			{
-				BX_TRACE("Failed to load d3d11.dll.");
+				BX_TRACE("Init error: Failed to load d3d11.dll.");
 				goto error;
 			}
 
@@ -862,14 +862,14 @@ namespace bgfx { namespace d3d11
 			D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)bx::dlsym(m_d3d11dll, "D3D11CreateDevice");
 			if (NULL == D3D11CreateDevice)
 			{
-				BX_TRACE("Function D3D11CreateDevice not found.");
+				BX_TRACE("Init error: Function D3D11CreateDevice not found.");
 				goto error;
 			}
 
 			m_dxgidll = bx::dlopen("dxgi.dll");
 			if (NULL == m_dxgidll)
 			{
-				BX_TRACE("Failed to load dxgi.dll.");
+				BX_TRACE("Init error: Failed to load dxgi.dll.");
 				goto error;
 			}
 
@@ -882,7 +882,7 @@ namespace bgfx { namespace d3d11
 			}
 			if (NULL == CreateDXGIFactory)
 			{
-				BX_TRACE("Function CreateDXGIFactory not found.");
+				BX_TRACE("Init error: Function CreateDXGIFactory not found.");
 				goto error;
 			}
 
@@ -917,7 +917,7 @@ namespace bgfx { namespace d3d11
 #endif // BX_PLATFORM_*
 			if (FAILED(hr) )
 			{
-				BX_TRACE("Unable to create DXGI factory.");
+				BX_TRACE("Init error: Unable to create DXGI factory.");
 				goto error;
 			}
 
@@ -1059,7 +1059,7 @@ namespace bgfx { namespace d3d11
 
 				if (FAILED(hr) )
 				{
-					BX_TRACE("Unable to create Direct3D11 device.");
+					BX_TRACE("Init error: Unable to create Direct3D11 device.");
 					goto error;
 				}
 
@@ -1074,7 +1074,7 @@ namespace bgfx { namespace d3d11
 
 				if (NULL == m_deviceCtx)
 				{
-					BX_TRACE("Unable to retrieve Direct3D11 ImmediateContext.");
+					BX_TRACE("Init error: Unable to retrieve Direct3D11 ImmediateContext.");
 					goto error;
 				}
 
@@ -1135,7 +1135,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 
 				if (FAILED(hr) )
 				{
-					BX_TRACE("Unable to create Direct3D11 device.");
+					BX_TRACE("Init error: Unable to create Direct3D11 device.");
 					goto error;
 				}
 
@@ -1174,7 +1174,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 					DX_RELEASE(adapter, 2);
 					if (FAILED(hr) )
 					{
-						BX_TRACE("Unable to create Direct3D11 device.");
+						BX_TRACE("Init error: Unable to create Direct3D11 device.");
 						goto error;
 					}
 
@@ -1234,7 +1234,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 					DX_RELEASE(adapter, 2);
 					if (FAILED(hr) )
 					{
-						BX_TRACE("Unable to create Direct3D11 device.");
+						BX_TRACE("Init error: Unable to create Direct3D11 device.");
 						goto error;
 					}
 
@@ -1263,7 +1263,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
 #endif // BX_PLATFORM_*
 					if (FAILED(hr) )
 					{
-						BX_TRACE("Failed to create swap chain.");
+						BX_TRACE("Init error: Failed to create swap chain.");
 						goto error;
 					}
 				}

+ 13 - 12
src/renderer_d3d12.cpp

@@ -550,25 +550,25 @@ namespace bgfx { namespace d3d12
 
 #if USE_D3D12_DYNAMIC_LIB
 			m_kernel32dll = bx::dlopen("kernel32.dll");
-			BX_WARN(NULL != m_kernel32dll, "Failed to load kernel32.dll.");
 			if (NULL == m_kernel32dll)
 			{
+				BX_TRACE("Init error: Failed to load kernel32.dll.");
 				goto error;
 			}
 
 			CreateEventExA = (PFN_CREATE_EVENT_EX_A)bx::dlsym(m_kernel32dll, "CreateEventExA");
-			BX_WARN(NULL != CreateEventExA, "Function CreateEventExA not found.");
 			if (NULL == CreateEventExA)
 			{
+				BX_TRACE("Init error: Function CreateEventExA not found.");
 				goto error;
 			}
 
 			errorState = ErrorState::LoadedKernel32;
 
 			m_d3d12dll = bx::dlopen("d3d12.dll");
-			BX_WARN(NULL != m_d3d12dll, "Failed to load d3d12.dll.");
 			if (NULL == m_d3d12dll)
 			{
+				BX_TRACE("Init error: Failed to load d3d12.dll.");
 				goto error;
 			}
 
@@ -587,22 +587,23 @@ namespace bgfx { namespace d3d12
 			||  NULL == D3D12GetDebugInterface
 			||  NULL == D3D12SerializeRootSignature)
 			{
+				BX_TRACE("Init error: Function not found.");
 				goto error;
 			}
 
 			m_dxgidll = bx::dlopen("dxgi.dll");
-			BX_WARN(NULL != m_dxgidll, "Failed to load dxgi.dll.");
 
 			if (NULL == m_dxgidll)
 			{
+				BX_TRACE("Init error: Failed to load dxgi.dll.");
 				goto error;
 			}
 
 			CreateDXGIFactory1 = (PFN_CREATE_DXGI_FACTORY)bx::dlsym(m_dxgidll, "CreateDXGIFactory1");
-			BX_WARN(NULL != CreateDXGIFactory1, "Function CreateDXGIFactory1 not found.");
 
 			if (NULL == CreateDXGIFactory1)
 			{
+				BX_TRACE("Init error: Function CreateDXGIFactory1 not found.");
 				goto error;
 			}
 #endif // USE_D3D12_DYNAMIC_LIB
@@ -617,10 +618,10 @@ namespace bgfx { namespace d3d12
 			hr = S_OK;
 			m_factory = NULL;
 #endif // BX_PLATFORM_*
-			BX_WARN(SUCCEEDED(hr), "Unable to create DXGI factory.");
 
 			if (FAILED(hr) )
 			{
+				BX_TRACE("Init error: Unable to create DXGI factory.");
 				goto error;
 			}
 
@@ -722,7 +723,7 @@ namespace bgfx { namespace d3d12
 
 			if (FAILED(hr) )
 			{
-				BX_TRACE("Unable to create Direct3D12 device.");
+				BX_TRACE("Init error: Unable to create Direct3D12 device.");
 				goto error;
 			}
 
@@ -787,7 +788,7 @@ namespace bgfx { namespace d3d12
 
 				if (FAILED(hr) )
 				{
-					BX_TRACE("Unable to query IDXGIDevice1 interface 0x%08x.", hr);
+					BX_TRACE("Init error: Unable to query IDXGIDevice1 interface 0x%08x.", hr);
 					goto error;
 				}
 
@@ -795,7 +796,7 @@ namespace bgfx { namespace d3d12
 
 				if (FAILED(hr) )
 				{
-					BX_TRACE("DXGIDevice1::GetAdapter failed 0x%08x.", hr);
+					BX_TRACE("Init error: DXGIDevice1::GetAdapter failed 0x%08x.", hr);
 					goto error;
 				}
 
@@ -803,7 +804,7 @@ namespace bgfx { namespace d3d12
 
 				if (FAILED(hr) )
 				{
-					BX_TRACE("IDXGIAdapter::GetParent failed 0x%08x.", hr);
+					BX_TRACE("Init error: IDXGIAdapter::GetParent failed 0x%08x.", hr);
 					goto error;
 				}
 			}
@@ -828,7 +829,7 @@ namespace bgfx { namespace d3d12
 				DX_RELEASE(m_adapter, 1);
 				if (FAILED(hr) )
 				{
-					BX_TRACE("Unable to create Direct3D11 device.");
+					BX_TRACE("Init error: Unable to create Direct3D11 device.");
 					goto error;
 				}
 
@@ -908,7 +909,7 @@ namespace bgfx { namespace d3d12
 #endif // BX_PLATFORM_*
 				if (FAILED(hr) )
 				{
-					BX_TRACE("Failed to create swap chain.");
+					BX_TRACE("Init error: Failed to create swap chain.");
 					goto error;
 				}
 			}

+ 5 - 4
src/renderer_d3d9.cpp

@@ -447,7 +447,7 @@ namespace bgfx { namespace d3d9
 
 			if (NULL == m_d3d9dll)
 			{
-				BX_TRACE("Failed to load d3d9.dll.");
+				BX_TRACE("Init error: Failed to load d3d9.dll.");
 				goto error;
 			}
 
@@ -495,7 +495,7 @@ namespace bgfx { namespace d3d9
 
 				if (NULL == Direct3DCreate9)
 				{
-					BX_TRACE("Function Direct3DCreate9 not found.");
+					BX_TRACE("Init error: Function Direct3DCreate9 not found.");
 					goto error;
 				}
 
@@ -505,7 +505,7 @@ namespace bgfx { namespace d3d9
 
 			if (NULL == m_d3d9)
 			{
-				BX_TRACE("Unable to create Direct3D.");
+				BX_TRACE("Init error: Unable to create Direct3D.");
 				goto error;
 			}
 
@@ -604,7 +604,7 @@ namespace bgfx { namespace d3d9
 
 			if (NULL == m_device)
 			{
-				BX_TRACE("Unable to create Direct3D9 device.");
+				BX_TRACE("Init error: Unable to create Direct3D9 device.");
 				goto error;
 			}
 
@@ -654,6 +654,7 @@ namespace bgfx { namespace d3d9
 			||   (D3DPTEXTURECAPS_ALPHA      & m_caps.TextureCaps) != D3DPTEXTURECAPS_ALPHA
 			||   !(m_caps.VertexShaderVersion >= D3DVS_VERSION(2, 0) && m_caps.PixelShaderVersion >= D3DPS_VERSION(2, 1) ) )
 			{
+				BX_TRACE("Init error: Min spec not satisfied.");
 				goto error;
 			}
 

+ 33 - 33
src/renderer_vk.cpp

@@ -747,7 +747,7 @@ VK_IMPORT_DEVICE
 
 			if (NULL == m_vulkan1dll)
 			{
-				BX_TRACE("Failed to load vulkan dynamic library.");
+				BX_TRACE("Init error: Failed to load vulkan dynamic library.");
 				goto error;
 			}
 
@@ -763,7 +763,7 @@ VK_IMPORT
 
 			if (!imported)
 			{
-				BX_TRACE("Failed to load shared library functions.");
+				BX_TRACE("Init error: Failed to load shared library functions.");
 				goto error;
 			}
 
@@ -831,7 +831,7 @@ VK_IMPORT
 
 			if (VK_SUCCESS != result)
 			{
-				BX_TRACE("vkCreateInstance failed %d: %s.", result, getName(result) );
+				BX_TRACE("Init error: vkCreateInstance failed %d: %s.", result, getName(result) );
 				goto error;
 			}
 
@@ -847,7 +847,7 @@ VK_IMPORT_INSTANCE
 
 			if (!imported)
 			{
-				BX_TRACE("Failed to load instance functions.");
+				BX_TRACE("Init error: Failed to load instance functions.");
 				goto error;
 			}
 
@@ -882,7 +882,7 @@ VK_IMPORT_INSTANCE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkEnumeratePhysicalDevices failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkEnumeratePhysicalDevices failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -895,7 +895,7 @@ VK_IMPORT_INSTANCE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkEnumeratePhysicalDevices failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkEnumeratePhysicalDevices failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1088,7 +1088,7 @@ VK_IMPORT_INSTANCE
 
 				if (UINT32_MAX == m_qfiGraphics)
 				{
-					BX_TRACE("Unable to find graphics queue.");
+					BX_TRACE("Init error: Unable to find graphics queue.");
 					goto error;
 				}
 			}
@@ -1147,7 +1147,7 @@ VK_IMPORT_INSTANCE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkCreateDevice failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreateDevice failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 			}
@@ -1164,7 +1164,7 @@ VK_IMPORT_DEVICE
 
 			if (!imported)
 			{
-				BX_TRACE("Failed to load device functions.");
+				BX_TRACE("Init error: Failed to load device functions.");
 				goto error;
 			}
 
@@ -1238,7 +1238,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkCreateRenderPass failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreateRenderPass failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 			}
@@ -1298,7 +1298,7 @@ VK_IMPORT_DEVICE
 
 			if (VK_SUCCESS != result)
 			{
-				BX_TRACE("vkCreateSurfaceKHR failed %d: %s.", result, getName(result) );
+				BX_TRACE("Init error: vkCreateSurfaceKHR failed %d: %s.", result, getName(result) );
 				goto error;
 			}
 
@@ -1310,7 +1310,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkGetPhysicalDeviceSurfaceSupportKHR failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkGetPhysicalDeviceSurfaceSupportKHR failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1319,7 +1319,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkGetPhysicalDeviceSurfaceCapabilitiesKHR failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1328,7 +1328,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkGetPhysicalDeviceSurfaceFormatsKHR failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkGetPhysicalDeviceSurfaceFormatsKHR failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1343,7 +1343,7 @@ VK_IMPORT_DEVICE
 				result = vkGetPhysicalDeviceSurfacePresentModesKHR(m_physicalDevice, m_surface, &numPresentModes, NULL);
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkGetPhysicalDeviceSurfacePresentModesKHR failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkGetPhysicalDeviceSurfacePresentModesKHR failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1377,7 +1377,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkCreateSwapchainKHR failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreateSwapchainKHR failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1386,13 +1386,13 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkGetSwapchainImagesKHR failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkGetSwapchainImagesKHR failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
 				if (numSwapchainImages < m_sci.minImageCount)
 				{
-					BX_TRACE("vkGetSwapchainImagesKHR: numSwapchainImages %d, minImageCount %d."
+					BX_TRACE("Init error: vkGetSwapchainImagesKHR: numSwapchainImages %d, minImageCount %d."
 						, numSwapchainImages
 						, m_sci.minImageCount
 						);
@@ -1404,7 +1404,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkGetSwapchainImagesKHR failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkGetSwapchainImagesKHR failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1439,7 +1439,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkCreateImage failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreateImage failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1461,7 +1461,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkAllocateMemory failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkAllocateMemory failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1469,7 +1469,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkBindImageMemory failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkBindImageMemory failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1496,7 +1496,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkCreateImageView failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreateImageView failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1544,7 +1544,7 @@ VK_IMPORT_DEVICE
 
 					if (VK_SUCCESS != result)
 					{
-						BX_TRACE("vkCreateImageView failed %d: %s.", result, getName(result) );
+						BX_TRACE("Init error: vkCreateImageView failed %d: %s.", result, getName(result) );
 						goto error;
 					}
 
@@ -1553,7 +1553,7 @@ VK_IMPORT_DEVICE
 
 					if (VK_SUCCESS != result)
 					{
-						BX_TRACE("vkCreateFramebuffer failed %d: %s.", result, getName(result) );
+						BX_TRACE("Init error: vkCreateFramebuffer failed %d: %s.", result, getName(result) );
 						goto error;
 					}
 
@@ -1561,7 +1561,7 @@ VK_IMPORT_DEVICE
 
 					if (VK_SUCCESS != result)
 					{
-						BX_TRACE("vkCreateSemaphore failed %d: %s.", result, getName(result) );
+						BX_TRACE("Init error: vkCreateSemaphore failed %d: %s.", result, getName(result) );
 						goto error;
 					}
 
@@ -1580,7 +1580,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkCreateFence failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreateFence failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1594,7 +1594,7 @@ VK_IMPORT_DEVICE
 				if (VK_SUCCESS != result)
 				{
 					vkDestroy(m_fence);
-					BX_TRACE("vkCreateCommandPool failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreateCommandPool failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1611,7 +1611,7 @@ VK_IMPORT_DEVICE
 				{
 					vkDestroy(m_commandPool);
 					vkDestroy(m_fence);
-					BX_TRACE("vkAllocateCommandBuffers failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkAllocateCommandBuffers failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1697,7 +1697,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkCreateDescriptorPool failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreateDescriptorPool failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1711,7 +1711,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkCreateDescriptorSetLayout failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreateDescriptorSetLayout failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1727,7 +1727,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkCreatePipelineLayout failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreatePipelineLayout failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 
@@ -1741,7 +1741,7 @@ VK_IMPORT_DEVICE
 
 				if (VK_SUCCESS != result)
 				{
-					BX_TRACE("vkCreatePipelineCache failed %d: %s.", result, getName(result) );
+					BX_TRACE("Init error: vkCreatePipelineCache failed %d: %s.", result, getName(result) );
 					goto error;
 				}
 			}