@@ -313,28 +313,32 @@ HRESULT STDMETHODCALLTYPE D3D12Device::CreateCommandList(UINT nodeMask, D3D12_CO
313313 {
314314 assert (ppCommandList != nullptr );
315315
316- const auto command_list_proxy = new D3D12GraphicsCommandList (this , static_cast <ID3D12GraphicsCommandList *>(*ppCommandList));
317-
318- // Upgrade to the actual interface version requested here (and only hook graphics command lists)
319- if (command_list_proxy->check_and_upgrade_interface (riid))
316+ // Ignore video command lists ('ID3D12VideoProcessCommandList', 'ID3D12VideoProcessCommandList', ...) in case they are created with the base 'ID3D12CommandList' interface
317+ if (type >= D3D12_COMMAND_LIST_TYPE_DIRECT && type <= D3D12_COMMAND_LIST_TYPE_COPY)
320318 {
321- *ppCommandList = command_list_proxy;
319+ const auto command_list_proxy = new D3D12GraphicsCommandList (this , static_cast <ID3D12GraphicsCommandList *>(*ppCommandList));
320+
321+ // Upgrade to the actual interface version requested here (and only hook graphics command lists)
322+ if (command_list_proxy->check_and_upgrade_interface (riid))
323+ {
324+ *ppCommandList = command_list_proxy;
322325
323326#if RESHADE_ADDON
324- // Same implementation as in 'D3D12GraphicsCommandList::Reset'
325- reshade::invoke_addon_event<reshade::addon_event::reset_command_list>(command_list_proxy);
327+ // Same implementation as in 'D3D12GraphicsCommandList::Reset'
328+ reshade::invoke_addon_event<reshade::addon_event::reset_command_list>(command_list_proxy);
326329#endif
327330
328331#if RESHADE_ADDON >= 2
329- if (pInitialState != nullptr )
330- reshade::invoke_addon_event<reshade::addon_event::bind_pipeline>(command_list_proxy, reshade::api::pipeline_stage::all, to_handle (pInitialState));
332+ if (pInitialState != nullptr )
333+ reshade::invoke_addon_event<reshade::addon_event::bind_pipeline>(command_list_proxy, reshade::api::pipeline_stage::all, to_handle (pInitialState));
331334#endif
332- }
333- else // Do not hook object if we do not support the requested interface
334- {
335- reshade::log::message (reshade::log::level::warning, " Unknown interface %s in ID3D12Device::CreateCommandList." , reshade::log::iid_to_string (riid).c_str ());
335+ }
336+ else // Do not hook object if we do not support the requested interface
337+ {
338+ reshade::log::message (reshade::log::level::warning, " Unknown interface %s in ID3D12Device::CreateCommandList." , reshade::log::iid_to_string (riid).c_str ());
336339
337- delete command_list_proxy; // Delete instead of release to keep reference count untouched
340+ delete command_list_proxy; // Delete instead of release to keep reference count untouched
341+ }
338342 }
339343 }
340344#if RESHADE_VERBOSE_LOG
@@ -1218,30 +1222,34 @@ HRESULT STDMETHODCALLTYPE D3D12Device::EnqueueMakeResident(D3D12_RESIDENCY_FLAGS
12181222 return static_cast <ID3D12Device3 *>(_orig)->EnqueueMakeResident (Flags, NumObjects, ppObjects, pFenceToSignal, FenceValueToSignal);
12191223}
12201224
1221- HRESULT STDMETHODCALLTYPE D3D12Device::CreateCommandList1 (UINT NodeMask , D3D12_COMMAND_LIST_TYPE Type , D3D12_COMMAND_LIST_FLAGS Flags , REFIID riid, void **ppCommandList)
1225+ HRESULT STDMETHODCALLTYPE D3D12Device::CreateCommandList1 (UINT nodeMask , D3D12_COMMAND_LIST_TYPE type , D3D12_COMMAND_LIST_FLAGS flags , REFIID riid, void **ppCommandList)
12221226{
12231227 assert (_interface_version >= 4 );
1224- const HRESULT hr = static_cast <ID3D12Device4 *>(_orig)->CreateCommandList1 (NodeMask, Type, Flags , riid, ppCommandList);
1228+ const HRESULT hr = static_cast <ID3D12Device4 *>(_orig)->CreateCommandList1 (nodeMask, type, flags , riid, ppCommandList);
12251229 if (SUCCEEDED (hr))
12261230 {
12271231 assert (ppCommandList != nullptr );
12281232
1229- const auto command_list_proxy = new D3D12GraphicsCommandList (this , static_cast <ID3D12GraphicsCommandList *>(*ppCommandList));
1230-
1231- // Upgrade to the actual interface version requested here (and only hook graphics command lists)
1232- if (command_list_proxy->check_and_upgrade_interface (riid))
1233+ // Ignore video command lists ('ID3D12VideoProcessCommandList', 'ID3D12VideoProcessCommandList', ...) in case they are created with the base 'ID3D12CommandList' interface
1234+ if (type >= D3D12_COMMAND_LIST_TYPE_DIRECT && type <= D3D12_COMMAND_LIST_TYPE_COPY)
12331235 {
1234- *ppCommandList = command_list_proxy;
1236+ const auto command_list_proxy = new D3D12GraphicsCommandList (this , static_cast <ID3D12GraphicsCommandList *>(*ppCommandList));
1237+
1238+ // Upgrade to the actual interface version requested here (and only hook graphics command lists)
1239+ if (command_list_proxy->check_and_upgrade_interface (riid))
1240+ {
1241+ *ppCommandList = command_list_proxy;
12351242
12361243#if RESHADE_ADDON
1237- reshade::invoke_addon_event<reshade::addon_event::reset_command_list>(command_list_proxy);
1244+ reshade::invoke_addon_event<reshade::addon_event::reset_command_list>(command_list_proxy);
12381245#endif
1239- }
1240- else // Do not hook object if we do not support the requested interface or this is a compute command list
1241- {
1242- reshade::log::message (reshade::log::level::warning, " Unknown interface %s in ID3D12Device4::CreateCommandList1." , reshade::log::iid_to_string (riid).c_str ());
1246+ }
1247+ else // Do not hook object if we do not support the requested interface or this is a compute command list
1248+ {
1249+ reshade::log::message (reshade::log::level::warning, " Unknown interface %s in ID3D12Device4::CreateCommandList1." , reshade::log::iid_to_string (riid).c_str ());
12431250
1244- delete command_list_proxy; // Delete instead of release to keep reference count untouched
1251+ delete command_list_proxy; // Delete instead of release to keep reference count untouched
1252+ }
12451253 }
12461254 }
12471255#if RESHADE_VERBOSE_LOG
0 commit comments