diff options
| author | 2018-08-05 16:37:39 -0400 | |
|---|---|---|
| committer | 2018-08-05 16:37:39 -0400 | |
| commit | c0af42d6eb7dbe7879f555aa9a415faee4c3d6d1 (patch) | |
| tree | 85469600d392a504b6de17b57b3e2f96e8cfb10b /src/video_core/engines | |
| parent | Merge pull request #928 from MerryMage/dynarmic (diff) | |
| parent | renderer_base: Make Rasterizer() return the rasterizer by reference (diff) | |
| download | yuzu-c0af42d6eb7dbe7879f555aa9a415faee4c3d6d1.tar.gz yuzu-c0af42d6eb7dbe7879f555aa9a415faee4c3d6d1.tar.xz yuzu-c0af42d6eb7dbe7879f555aa9a415faee4c3d6d1.zip | |
Merge pull request #912 from lioncash/global-var
video_core: Eliminate the g_renderer global variable
Diffstat (limited to 'src/video_core/engines')
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.h | 8 |
2 files changed, 12 insertions, 6 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index 0e205ed72..a235b543e 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -19,8 +19,8 @@ namespace Engines { | |||
| 19 | /// First register id that is actually a Macro call. | 19 | /// First register id that is actually a Macro call. |
| 20 | constexpr u32 MacroRegistersStart = 0xE00; | 20 | constexpr u32 MacroRegistersStart = 0xE00; |
| 21 | 21 | ||
| 22 | Maxwell3D::Maxwell3D(MemoryManager& memory_manager) | 22 | Maxwell3D::Maxwell3D(VideoCore::RasterizerInterface& rasterizer, MemoryManager& memory_manager) |
| 23 | : memory_manager(memory_manager), macro_interpreter(*this) {} | 23 | : memory_manager(memory_manager), rasterizer{rasterizer}, macro_interpreter(*this) {} |
| 24 | 24 | ||
| 25 | void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32> parameters) { | 25 | void Maxwell3D::CallMacroMethod(u32 method, std::vector<u32> parameters) { |
| 26 | auto macro_code = uploaded_macros.find(method); | 26 | auto macro_code = uploaded_macros.find(method); |
| @@ -130,7 +130,7 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) { | |||
| 130 | break; | 130 | break; |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | VideoCore::g_renderer->Rasterizer()->NotifyMaxwellRegisterChanged(method); | 133 | rasterizer.NotifyMaxwellRegisterChanged(method); |
| 134 | 134 | ||
| 135 | if (debug_context) { | 135 | if (debug_context) { |
| 136 | debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandProcessed, nullptr); | 136 | debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandProcessed, nullptr); |
| @@ -218,7 +218,7 @@ void Maxwell3D::DrawArrays() { | |||
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count}; | 220 | const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count}; |
| 221 | VideoCore::g_renderer->Rasterizer()->AccelerateDrawBatch(is_indexed); | 221 | rasterizer.AccelerateDrawBatch(is_indexed); |
| 222 | 222 | ||
| 223 | // TODO(bunnei): Below, we reset vertex count so that we can use these registers to determine if | 223 | // TODO(bunnei): Below, we reset vertex count so that we can use these registers to determine if |
| 224 | // the game is trying to draw indexed or direct mode. This needs to be verified on HW still - | 224 | // the game is trying to draw indexed or direct mode. This needs to be verified on HW still - |
| @@ -393,7 +393,7 @@ void Maxwell3D::ProcessClearBuffers() { | |||
| 393 | regs.clear_buffers.R == regs.clear_buffers.B && | 393 | regs.clear_buffers.R == regs.clear_buffers.B && |
| 394 | regs.clear_buffers.R == regs.clear_buffers.A); | 394 | regs.clear_buffers.R == regs.clear_buffers.A); |
| 395 | 395 | ||
| 396 | VideoCore::g_renderer->Rasterizer()->Clear(); | 396 | rasterizer.Clear(); |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | } // namespace Engines | 399 | } // namespace Engines |
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index 3c32f1067..4d0ff96a5 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h | |||
| @@ -17,6 +17,10 @@ | |||
| 17 | #include "video_core/memory_manager.h" | 17 | #include "video_core/memory_manager.h" |
| 18 | #include "video_core/textures/texture.h" | 18 | #include "video_core/textures/texture.h" |
| 19 | 19 | ||
| 20 | namespace VideoCore { | ||
| 21 | class RasterizerInterface; | ||
| 22 | } | ||
| 23 | |||
| 20 | namespace Tegra::Engines { | 24 | namespace Tegra::Engines { |
| 21 | 25 | ||
| 22 | #define MAXWELL3D_REG_INDEX(field_name) \ | 26 | #define MAXWELL3D_REG_INDEX(field_name) \ |
| @@ -24,7 +28,7 @@ namespace Tegra::Engines { | |||
| 24 | 28 | ||
| 25 | class Maxwell3D final { | 29 | class Maxwell3D final { |
| 26 | public: | 30 | public: |
| 27 | explicit Maxwell3D(MemoryManager& memory_manager); | 31 | explicit Maxwell3D(VideoCore::RasterizerInterface& rasterizer, MemoryManager& memory_manager); |
| 28 | ~Maxwell3D() = default; | 32 | ~Maxwell3D() = default; |
| 29 | 33 | ||
| 30 | /// Register structure of the Maxwell3D engine. | 34 | /// Register structure of the Maxwell3D engine. |
| @@ -818,6 +822,8 @@ public: | |||
| 818 | Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, size_t offset) const; | 822 | Texture::FullTextureInfo GetStageTexture(Regs::ShaderStage stage, size_t offset) const; |
| 819 | 823 | ||
| 820 | private: | 824 | private: |
| 825 | VideoCore::RasterizerInterface& rasterizer; | ||
| 826 | |||
| 821 | std::unordered_map<u32, std::vector<u32>> uploaded_macros; | 827 | std::unordered_map<u32, std::vector<u32>> uploaded_macros; |
| 822 | 828 | ||
| 823 | /// Macro method that is currently being executed / being fed parameters. | 829 | /// Macro method that is currently being executed / being fed parameters. |