@@ -8328,38 +8328,38 @@ static bool D3D12_PrepareDriver(SDL_VideoDevice *_this)
8328
8328
}
8329
8329
8330
8330
#if !(defined(SDL_PLATFORM_XBOXONE ) || defined(SDL_PLATFORM_XBOXSERIES )) && defined(HAVE_IDXGIINFOQUEUE )
8331
- static void D3D12_INTERNAL_TryInitializeDXGIDebug (D3D12Renderer * renderer )
8331
+ static bool D3D12_INTERNAL_TryInitializeDXGIDebug (D3D12Renderer * renderer )
8332
8332
{
8333
8333
PFN_DXGI_GET_DEBUG_INTERFACE DXGIGetDebugInterfaceFunc ;
8334
8334
HRESULT res ;
8335
8335
8336
8336
renderer -> dxgidebug_dll = SDL_LoadObject (DXGIDEBUG_DLL );
8337
8337
if (renderer -> dxgidebug_dll == NULL ) {
8338
- SDL_LogWarn (SDL_LOG_CATEGORY_GPU , "Could not find " DXGIDEBUG_DLL );
8339
- return ;
8338
+ return false;
8340
8339
}
8341
8340
8342
8341
DXGIGetDebugInterfaceFunc = (PFN_DXGI_GET_DEBUG_INTERFACE )SDL_LoadFunction (
8343
8342
renderer -> dxgidebug_dll ,
8344
8343
DXGI_GET_DEBUG_INTERFACE_FUNC );
8345
8344
if (DXGIGetDebugInterfaceFunc == NULL ) {
8346
- SDL_LogWarn (SDL_LOG_CATEGORY_GPU , "Could not load function: " DXGI_GET_DEBUG_INTERFACE_FUNC );
8347
- return ;
8345
+ return false;
8348
8346
}
8349
8347
8350
8348
res = DXGIGetDebugInterfaceFunc (& D3D_IID_IDXGIDebug , (void * * )& renderer -> dxgiDebug );
8351
8349
if (FAILED (res )) {
8352
- SDL_LogWarn ( SDL_LOG_CATEGORY_GPU , "Could not get IDXGIDebug interface" ) ;
8350
+ return false ;
8353
8351
}
8354
8352
8355
8353
res = DXGIGetDebugInterfaceFunc (& D3D_IID_IDXGIInfoQueue , (void * * )& renderer -> dxgiInfoQueue );
8356
8354
if (FAILED (res )) {
8357
- SDL_LogWarn ( SDL_LOG_CATEGORY_GPU , "Could not get IDXGIInfoQueue interface" ) ;
8355
+ return false ;
8358
8356
}
8357
+
8358
+ return true;
8359
8359
}
8360
8360
#endif
8361
8361
8362
- static void D3D12_INTERNAL_TryInitializeD3D12Debug (D3D12Renderer * renderer )
8362
+ static bool D3D12_INTERNAL_TryInitializeD3D12Debug (D3D12Renderer * renderer )
8363
8363
{
8364
8364
PFN_D3D12_GET_DEBUG_INTERFACE D3D12GetDebugInterfaceFunc ;
8365
8365
HRESULT res ;
@@ -8368,21 +8368,20 @@ static void D3D12_INTERNAL_TryInitializeD3D12Debug(D3D12Renderer *renderer)
8368
8368
renderer -> d3d12_dll ,
8369
8369
D3D12_GET_DEBUG_INTERFACE_FUNC );
8370
8370
if (D3D12GetDebugInterfaceFunc == NULL ) {
8371
- SDL_LogWarn (SDL_LOG_CATEGORY_GPU , "Could not load function: " D3D12_GET_DEBUG_INTERFACE_FUNC );
8372
- return ;
8371
+ return false;
8373
8372
}
8374
8373
8375
8374
res = D3D12GetDebugInterfaceFunc (D3D_GUID (D3D_IID_ID3D12Debug ), (void * * )& renderer -> d3d12Debug );
8376
8375
if (FAILED (res )) {
8377
- SDL_LogWarn (SDL_LOG_CATEGORY_GPU , "Could not get ID3D12Debug interface" );
8378
- return ;
8376
+ return false;
8379
8377
}
8380
8378
8381
8379
ID3D12Debug_EnableDebugLayer (renderer -> d3d12Debug );
8380
+ return true;
8382
8381
}
8383
8382
8384
8383
#if !(defined(SDL_PLATFORM_XBOXONE ) || defined(SDL_PLATFORM_XBOXSERIES ))
8385
- static bool D3D12_INTERNAL_TryInitializeD3D12DebugInfoQueue (D3D12Renderer * renderer )
8384
+ static void D3D12_INTERNAL_TryInitializeD3D12DebugInfoQueue (D3D12Renderer * renderer )
8386
8385
{
8387
8386
ID3D12InfoQueue * infoQueue = NULL ;
8388
8387
D3D12_MESSAGE_SEVERITY severities [] = { D3D12_MESSAGE_SEVERITY_INFO };
@@ -8394,7 +8393,7 @@ static bool D3D12_INTERNAL_TryInitializeD3D12DebugInfoQueue(D3D12Renderer *rende
8394
8393
D3D_GUID (D3D_IID_ID3D12InfoQueue ),
8395
8394
(void * * )& infoQueue );
8396
8395
if (FAILED (res )) {
8397
- CHECK_D3D12_ERROR_AND_RETURN ( "Failed to convert ID3D12Device to ID3D12InfoQueue" , false) ;
8396
+ return ;
8398
8397
}
8399
8398
8400
8399
SDL_zero (filter );
@@ -8410,8 +8409,6 @@ static bool D3D12_INTERNAL_TryInitializeD3D12DebugInfoQueue(D3D12Renderer *rende
8410
8409
true);
8411
8410
8412
8411
ID3D12InfoQueue_Release (infoQueue );
8413
-
8414
- return true;
8415
8412
}
8416
8413
8417
8414
static void WINAPI D3D12_INTERNAL_OnD3D12DebugInfoMsg (
@@ -8565,9 +8562,12 @@ static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SD
8565
8562
8566
8563
#ifdef HAVE_IDXGIINFOQUEUE
8567
8564
// Initialize the DXGI debug layer, if applicable
8565
+ bool hasDxgiDebug = false;
8568
8566
if (debugMode ) {
8569
- D3D12_INTERNAL_TryInitializeDXGIDebug (renderer );
8567
+ hasDxgiDebug = D3D12_INTERNAL_TryInitializeDXGIDebug (renderer );
8570
8568
}
8569
+ #else
8570
+ bool hasDxgiDebug = true;
8571
8571
#endif
8572
8572
8573
8573
// Load the CreateDXGIFactory1 function
@@ -8724,7 +8724,20 @@ static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SD
8724
8724
8725
8725
// Initialize the D3D12 debug layer, if applicable
8726
8726
if (debugMode ) {
8727
- D3D12_INTERNAL_TryInitializeD3D12Debug (renderer );
8727
+ bool hasD3d12Debug = D3D12_INTERNAL_TryInitializeD3D12Debug (renderer );
8728
+ if (hasDxgiDebug && hasD3d12Debug ) {
8729
+ SDL_LogInfo (
8730
+ SDL_LOG_CATEGORY_GPU ,
8731
+ "Validation layers enabled, expect debug level performance!" );
8732
+ } else if (hasDxgiDebug || hasD3d12Debug ) {
8733
+ SDL_LogWarn (
8734
+ SDL_LOG_CATEGORY_GPU ,
8735
+ "Validation layers partially enabled, some warnings may not be available" );
8736
+ } else {
8737
+ SDL_LogWarn (
8738
+ SDL_LOG_CATEGORY_GPU ,
8739
+ "Validation layers not found, continuing without validation" );
8740
+ }
8728
8741
}
8729
8742
8730
8743
// Create the D3D12Device
@@ -8771,9 +8784,7 @@ static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SD
8771
8784
8772
8785
// Initialize the D3D12 debug info queue, if applicable
8773
8786
if (debugMode ) {
8774
- if (!D3D12_INTERNAL_TryInitializeD3D12DebugInfoQueue (renderer )) {
8775
- return NULL ;
8776
- }
8787
+ D3D12_INTERNAL_TryInitializeD3D12DebugInfoQueue (renderer );
8777
8788
D3D12_INTERNAL_TryInitializeD3D12DebugInfoLogger (renderer );
8778
8789
}
8779
8790
#endif
0 commit comments