From 677a8b208d47d0d2397197ce74c7039a8ea79d20 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 4 Dec 2020 14:39:12 -0500 Subject: video_core: Resolve more variable shadowing scenarios Resolves variable shadowing scenarios up to the end of the OpenGL code to make it nicer to review. The rest will be resolved in a following commit. --- src/video_core/cdma_pusher.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/video_core/cdma_pusher.cpp') diff --git a/src/video_core/cdma_pusher.cpp b/src/video_core/cdma_pusher.cpp index b60f86260..e3e7432f7 100644 --- a/src/video_core/cdma_pusher.cpp +++ b/src/video_core/cdma_pusher.cpp @@ -29,8 +29,8 @@ #include "video_core/memory_manager.h" namespace Tegra { -CDmaPusher::CDmaPusher(GPU& gpu) - : gpu(gpu), nvdec_processor(std::make_shared(gpu)), +CDmaPusher::CDmaPusher(GPU& gpu_) + : gpu{gpu_}, nvdec_processor(std::make_shared(gpu)), vic_processor(std::make_unique(gpu, nvdec_processor)), host1x_processor(std::make_unique(gpu)), nvdec_sync(std::make_unique(gpu)), @@ -100,11 +100,11 @@ void CDmaPusher::Step() { } } -void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { +void CDmaPusher::ExecuteCommand(u32 state_offset, u32 data) { switch (current_class) { case ChClassId::NvDec: - ThiStateWrite(nvdec_thi_state, offset, {data}); - switch (static_cast(offset)) { + ThiStateWrite(nvdec_thi_state, state_offset, {data}); + switch (static_cast(state_offset)) { case ThiMethod::IncSyncpt: { LOG_DEBUG(Service_NVDRV, "NVDEC Class IncSyncpt Method"); const auto syncpoint_id = static_cast(data & 0xFF); @@ -120,16 +120,16 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { case ThiMethod::SetMethod1: LOG_DEBUG(Service_NVDRV, "NVDEC method 0x{:X}", static_cast(nvdec_thi_state.method_0)); - nvdec_processor->ProcessMethod( - static_cast(nvdec_thi_state.method_0), {data}); + nvdec_processor->ProcessMethod(static_cast(nvdec_thi_state.method_0), + {data}); break; default: break; } break; case ChClassId::GraphicsVic: - ThiStateWrite(vic_thi_state, static_cast(offset), {data}); - switch (static_cast(offset)) { + ThiStateWrite(vic_thi_state, static_cast(state_offset), {data}); + switch (static_cast(state_offset)) { case ThiMethod::IncSyncpt: { LOG_DEBUG(Service_NVDRV, "VIC Class IncSyncpt Method"); const auto syncpoint_id = static_cast(data & 0xFF); @@ -145,8 +145,7 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { case ThiMethod::SetMethod1: LOG_DEBUG(Service_NVDRV, "VIC method 0x{:X}, Args=({})", static_cast(vic_thi_state.method_0), data); - vic_processor->ProcessMethod(static_cast(vic_thi_state.method_0), - {data}); + vic_processor->ProcessMethod(static_cast(vic_thi_state.method_0), {data}); break; default: break; @@ -155,7 +154,7 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { case ChClassId::Host1x: // This device is mainly for syncpoint synchronization LOG_DEBUG(Service_NVDRV, "Host1X Class Method"); - host1x_processor->ProcessMethod(static_cast(offset), {data}); + host1x_processor->ProcessMethod(static_cast(state_offset), {data}); break; default: UNIMPLEMENTED_MSG("Current class not implemented {:X}", static_cast(current_class)); @@ -163,9 +162,10 @@ void CDmaPusher::ExecuteCommand(u32 offset, u32 data) { } } -void CDmaPusher::ThiStateWrite(ThiRegisters& state, u32 offset, const std::vector& arguments) { - u8* const state_offset = reinterpret_cast(&state) + sizeof(u32) * offset; - std::memcpy(state_offset, arguments.data(), sizeof(u32) * arguments.size()); +void CDmaPusher::ThiStateWrite(ThiRegisters& state, u32 state_offset, + const std::vector& arguments) { + u8* const state_offset_ptr = reinterpret_cast(&state) + sizeof(u32) * state_offset; + std::memcpy(state_offset_ptr, arguments.data(), sizeof(u32) * arguments.size()); } } // namespace Tegra -- cgit v1.2.3