Skip to content

Commit

Permalink
GS/D3D12: Properly name logs with D3D12 prefix.
Browse files Browse the repository at this point in the history
  • Loading branch information
lightningterror committed Dec 31, 2024
1 parent 2eb0ab2 commit 9a6feb6
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions pcsx2/GS/Renderers/DX12/GSDevice12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ GSDevice12::ComPtr<ID3DBlob> GSDevice12::SerializeRootSignature(const D3D12_ROOT
const HRESULT hr = D3D12SerializeRootSignature(desc, D3D_ROOT_SIGNATURE_VERSION_1, blob.put(), error_blob.put());
if (FAILED(hr))
{
Console.Error("D3D12SerializeRootSignature() failed: %08X", hr);
Console.Error("D3D12: D3D12SerializeRootSignature() failed: %08X", hr);
if (error_blob)
Console.Error("%s", error_blob->GetBufferPointer());

Expand All @@ -121,7 +121,7 @@ GSDevice12::ComPtr<ID3D12RootSignature> GSDevice12::CreateRootSignature(const D3
m_device->CreateRootSignature(0, blob->GetBufferPointer(), blob->GetBufferSize(), IID_PPV_ARGS(rs.put()));
if (FAILED(hr))
{
Console.Error("CreateRootSignature() failed: %08X", hr);
Console.Error("D3D12: CreateRootSignature() failed: %08X", hr);
return {};
}

Expand Down Expand Up @@ -173,7 +173,7 @@ bool GSDevice12::CreateDevice(u32& vendor_id)
}
else
{
Console.Error("Debug layer requested but not available.");
Console.Error("D3D12: Debug layer requested but not available.");
enable_debug_layer = false;
}
}
Expand All @@ -185,15 +185,15 @@ bool GSDevice12::CreateDevice(u32& vendor_id)
hr = D3D12CreateDevice(m_adapter.get(), isIntel ? D3D_FEATURE_LEVEL_12_0 : D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&m_device));
if (FAILED(hr))
{
Console.Error("Failed to create D3D12 device: %08X", hr);
Console.Error("D3D12: Failed to create device: %08X", hr);
return false;
}

if (!m_adapter)
{
const LUID luid(m_device->GetAdapterLuid());
if (FAILED(m_dxgi_factory->EnumAdapterByLuid(luid, IID_PPV_ARGS(m_adapter.put()))))
Console.Error("Failed to get lookup adapter by device LUID");
Console.Error("D3D12: Failed to get lookup adapter by device LUID");
}

if (enable_debug_layer)
Expand Down Expand Up @@ -226,7 +226,7 @@ bool GSDevice12::CreateDevice(u32& vendor_id)
hr = m_device->CreateCommandQueue(&queue_desc, IID_PPV_ARGS(&m_command_queue));
if (FAILED(hr))
{
Console.Error("Failed to create command queue: %08X", hr);
Console.Error("D3D12: Failed to create command queue: %08X", hr);
return false;
}

Expand All @@ -240,21 +240,21 @@ bool GSDevice12::CreateDevice(u32& vendor_id)
hr = D3D12MA::CreateAllocator(&allocatorDesc, m_allocator.put());
if (FAILED(hr))
{
Console.Error("D3D12MA::CreateAllocator() failed with HRESULT %08X", hr);
Console.Error("D3D12: CreateAllocator() failed with HRESULT %08X", hr);
return false;
}

hr = m_device->CreateFence(m_completed_fence_value, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&m_fence));
if (FAILED(hr))
{
Console.Error("Failed to create fence: %08X", hr);
Console.Error("D3D12: Failed to create fence: %08X", hr);
return false;
}

m_fence_event = CreateEvent(nullptr, FALSE, FALSE, nullptr);
if (m_fence_event == NULL)
{
Console.Error("Failed to create fence event: %08X", GetLastError());
Console.Error("D3D12: Failed to create fence event: %08X", GetLastError());
return false;
}

Expand Down Expand Up @@ -312,7 +312,7 @@ bool GSDevice12::CreateCommandLists()
nullptr, IID_PPV_ARGS(res.command_lists[i].put()));
if (FAILED(hr))
{
Console.Error("Failed to create command list: %08X", hr);
Console.Error("D3D12: Failed to create command list: %08X", hr);
return false;
}

Expand All @@ -325,13 +325,13 @@ bool GSDevice12::CreateCommandLists()

if (!res.descriptor_allocator.Create(m_device.get(), D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV, MAX_GPU_SRVS))
{
Console.Error("Failed to create per frame descriptor allocator");
Console.Error("D3D12: Failed to create per frame descriptor allocator");
return false;
}

if (!res.sampler_allocator.Create(m_device.get(), MAX_GPU_SAMPLERS))
{
Console.Error("Failed to create per frame sampler allocator");
Console.Error("D3D12: Failed to create per frame sampler allocator");
return false;
}
}
Expand Down Expand Up @@ -378,7 +378,7 @@ void GSDevice12::MoveToNextCommandList()
}
else
{
Console.Warning("Map() for timestamp query failed: %08X", hr);
Console.Warning("D3D12: Map() for timestamp query failed: %08X", hr);
}
}

Expand Down Expand Up @@ -432,7 +432,7 @@ bool GSDevice12::ExecuteCommandList(WaitType wait_for_completion)
hr = res.command_lists[0]->Close();
if (FAILED(hr))
{
Console.Error("Closing init command list failed with HRESULT %08X", hr);
Console.Error("D3D12: Closing init command list failed with HRESULT %08X", hr);
return false;
}
}
Expand All @@ -441,7 +441,7 @@ bool GSDevice12::ExecuteCommandList(WaitType wait_for_completion)
hr = res.command_lists[1]->Close();
if (FAILED(hr))
{
Console.Error("Closing main command list failed with HRESULT %08X", hr);
Console.Error("D3D12: Closing main command list failed with HRESULT %08X", hr);
return false;
}

Expand Down Expand Up @@ -581,7 +581,7 @@ bool GSDevice12::CreateTimestampQuery()
HRESULT hr = m_device->CreateQueryHeap(&desc, IID_PPV_ARGS(m_timestamp_query_heap.put()));
if (FAILED(hr))
{
Console.Error("CreateQueryHeap() for timestamp failed with %08X", hr);
Console.Error("D3D12: CreateQueryHeap() for timestamp failed with %08X", hr);
return false;
}

Expand All @@ -592,15 +592,15 @@ bool GSDevice12::CreateTimestampQuery()
m_timestamp_query_allocation.put(), IID_PPV_ARGS(m_timestamp_query_buffer.put()));
if (FAILED(hr))
{
Console.Error("CreateResource() for timestamp failed with %08X", hr);
Console.Error("D3D12: CreateResource() for timestamp failed with %08X", hr);
return false;
}

u64 frequency;
hr = m_command_queue->GetTimestampFrequency(&frequency);
if (FAILED(hr))
{
Console.Error("GetTimestampFrequency() failed: %08X", hr);
Console.Error("D3D12: GetTimestampFrequency() failed: %08X", hr);
return false;
}

Expand Down Expand Up @@ -691,7 +691,7 @@ bool GSDevice12::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)

if (!CheckFeatures(vendor_id))
{
Console.Error("Your GPU does not support the required D3D12 features.");
Console.Error("D3D12: Your GPU does not support the required D3D12 features.");
return false;
}

Expand All @@ -715,7 +715,7 @@ bool GSDevice12::Create(GSVSyncMode vsync_mode, bool allow_present_throttle)
}

if (!m_shader_cache.Open(m_feature_level, GSConfig.UseDebugDevice))
Console.Warning("Shader cache failed to open.");
Console.Warning("D3D12: Shader cache failed to open.");

if (!CreateNullTexture())
{
Expand Down Expand Up @@ -769,7 +769,7 @@ void GSDevice12::SetVSyncMode(GSVSyncMode mode, bool allow_present_throttle)
// Using mailbox-style no-allow-tearing causes tearing in exclusive fullscreen.
if (mode == GSVSyncMode::Mailbox && m_is_exclusive_fullscreen)
{
WARNING_LOG("Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
WARNING_LOG("D3D12: Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
mode = GSVSyncMode::FIFO;
}

Expand Down Expand Up @@ -822,7 +822,7 @@ bool GSDevice12::CreateSwapChain()
// Using mailbox-style no-allow-tearing causes tearing in exclusive fullscreen.
if (m_vsync_mode == GSVSyncMode::Mailbox && m_is_exclusive_fullscreen)
{
WARNING_LOG("Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
WARNING_LOG("D3D12: Using FIFO instead of Mailbox vsync due to exclusive fullscreen.");
m_vsync_mode = GSVSyncMode::FIFO;
}
}
Expand Down Expand Up @@ -859,25 +859,25 @@ bool GSDevice12::CreateSwapChain()
fs_desc.Scaling = fullscreen_mode.Scaling;
fs_desc.Windowed = FALSE;

Console.WriteLn("Creating a %dx%d exclusive fullscreen swap chain", fs_sd_desc.Width, fs_sd_desc.Height);
Console.WriteLn("D3D12: Creating a %dx%d exclusive fullscreen swap chain", fs_sd_desc.Width, fs_sd_desc.Height);
hr = m_dxgi_factory->CreateSwapChainForHwnd(m_command_queue.get(), window_hwnd, &fs_sd_desc,
&fs_desc, fullscreen_output.get(), m_swap_chain.put());
if (FAILED(hr))
{
Console.Warning("Failed to create fullscreen swap chain, trying windowed.");
Console.Warning("D3D12: Failed to create fullscreen swap chain, trying windowed.");
m_is_exclusive_fullscreen = false;
m_using_allow_tearing = m_allow_tearing_supported;
}
}

if (!m_is_exclusive_fullscreen)
{
Console.WriteLn("Creating a %dx%d windowed swap chain", swap_chain_desc.Width, swap_chain_desc.Height);
Console.WriteLn("D3D12: Creating a %dx%d windowed swap chain", swap_chain_desc.Width, swap_chain_desc.Height);
hr = m_dxgi_factory->CreateSwapChainForHwnd(
m_command_queue.get(), window_hwnd, &swap_chain_desc, nullptr, nullptr, m_swap_chain.put());

if (FAILED(hr))
Console.Warning("Failed to create windowed swap chain.");
Console.Warning("D3D12: Failed to create windowed swap chain.");
}

// MWA needs to be called on the correct factory.
Expand All @@ -887,11 +887,11 @@ bool GSDevice12::CreateSwapChain()
{
hr = swap_chain_factory->MakeWindowAssociation(window_hwnd, DXGI_MWA_NO_WINDOW_CHANGES);
if (FAILED(hr))
Console.ErrorFmt("MakeWindowAssociation() to disable ALT+ENTER failed: {}", Error::CreateHResult(hr).GetDescription());
Console.ErrorFmt("D3D12: MakeWindowAssociation() to disable ALT+ENTER failed: {}", Error::CreateHResult(hr).GetDescription());
}
else
{
Console.ErrorFmt("GetParent() on swap chain to get factory failed: {}", Error::CreateHResult(hr).GetDescription());
Console.ErrorFmt("D3D12: GetParent() on swap chain to get factory failed: {}", Error::CreateHResult(hr).GetDescription());
}

if (!CreateSwapChainRTV())
Expand Down Expand Up @@ -926,7 +926,7 @@ bool GSDevice12::CreateSwapChainRTV()
hr = m_swap_chain->GetBuffer(i, IID_PPV_ARGS(backbuffer.put()));
if (FAILED(hr))
{
Console.Error("GetBuffer for RTV failed: 0x%08X", hr);
Console.Error("D3D12: GetBuffer for RTV failed: 0x%08X", hr);
m_swap_chain_buffers.clear();
return false;
}
Expand All @@ -946,7 +946,7 @@ bool GSDevice12::CreateSwapChainRTV()

m_window_info.surface_width = swap_chain_desc.BufferDesc.Width;
m_window_info.surface_height = swap_chain_desc.BufferDesc.Height;
DevCon.WriteLn("Swap chain buffer size: %ux%u", m_window_info.surface_width, m_window_info.surface_height);
DevCon.WriteLn("D3D12: Swap chain buffer size: %ux%u", m_window_info.surface_width, m_window_info.surface_height);

if (m_window_info.type == WindowInfo::Type::Win32)
{
Expand Down Expand Up @@ -998,7 +998,7 @@ bool GSDevice12::UpdateWindow()

if (m_window_info.type != WindowInfo::Type::Surfaceless && !CreateSwapChain())
{
Console.WriteLn("Failed to create swap chain on updated window");
Console.WriteLn("D3D12: Failed to create swap chain on updated window");
return false;
}

Expand Down Expand Up @@ -1066,7 +1066,7 @@ void GSDevice12::ResizeWindow(s32 new_window_width, s32 new_window_height, float
HRESULT hr = m_swap_chain->ResizeBuffers(
0, 0, 0, DXGI_FORMAT_UNKNOWN, m_using_allow_tearing ? DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0);
if (FAILED(hr))
Console.Error("ResizeBuffers() failed: 0x%08X", hr);
Console.Error("D3D12: ResizeBuffers() failed: 0x%08X", hr);

if (!CreateSwapChainRTV())
pxFailRel("Failed to recreate swap chain RTV after resize");
Expand Down Expand Up @@ -1931,7 +1931,7 @@ bool GSDevice12::CompileCASPipelines()
m_cas_sharpen_pipeline = cpb.Create(m_device.get(), m_shader_cache, false);
if (!m_cas_upscale_pipeline || !m_cas_sharpen_pipeline)
{
Console.Error("Failed to create CAS pipelines");
Console.Error("D3D12: Failed to create CAS pipelines");
return false;
}

Expand All @@ -1943,15 +1943,15 @@ bool GSDevice12::CompileImGuiPipeline()
const std::optional<std::string> hlsl = ReadShaderSource("shaders/dx11/imgui.fx");
if (!hlsl.has_value())
{
Console.Error("Failed to read imgui.fx");
Console.Error("D3D12: Failed to read imgui.fx");
return false;
}

const ComPtr<ID3DBlob> vs = m_shader_cache.GetVertexShader(hlsl.value(), nullptr, "vs_main");
const ComPtr<ID3DBlob> ps = m_shader_cache.GetPixelShader(hlsl.value(), nullptr, "ps_main");
if (!vs || !ps)
{
Console.Error("Failed to compile ImGui shaders");
Console.Error("D3D12: Failed to compile ImGui shaders");
return false;
}

Expand All @@ -1972,7 +1972,7 @@ bool GSDevice12::CompileImGuiPipeline()
m_imgui_pipeline = gpb.Create(m_device.get(), m_shader_cache, false);
if (!m_imgui_pipeline)
{
Console.Error("Failed to compile ImGui pipeline");
Console.Error("D3D12: Failed to compile ImGui pipeline");
return false;
}

Expand Down Expand Up @@ -2015,7 +2015,7 @@ void GSDevice12::RenderImGui()
// just skip if we run out.. we can't resume the present render pass :/
if (!GetSamplerAllocator().LookupSingle(&m_utility_sampler_gpu, m_linear_sampler_cpu))
{
Console.Warning("Skipping ImGui draw because of no descriptors");
Console.Warning("D3D12: Skipping ImGui draw because of no descriptors");
return;
}
}
Expand All @@ -2032,7 +2032,7 @@ void GSDevice12::RenderImGui()
const u32 size = sizeof(ImDrawVert) * static_cast<u32>(cmd_list->VtxBuffer.Size);
if (!m_vertex_stream_buffer.ReserveMemory(size, sizeof(ImDrawVert)))
{
Console.Warning("Skipping ImGui draw because of no vertex buffer space");
Console.Warning("D3D12: Skipping ImGui draw because of no vertex buffer space");
return;
}

Expand Down Expand Up @@ -2072,7 +2072,7 @@ void GSDevice12::RenderImGui()

if (!GetTextureGroupDescriptors(&m_utility_texture_gpu, &handle, 1))
{
Console.Warning("Skipping ImGui draw because of no descriptors");
Console.Warning("D3D12: Skipping ImGui draw because of no descriptors");
return;
}
}
Expand Down Expand Up @@ -2103,7 +2103,7 @@ bool GSDevice12::DoCAS(
if (!GetTextureGroupDescriptors(&sTexDH, &sTex12->GetSRVDescriptor(), 1) ||
!GetTextureGroupDescriptors(&dTexDH, &dTex12->GetUAVDescriptor(), 1))
{
Console.Error("Failed to allocate CAS descriptors.");
Console.Error("D3D12: Failed to allocate CAS descriptors.");
return false;
}
}
Expand Down Expand Up @@ -3104,13 +3104,13 @@ void GSDevice12::ExecuteCommandList(bool wait_for_completion, const char* reason
const std::string reason_str(StringUtil::StdStringFromFormatV(reason, ap));
va_end(ap);

Console.Warning("D3D12: Executing command buffer due to '%s'", reason_str.c_str());
Console.Warning("D3D12: D3D12: Executing command buffer due to '%s'", reason_str.c_str());
ExecuteCommandList(wait_for_completion);
}

void GSDevice12::ExecuteCommandListAndRestartRenderPass(bool wait_for_completion, const char* reason)
{
Console.Warning("D3D12: Executing command buffer due to '%s'", reason);
Console.Warning("D3D12: D3D12: Executing command buffer due to '%s'", reason);

const bool was_in_render_pass = m_in_render_pass;
EndRenderPass();
Expand Down Expand Up @@ -3567,7 +3567,7 @@ bool GSDevice12::ApplyTFXState(bool already_execed)
{
if (already_execed)
{
Console.Error("Failed to reserve vertex uniform space");
Console.Error("D3D12: Failed to reserve vertex uniform space");
return false;
}

Expand All @@ -3588,7 +3588,7 @@ bool GSDevice12::ApplyTFXState(bool already_execed)
{
if (already_execed)
{
Console.Error("Failed to reserve pixel uniform space");
Console.Error("D3D12: Failed to reserve pixel uniform space");
return false;
}

Expand Down Expand Up @@ -3846,7 +3846,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
date_image = SetupPrimitiveTrackingDATE(config, pipe);
if (!date_image)
{
Console.WriteLn("Failed to allocate DATE image, aborting draw.");
Console.WriteLn("D3D12: Failed to allocate DATE image, aborting draw.");
return;
}
}
Expand Down Expand Up @@ -3874,7 +3874,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
hdr_rt = static_cast<GSTexture12*>(CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::HDRColor, false));
if (!hdr_rt)
{
Console.WriteLn("Failed to allocate HDR render target, aborting draw.");
Console.WriteLn("D3D12: Failed to allocate HDR render target, aborting draw.");
if (date_image)
Recycle(date_image);
return;
Expand Down

0 comments on commit 9a6feb6

Please sign in to comment.