mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
VideoBackends/D3D12: Include HRESULT in error messages
This commit is contained in:
@ -152,7 +152,7 @@ bool DXContext::CreateDevice(u32 adapter_index, bool enable_debug_layer)
|
||||
HRESULT hr = m_dxgi_factory->EnumAdapters(adapter_index, &adapter);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERROR_LOG_FMT(VIDEO, "Adapter {} not found, using default", adapter_index);
|
||||
ERROR_LOG_FMT(VIDEO, "Adapter {} not found, using default: {}", adapter_index, DX12HRWrap(hr));
|
||||
adapter = nullptr;
|
||||
}
|
||||
|
||||
@ -166,14 +166,14 @@ bool DXContext::CreateDevice(u32 adapter_index, bool enable_debug_layer)
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_LOG_FMT(VIDEO, "Debug layer requested but not available.");
|
||||
ERROR_LOG_FMT(VIDEO, "Debug layer requested but not available: {}", DX12HRWrap(hr));
|
||||
enable_debug_layer = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the actual device.
|
||||
hr = s_d3d12_create_device(adapter.Get(), D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device));
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create D3D12 device");
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create D3D12 device: {}", DX12HRWrap(hr));
|
||||
if (FAILED(hr))
|
||||
return false;
|
||||
|
||||
@ -208,7 +208,7 @@ bool DXContext::CreateCommandQueue()
|
||||
D3D12_COMMAND_QUEUE_PRIORITY_NORMAL,
|
||||
D3D12_COMMAND_QUEUE_FLAG_NONE};
|
||||
HRESULT hr = m_device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&m_command_queue));
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create command queue");
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create command queue: {}", DX12HRWrap(hr));
|
||||
return SUCCEEDED(hr);
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ bool DXContext::CreateFence()
|
||||
{
|
||||
HRESULT hr =
|
||||
m_device->CreateFence(m_completed_fence_value, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&m_fence));
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create fence");
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create fence: {}", DX12HRWrap(hr));
|
||||
if (FAILED(hr))
|
||||
return false;
|
||||
|
||||
@ -303,14 +303,15 @@ static bool BuildRootSignature(ID3D12Device* device, ID3D12RootSignature** sig_p
|
||||
&root_signature_blob, &root_signature_error_blob);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
PanicAlertFmt("Failed to serialize root signature: {}",
|
||||
static_cast<const char*>(root_signature_error_blob->GetBufferPointer()));
|
||||
PanicAlertFmt("Failed to serialize root signature: {}\n{}",
|
||||
static_cast<const char*>(root_signature_error_blob->GetBufferPointer()),
|
||||
DX12HRWrap(hr));
|
||||
return false;
|
||||
}
|
||||
|
||||
hr = device->CreateRootSignature(0, root_signature_blob->GetBufferPointer(),
|
||||
root_signature_blob->GetBufferSize(), IID_PPV_ARGS(sig_ptr));
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create root signature");
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create root signature: {}", DX12HRWrap(hr));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -417,13 +418,13 @@ bool DXContext::CreateCommandLists()
|
||||
CommandListResources& res = m_command_lists[i];
|
||||
HRESULT hr = m_device->CreateCommandAllocator(
|
||||
D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(res.command_allocator.GetAddressOf()));
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create command allocator");
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create command allocator: {}", DX12HRWrap(hr));
|
||||
if (FAILED(hr))
|
||||
return false;
|
||||
|
||||
hr = m_device->CreateCommandList(1, D3D12_COMMAND_LIST_TYPE_DIRECT, res.command_allocator.Get(),
|
||||
nullptr, IID_PPV_ARGS(res.command_list.GetAddressOf()));
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create command list");
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to create command list: {}", DX12HRWrap(hr));
|
||||
if (FAILED(hr))
|
||||
{
|
||||
return false;
|
||||
@ -431,7 +432,7 @@ bool DXContext::CreateCommandLists()
|
||||
|
||||
// Close the command list, since the first thing we do is reset them.
|
||||
hr = res.command_list->Close();
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Closing new command list failed");
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Closing new command list failed: {}", DX12HRWrap(hr));
|
||||
if (FAILED(hr))
|
||||
return false;
|
||||
|
||||
@ -473,7 +474,7 @@ void DXContext::ExecuteCommandList(bool wait_for_completion)
|
||||
|
||||
// Close and queue command list.
|
||||
HRESULT hr = res.command_list->Close();
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to close command list");
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to close command list: {}", DX12HRWrap(hr));
|
||||
const std::array<ID3D12CommandList*, 1> execute_lists{res.command_list.Get()};
|
||||
m_command_queue->ExecuteCommandLists(static_cast<UINT>(execute_lists.size()),
|
||||
execute_lists.data());
|
||||
@ -481,7 +482,7 @@ void DXContext::ExecuteCommandList(bool wait_for_completion)
|
||||
// Update fence when GPU has completed.
|
||||
hr = m_command_queue->Signal(m_fence.Get(), m_current_fence_value);
|
||||
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to signal fence");
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to signal fence: {}", DX12HRWrap(hr));
|
||||
|
||||
MoveToNextCommandList();
|
||||
if (wait_for_completion)
|
||||
@ -534,7 +535,7 @@ void DXContext::WaitForFence(u64 fence)
|
||||
{
|
||||
// Fall back to event.
|
||||
HRESULT hr = m_fence->SetEventOnCompletion(fence, m_fence_event);
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to set fence event on completion");
|
||||
ASSERT_MSG(VIDEO, SUCCEEDED(hr), "Failed to set fence event on completion: {}", DX12HRWrap(hr));
|
||||
WaitForSingleObject(m_fence_event, INFINITE);
|
||||
m_completed_fence_value = m_fence->GetCompletedValue();
|
||||
}
|
||||
|
Reference in New Issue
Block a user