diff --git a/src/video_core/const_buffer_accessor.cpp b/src/video_core/const_buffer_accessor.cpp index c89ab91c74..0e613e1f92 100644 --- a/src/video_core/const_buffer_accessor.cpp +++ b/src/video_core/const_buffer_accessor.cpp @@ -14,21 +14,25 @@ namespace Tegra { u32 ConstBufferAccessor::access32(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage, u64 const_buffer, u64 offset) { - auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager(); + auto& gpu = Core::System::GetInstance().GPU(); + auto& memory_manager = gpu.MemoryManager(); + auto& maxwell3d = gpu.Maxwell3D(); const auto& shader_stage = maxwell3d.state.shader_stages[static_cast(stage)]; const auto& buffer = shader_stage.const_buffers[const_buffer]; u32 result; - std::memcpy(&result, memory_manager.GetPointer(buffer.address + offset * 4), sizeof(u32)); + std::memcpy(&result, memory_manager.GetPointer(buffer.address + offset), sizeof(u32)); return result; } u64 ConstBufferAccessor::access64(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage, u64 const_buffer, u64 offset) { - auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager(); + auto& gpu = Core::System::GetInstance().GPU(); + auto& memory_manager = gpu.MemoryManager(); + auto& maxwell3d = gpu.Maxwell3D(); const auto& shader_stage = maxwell3d.state.shader_stages[static_cast(stage)]; const auto& buffer = shader_stage.const_buffers[const_buffer]; u64 result; - std::memcpy(&result, memory_manager.GetPointer(buffer.address + offset * 4), sizeof(u64)); + std::memcpy(&result, memory_manager.GetPointer(buffer.address + offset), sizeof(u64)); return result; } diff --git a/src/video_core/const_buffer_accessor.h b/src/video_core/const_buffer_accessor.h index 2410f14835..37d1ca7676 100644 --- a/src/video_core/const_buffer_accessor.h +++ b/src/video_core/const_buffer_accessor.h @@ -7,15 +7,12 @@ namespace Tegra { class ConstBufferAccessor { public: - ConstBufferAccessor(Tegra::Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {} + ConstBufferAccessor() {} ~ConstBufferAccessor() = default; u32 access32(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage, u64 const_buffer, u64 offset); u64 access64(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage, u64 const_buffer, u64 offset); - -private: - Tegra::Engines::Maxwell3D& maxwell3d; }; } // namespace Tegra diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index a20acfe8e1..e847b75fb5 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -101,8 +101,7 @@ struct FramebufferCacheKey { RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window, Core::System& system, ScreenInfo& info) : res_cache{*this}, shader_cache{*this, system}, global_cache{*this}, system{system}, - screen_info{info}, buffer_cache(*this, STREAM_BUFFER_SIZE), - const_buffer_accessor(system.GPU().Maxwell3D()) { + screen_info{info}, buffer_cache(*this, STREAM_BUFFER_SIZE), const_buffer_accessor() { // Create sampler objects for (std::size_t i = 0; i < texture_samplers.size(); ++i) { texture_samplers[i].Create();