From 90d06acfedb4c58b7b62153059c97b05035fc979 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Tue, 26 Mar 2019 18:46:46 -0400 Subject: Fixes to Const Buffer Accessor and Formatting --- src/video_core/const_buffer_accessor.cpp | 12 ++++++++---- src/video_core/const_buffer_accessor.h | 5 +---- src/video_core/renderer_opengl/gl_rasterizer.cpp | 3 +-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/video_core/const_buffer_accessor.cpp b/src/video_core/const_buffer_accessor.cpp index c89ab91c7..0e613e1f9 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 2410f1483..37d1ca767 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 a20acfe8e..e847b75fb 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(); -- cgit v1.2.3