From 863579736cee987b7d3c341907b6c25f4fc1357b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 20 Jul 2018 18:31:36 -0400 Subject: [PATCH] gpu: Rename Get3DEngine() to Maxwell3D() This makes it match its const qualified equivalent. --- src/video_core/gpu.cpp | 6 +++++- src/video_core/gpu.h | 9 ++++----- src/video_core/renderer_opengl/gl_rasterizer.cpp | 10 +++++----- src/yuzu/debugger/graphics/graphics_surface.cpp | 6 +++--- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index e36483145..a003bc9e3 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -20,7 +20,11 @@ GPU::GPU() { GPU::~GPU() = default; -const Tegra::Engines::Maxwell3D& GPU::Get3DEngine() const { +const Engines::Maxwell3D& GPU::Maxwell3D() const { + return *maxwell_3d; +} + +Engines::Maxwell3D& GPU::Maxwell3D() { return *maxwell_3d; } diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index 60930e997..a32148ecd 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -93,15 +93,14 @@ public: /// Processes a command list stored at the specified address in GPU memory. void ProcessCommandList(GPUVAddr address, u32 size); + /// Returns a const reference to the Maxwell3D GPU engine. + const Engines::Maxwell3D& Maxwell3D() const; + /// Returns a reference to the Maxwell3D GPU engine. - const Engines::Maxwell3D& Get3DEngine() const; + Engines::Maxwell3D& Maxwell3D(); std::unique_ptr memory_manager; - Engines::Maxwell3D& Maxwell3D() { - return *maxwell_3d; - } - private: /// Writes a single register in the engine bound to the specified subchannel void WriteReg(u32 method, u32 subchannel, u32 value, u32 remaining_params); diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index f75999557..65a2fd5e8 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -634,8 +634,8 @@ void RasterizerOpenGL::SamplerInfo::SyncWithConfig(const Tegra::Texture::TSCEntr u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint program, u32 current_bindpoint, const std::vector& entries) { - auto& gpu = Core::System::GetInstance().GPU(); - auto& maxwell3d = gpu.Get3DEngine(); + const auto& gpu = Core::System::GetInstance().GPU(); + const auto& maxwell3d = gpu.Maxwell3D(); // Reset all buffer draw state for this stage. for (auto& buffer : state.draw.const_buffers[static_cast(stage)]) { @@ -644,7 +644,7 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr } // Upload only the enabled buffers from the 16 constbuffers of each shader stage - auto& shader_stage = maxwell3d.state.shader_stages[static_cast(stage)]; + const auto& shader_stage = maxwell3d.state.shader_stages[static_cast(stage)]; for (u32 bindpoint = 0; bindpoint < entries.size(); ++bindpoint) { const auto& used_buffer = entries[bindpoint]; @@ -700,8 +700,8 @@ u32 RasterizerOpenGL::SetupConstBuffers(Maxwell::ShaderStage stage, GLuint progr u32 RasterizerOpenGL::SetupTextures(Maxwell::ShaderStage stage, GLuint program, u32 current_unit, const std::vector& entries) { - auto& gpu = Core::System::GetInstance().GPU(); - auto& maxwell3d = gpu.Get3DEngine(); + const auto& gpu = Core::System::GetInstance().GPU(); + const auto& maxwell3d = gpu.Maxwell3D(); ASSERT_MSG(current_unit + entries.size() <= std::size(state.texture_units), "Exceeded the number of active textures."); diff --git a/src/yuzu/debugger/graphics/graphics_surface.cpp b/src/yuzu/debugger/graphics/graphics_surface.cpp index 1fbca8ad0..c41ff693b 100644 --- a/src/yuzu/debugger/graphics/graphics_surface.cpp +++ b/src/yuzu/debugger/graphics/graphics_surface.cpp @@ -336,9 +336,9 @@ void GraphicsSurfaceWidget::OnUpdate() { // TODO: Store a reference to the registers in the debug context instead of accessing them // directly... - auto& registers = gpu.Get3DEngine().regs; - auto& rt = registers.rt[static_cast(surface_source) - - static_cast(Source::RenderTarget0)]; + const auto& registers = gpu.Maxwell3D().regs; + const auto& rt = registers.rt[static_cast(surface_source) - + static_cast(Source::RenderTarget0)]; surface_address = rt.Address(); surface_width = rt.width;