From 8f84fca0f2aa25d523065f7ff60e7b157ca091d0 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Mon, 26 Oct 2015 23:58:05 +0100 Subject: [PATCH] d3d12: Fix some unintialised value warning. --- rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp | 39 +++++++++++++-------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp index 97aebe8299..cfc470e9e1 100644 --- a/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp +++ b/rpcs3/Emu/RSX/D3D12/D3D12GSRender.cpp @@ -401,6 +401,23 @@ void D3D12GSRender::clear_surface(u32 arg) } } +namespace +{ +UINT get_num_rtt(u8 color_target) noexcept +{ + switch (color_target) + { + case CELL_GCM_SURFACE_TARGET_NONE: return 0; + case CELL_GCM_SURFACE_TARGET_0: + case CELL_GCM_SURFACE_TARGET_1: return 1; + case CELL_GCM_SURFACE_TARGET_MRT1: return 2; + case CELL_GCM_SURFACE_TARGET_MRT2: return 3; + case CELL_GCM_SURFACE_TARGET_MRT3: return 4; + } + unreachable("Wrong color target"); +} +} + void D3D12GSRender::end() { std::chrono::time_point startDuration = std::chrono::system_clock::now(); @@ -510,27 +527,7 @@ void D3D12GSRender::end() std::chrono::time_point textureDurationEnd = std::chrono::system_clock::now(); m_timers.m_textureDuration += std::chrono::duration_cast(textureDurationEnd - textureDurationStart).count(); - size_t numRTT; - switch (u32 color_target = rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]) - { - case CELL_GCM_SURFACE_TARGET_NONE: break; - case CELL_GCM_SURFACE_TARGET_0: - case CELL_GCM_SURFACE_TARGET_1: - numRTT = 1; - break; - case CELL_GCM_SURFACE_TARGET_MRT1: - numRTT = 2; - break; - case CELL_GCM_SURFACE_TARGET_MRT2: - numRTT = 3; - break; - case CELL_GCM_SURFACE_TARGET_MRT3: - numRTT = 4; - break; - default: - LOG_ERROR(RSX, "Bad surface color target: %d", color_target); - } - + size_t numRTT = get_num_rtt(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]); getCurrentResourceStorage().m_commandList->OMSetRenderTargets((UINT)numRTT, &m_rtts.m_renderTargetsDescriptorsHeap->GetCPUDescriptorHandleForHeapStart(), true, &CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtts.m_depthStencilDescriptorHeap->GetCPUDescriptorHandleForHeapStart()));