From 45fb74d2623182b38af422bc6c8a51040860143f Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 28 Aug 2018 10:57:56 -0400 Subject: gpu: Make memory_manager private Makes the class interface consistent and provides accessors for obtaining a reference to the memory manager instance. Given we also return references, this makes our more flimsy uses of const apparent, given const doesn't propagate through pointers in the way one would typically expect. This makes our mutable state more apparent in some places. --- src/video_core/gpu.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/video_core/gpu.cpp') diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 9758adcfd..e6d8e65c6 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -22,7 +22,7 @@ u32 FramebufferConfig::BytesPerPixel(PixelFormat format) { } GPU::GPU(VideoCore::RasterizerInterface& rasterizer) { - memory_manager = std::make_unique(); + memory_manager = std::make_unique(); maxwell_3d = std::make_unique(rasterizer, *memory_manager); fermi_2d = std::make_unique(*memory_manager); maxwell_compute = std::make_unique(); @@ -31,14 +31,22 @@ GPU::GPU(VideoCore::RasterizerInterface& rasterizer) { GPU::~GPU() = default; -const Engines::Maxwell3D& GPU::Maxwell3D() const { +Engines::Maxwell3D& GPU::Maxwell3D() { return *maxwell_3d; } -Engines::Maxwell3D& GPU::Maxwell3D() { +const Engines::Maxwell3D& GPU::Maxwell3D() const { return *maxwell_3d; } +MemoryManager& GPU::MemoryManager() { + return *memory_manager; +} + +const MemoryManager& GPU::MemoryManager() const { + return *memory_manager; +} + u32 RenderTargetBytesPerPixel(RenderTargetFormat format) { ASSERT(format != RenderTargetFormat::NONE); -- cgit v1.2.3