{"id":11107,"date":"2025-01-27T14:29:19","date_gmt":"2025-01-27T22:29:19","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/directx\/?p=11107"},"modified":"2025-09-25T10:17:34","modified_gmt":"2025-09-25T17:17:34","slug":"agility-sdk-1-716-0-preview-application-specific-driver-state","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/directx\/agility-sdk-1-716-0-preview-application-specific-driver-state\/","title":{"rendered":"Agility SDK 1.716.0-preview: Application Specific Driver State"},"content":{"rendered":"<p><strong>UPDATE 9\/25\/25: This feature is now supported in retail as of the <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.Direct3D.D3D12\/1.618.1\">1.618 Agility SDK<\/a>.<\/strong><\/p>\n<p>Today we\u2019re excited to announce the release of a new D3D12 feature: Application Specific Driver State. This feature is intended to be used by capture\/replay tools, such as PIX on Windows, to help with issues caused by \u201capp detect\u201d behavior.<\/p>\n<h2>Background<\/h2>\n<p>D3D12 drivers occasionally have to perform workarounds for bugs in specific applications. For example, this may occur if an older game shipped with a bug that only affects a new generation of GPUs. The driver may be forced to detect when the application is running and then perform an application-specific workaround for the bug. This behavior is often called &#8220;app detect&#8221;.<\/p>\n<p>This &#8220;app detect&#8221; behavior causes problems for capture\/replay tools like PIX on Windows. For example, if PIX is capturing an application that is subject to &#8220;app detect&#8221; driver changes, then the application will work at capture time but PIX may hit errors when it tries to replay the captured GPU workload in a separate PIX process.<\/p>\n<h2>Application Specific Driver State<\/h2>\n<p>This preview adds a new D3D12 functionality that allows capture\/replay tools, like PIX, to capture any active application specific workarounds, store them in the capture file, and then tell the driver to set them at replay time.<\/p>\n<h4>Sample Code : Capture<\/h4>\n<pre class=\"prettyprint language-cpp\"><code class=\"language-cpp\">#include &lt;wrl\/client.h&gt;\r\nusing namespace Microsoft::WRL;\r\n\r\n\/\/ Special GUID that's dedicated to retrieve application specific driver state\r\nstatic constexpr GUID GUID_MetaCommand_GetApplicationSpecificDriverState = \r\n{ 0xa6b7c5b7, 0x9ec2, 0x4613, { 0xb4, 0x4b, 0x0, 0x21, 0x27, 0xeb, 0xa2, 0x7d } };\r\n\r\n\/\/ This struct is expected when executing Application Specific Driver State metacommand\r\n\/\/ Note: This is subject to change as the feature makes it towards non-preview release\r\nstruct ApplicationSpecificDriverStateMetaCommandParameters\r\n{\r\n    UINT* pBlobSize;\r\n    void* pApplicationSpecificDriverStateBlob;\r\n};\r\n...\r\n\r\nComPtr&lt;ID3D12Device5&gt; device;\r\nComPtr&lt;ID3DBlob&gt; asdsBlob;\r\nComPtr&lt;ID3D12GraphicsCommandList&gt; cl;\r\n...\r\n\r\n\/\/ Query ID3D12DeviceTools1. Succeeds if the runtime supports the feature \r\nComPtr&lt;ID3D12DeviceTools1&gt; deviceTools1;\r\nif (SUCCEEDED(device-&gt;QueryInterface(IID_PPV_ARGS(&amp;deviceTools1)))) \r\n{ \r\n    \/\/ Check feature support for Application Specific Driver State\r\n    D3D12_FEATURE_DATA_APPLICATION_SPECIFIC_DRIVER_STATE featureDataASDS{};\r\n    if (SUCCEEDED(device-&gt;CheckFeatureSupport(D3D12_FEATURE_APPLICATION_SPECIFIC_DRIVER_STATE, &amp;featureDataASDS, sizeof(featureDataASDS))) &amp;&amp; featureDataASDS.Supported)\r\n    {\r\n        \/\/ Get application-specific driver state blob\r\n        deviceTools1-&gt;GetApplicationSpecificDriverState(&amp;asdsBlob);\r\n    } \r\n}\r\nelse\r\n{   \/\/ Runtime does not support the feature\r\n    \/\/ Use Metacommand to retrieve Application Specific Driver State\r\n    ComPtr&lt;ID3D12MetaCommand&gt; metaCommand;\r\n    \r\n    \/\/ Check if the device supports GUID_MetaCommand_GetApplicationSpecificDriverState\r\n    if (IsMetaCommandAvailable(GUID_MetaCommand_GetApplicationSpecificDriverState, device.Get()))\r\n    {\r\n        device-&gt;CreateMetaCommand(GUID_MetaCommand_GetApplicationSpecificDriverState, 0, nullptr, 0, IID_PPV_ARGS(&amp;metaCommand));\r\n\r\n        UINT asdsBlobSize = 0u;\r\n        ApplicationSpecificDriverStateMetaCommandParameters asdsBlobInfo{ &amp;asdsBlobSize, nullptr };\r\n        \r\n        \/\/ Get application specific driver state blob size\r\n        \/\/ Driver writes actual blob size to pBlobSize if *pBlobSize is smaller than required size\r\n        cl-&gt;ExecuteMetaCommand(metaCommand.Get(), &amp;asdsBlobInfo, sizeof(asdsBlobInfo));\r\n        \r\n        \/\/ Allocate memory for the blob and update pApplicationSpecificDriverStateBlob\r\n        ...\r\n        \r\n        \/\/ ExecuteMetaCommand again, now with &gt;= required size\r\n        \/\/ Driver writes application specific driver state blob to pApplicationSpecificDriverStateBlob\r\n        cl-&gt;ExecuteMetaCommand(metaCommand.Get(), &amp;asdsBlobInfo, sizeof(asdsBlobInfo));\r\n    }\r\n}<\/code><\/pre>\n<h4>Sample Code : Replay<\/h4>\n<pre class=\"prettyprint language-cpp\"><code class=\"language-cpp\">#include &lt;wrl\/client.h&gt;\r\nusing namespace Microsoft::WRL;\r\n\r\nComPtr&lt;ID3D12Tools&gt; pD3D12Tools;\r\nD3D12GetDebugInterface(IID_PPV_ARGS(&amp;pD3D12Tools));\r\n\r\n\/\/ This means that the runtime does not support application specific driver state\r\nComPtr&lt;ID3D12Tools2&gt; pD3D12Tools2;\r\nif (FAILED(pD3D12Tools-&gt;QueryInterface(IID_PPV_ARGS(&amp;pD3D12Tools2))))\r\n{\r\n    return;\r\n}\r\n\r\n\/\/ SetApplicationSpecificDriverState\r\nThrowFailure(pD3D12Tools2-&gt;SetApplicationSpecificDriverState(adapter.Get(), capturedASDSBlob.Get()));\r\n\r\n\/\/ Create D3D12 Device\r\n...\r\n\r\n\/\/ Check if the driver supports the feature\r\nD3D12_FEATURE_DATA_APPLICATION_SPECIFIC_DRIVER_STATE featureDataASDS{};\r\nif (FAILED(device-&gt;CheckFeatureSupport(D3D12_FEATURE_APPLICATION_SPECIFIC_DRIVER_STATE, &amp;featureDataASDS, sizeof(featureDataASDS)))\r\n    || !featureDataASDS.Supported)\r\n{\r\n    return;\r\n}\r\n\r\n\/\/ Status of whether the driver used set app-specific driver state blob\r\nD3D12_APPLICATION_SPECIFIC_DRIVER_BLOB_STATUS setBlobStatus = deviceTools1-&gt;GetApplicationSpecificDriverBlobStatus();\r\n\r\n...\r\n\r\n\/\/ If set blob status is IGNORED or UNKNOWN, check if it's due to difference in identifiers\r\nD3D12_DRIVER_MATCHING_IDENTIFIER_STATUS status = device-&gt;CheckDriverMatchingIdentifier(D3D12_SERIALIZED_DATA_APPLICATION_SPECIFIC_DRIVER_STATE, pIdentifier);\r\n<\/code><\/pre>\n<h2>Words from our Partners:<\/h2>\n<p><strong>AMD:<\/strong><\/p>\n<p><em>\u201cAMD driver support for Application Specific Driver State can be found in the following driver: <a href=\"https:\/\/www.amd.com\/en\/resources\/support-articles\/release-notes\/RN-RAD-WIN-25-9-1.html\">Adrenalin 25.9.1<\/a>.\u201d<\/em><\/p>\n<p><strong>Intel:<\/strong><\/p>\n<p><em>&#8220;<span style=\"font-family: georgia, palatino, serif; font-size: 12pt;\">We are excited to support these improvements in current drivers available\u00a0<a href=\"https:\/\/www.intel.com\/content\/www\/us\/en\/download\/785597\/intel-arc-graphics-windows.html\"><span style=\"background: white;\">here<\/span><\/a>.<\/span>&#8220;<\/em><\/p>\n<p><strong>Nvidia:<\/strong><\/p>\n<p><em>\u201cNVIDIA will fully support this SDK release, please contact your developer relations representative for specifics.\u201d<\/em><\/p>\n<p><strong>Qualcomm:<\/strong><\/p>\n<p><em>&#8220;Feature support is planned and to be available at a future date&#8221;<\/em><\/p>\n<h2>PIX support<\/h2>\n<p>As usual, PIX has day one support for Application Specific Driver State. Please see <a href=\"https:\/\/devblogs.microsoft.com\/pix\/pix-2501-30-preview\/\">this blog post<\/a> for more information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UPDATE 9\/25\/25: This feature is now supported in retail as of the 1.618 Agility SDK. Today we\u2019re excited to announce the release of a new D3D12 feature: Application Specific Driver State. This feature is intended to be used by capture\/replay tools, such as PIX on Windows, to help with issues caused by \u201capp detect\u201d behavior. [&hellip;]<\/p>\n","protected":false},"author":51202,"featured_media":12651,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-11107","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-directx"],"acf":[],"blog_post_summary":"<p>UPDATE 9\/25\/25: This feature is now supported in retail as of the 1.618 Agility SDK. Today we\u2019re excited to announce the release of a new D3D12 feature: Application Specific Driver State. This feature is intended to be used by capture\/replay tools, such as PIX on Windows, to help with issues caused by \u201capp detect\u201d behavior. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/posts\/11107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/users\/51202"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/comments?post=11107"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/posts\/11107\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/media\/12651"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/media?parent=11107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/categories?post=11107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/directx\/wp-json\/wp\/v2\/tags?post=11107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}