MCPcopy Create free account
hub / github.com/crosire/reshade / CreateCommandQueue

Method CreateCommandQueue

source/d3d12/d3d12_device.cpp:222–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220 return _orig->GetNodeCount();
221}
222HRESULT STDMETHODCALLTYPE D3D12Device::CreateCommandQueue(const D3D12_COMMAND_QUEUE_DESC *pDesc, REFIID riid, void **ppCommandQueue)
223{
224 reshade::log::message(
225 reshade::log::level::info,
226 "Redirecting ID3D12Device::CreateCommandQueue(this = %p, pDesc = %p, riid = %s, ppCommandQueue = %p) ...",
227 this, pDesc, reshade::log::iid_to_string(riid).c_str(), ppCommandQueue);
228
229 if (pDesc == nullptr)
230 return E_INVALIDARG;
231
232 reshade::log::message(reshade::log::level::info, "> Dumping command queue description:");
233 reshade::log::message(reshade::log::level::info, " +-----------------------------------------+-----------------------------------------+");
234 reshade::log::message(reshade::log::level::info, " | Parameter | Value |");
235 reshade::log::message(reshade::log::level::info, " +-----------------------------------------+-----------------------------------------+");
236 reshade::log::message(reshade::log::level::info, " | Type | %-39d |", static_cast<int>(pDesc->Type));
237 reshade::log::message(reshade::log::level::info, " | Priority | %-39d |", pDesc->Priority);
238 reshade::log::message(reshade::log::level::info, " | Flags | %-39x |", static_cast<unsigned int>(pDesc->Flags));
239 reshade::log::message(reshade::log::level::info, " | NodeMask | %-39x |", pDesc->NodeMask);
240 reshade::log::message(reshade::log::level::info, " +-----------------------------------------+-----------------------------------------+");
241
242 const HRESULT hr = _orig->CreateCommandQueue(pDesc, riid, ppCommandQueue);
243 if (SUCCEEDED(hr))
244 {
245 assert(ppCommandQueue != nullptr);
246
247 const auto command_queue_proxy = new D3D12CommandQueue(this, static_cast<ID3D12CommandQueue *>(*ppCommandQueue));
248
249 // Upgrade to the actual interface version requested here
250 if (command_queue_proxy->check_and_upgrade_interface(riid))
251 {
252#if RESHADE_VERBOSE_LOG
253 reshade::log::message(reshade::log::level::debug, "Returning ID3D12CommandQueue object %p (%p).", command_queue_proxy, command_queue_proxy->_orig);
254#endif
255 *ppCommandQueue = command_queue_proxy;
256 }
257 else // Do not hook object if we do not support the requested interface
258 {
259#if RESHADE_VERBOSE_LOG
260 reshade::log::message(reshade::log::level::warning, "Unknown interface %s in ID3D12Device::CreateCommandQueue.", reshade::log::iid_to_string(riid).c_str());
261#endif
262 delete command_queue_proxy; // Delete instead of release to keep reference count untouched
263 }
264 }
265#if RESHADE_VERBOSE_LOG
266 else
267 {
268 reshade::log::message(reshade::log::level::warning, "ID3D12Device::CreateCommandQueue failed with error code %s.", reshade::log::hr_to_string(hr).c_str());
269 }
270#endif
271
272 return hr;
273}
274HRESULT STDMETHODCALLTYPE D3D12Device::CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE type, REFIID riid, void **ppCommandAllocator)
275{
276 return _orig->CreateCommandAllocator(type, riid, ppCommandAllocator);

Callers 1

WinMainFunction · 0.80

Calls 4

messageFunction · 0.85
iid_to_stringFunction · 0.85
hr_to_stringFunction · 0.85

Tested by 1

WinMainFunction · 0.64