Last active
May 1, 2022 21:39
-
-
Save kch86/e96a22ae97fd7c17a68d7a03c3c7ae87 to your computer and use it in GitHub Desktop.
d3d11 debug layer and windows 10 graphics tool install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. windows update | |
1a. Right click on the windows icon in the task bar, select Settings, select Apps, and then click Manage optional features. | |
1b. Click Add a feature | |
1c. In the Optional features list, select Graphics Tools and then click Install. | |
2. that doesn't work, here's the hail mary: | |
* Run regedit.exe | |
* Navigate to folder HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU\ | |
* Double click on entry UseWUServer, change the value to 0, click OK | |
* Reboot | |
* Go to Optional Features (See 1.a), and install "Graphics Tools" | |
* Run regedit.exe and change UseWUServer back to 1 | |
* Reboot | |
Once the debug tools are installed. Then you need to create the device with D3D11_CREATE_DEVICE_DEBUG. Once that is done then see the below snippet for interacting with the debug layer: | |
ID3D11Debug* d3dDebug = NULL; | |
ID3D11InfoQueue* infoQueue = NULL; | |
if( SUCCEEDED( d3dDevice->QueryInterface( __uuidof(ID3D11Debug), (void**)&d3dDebug ) ) ) | |
{ | |
if( SUCCEEDED( d3dDebug->QueryInterface( __uuidof(ID3D11InfoQueue), (void**)&infoQueue ) ) ) | |
{ | |
bool isD3D11_1_Supported = (d3dDevice->GetFeatureLevel() >= FEATURE_LEVEL_D3D11_1); | |
D3D11_MESSAGE_ID filterListIds[] = | |
{ | |
D3D11_MESSAGE_ID_UPDATESUBRESOURCE_PREFERUPDATESUBRESOURCE1 | |
}; | |
int numFilterListIds = sizeof( filterListIds ) / sizeof( D3D11_MESSAGE_ID ); | |
D3D11_MESSAGE_ID* deniedIds = isD3D11_1_Supported ? NULL : filterListIds; | |
int numDeniedIds = isD3D11_1_Supported ? 0 : numFilterListIds; | |
static D3D11_INFO_QUEUE_FILTER filter; | |
memset( &filter, 0, sizeof(filter) ); | |
filter.DenyList.NumIDs = numDeniedIds; | |
filter.DenyList.pIDList = deniedIds; | |
// setup both storage and retrieval filters. The storage filter doesn't seem to entirely work. | |
infoQueue->AddStorageFilterEntries( &filter ); | |
infoQueue->AddRetrievalFilterEntries( &filter ); | |
// Only enable debug breaks in debug builds | |
if( IsDebuggerPresent() ) | |
{ | |
infoQueue->SetBreakOnSeverity( D3D11_MESSAGE_SEVERITY_INFO, FALSE ); | |
for(int i = D3D11_MESSAGE_ID_UNKNOWN + 1; i < D3D11_MESSAGE_ID_D3D10_MESSAGES_END; i++ ) | |
{ | |
infoQueue->SetBreakOnID( (D3D11_MESSAGE_ID)i, TRUE ); | |
} | |
for(int i = D3D11_MESSAGE_ID_D3D10L9_MESSAGES_START + 1; i < D3D11_MESSAGE_ID_D3D10L9_MESSAGES_END; i++ ) | |
{ | |
infoQueue->SetBreakOnID( (D3D11_MESSAGE_ID)i, TRUE ); | |
} | |
for(int i = D3D11_MESSAGE_ID_D3D11_MESSAGES_START + 1; i < D3D11_MESSAGE_ID_D3D11_MESSAGES_END; i++ ) | |
{ | |
infoQueue->SetBreakOnID( (D3D11_MESSAGE_ID)i, TRUE ); | |
} | |
for(int i = D3D11_MESSAGE_ID_D3D11_1_MESSAGES_START + 1; i < D3D11_MESSAGE_ID_D3D11_1_MESSAGES_END; i++ ) | |
{ | |
infoQueue->SetBreakOnID( (D3D11_MESSAGE_ID)i, TRUE ); | |
} | |
for( int i = 0; i < numDeniedIds; i++ ) | |
{ | |
infoQueue->SetBreakOnID( deniedIds[i], FALSE ); | |
} | |
} | |
} | |
d3dDebug->Release(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment