summaryrefslogtreecommitdiff
path: root/src/video_core/gpu.h
diff options
context:
space:
mode:
authorGravatar Lioncash2018-08-03 12:55:58 -0400
committerGravatar Lioncash2018-08-04 02:36:57 -0400
commit6030c5ce412e44ddcfe0a31c6747a017166bf33d (patch)
tree2b79fa019f07e601b5170e92e93b69788ffde949 /src/video_core/gpu.h
parentMerge pull request #911 from lioncash/prototype (diff)
downloadyuzu-6030c5ce412e44ddcfe0a31c6747a017166bf33d.tar.gz
yuzu-6030c5ce412e44ddcfe0a31c6747a017166bf33d.tar.xz
yuzu-6030c5ce412e44ddcfe0a31c6747a017166bf33d.zip
video_core: Eliminate the g_renderer global variable
We move the initialization of the renderer to the core class, while keeping the creation of it and any other specifics in video_core. This way we can ensure that the renderer is initialized and doesn't give unfettered access to the renderer. This also makes dependencies on types more explicit. For example, the GPU class doesn't need to depend on the existence of a renderer, it only needs to care about whether or not it has a rasterizer, but since it was accessing the global variable, it was also making the renderer a part of its dependency chain. By adjusting the interface, we can get rid of this dependency.
Diffstat (limited to 'src/video_core/gpu.h')
-rw-r--r--src/video_core/gpu.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h
index 08aa75503..440505c9d 100644
--- a/src/video_core/gpu.h
+++ b/src/video_core/gpu.h
@@ -11,6 +11,10 @@
11#include "core/hle/service/nvflinger/buffer_queue.h" 11#include "core/hle/service/nvflinger/buffer_queue.h"
12#include "video_core/memory_manager.h" 12#include "video_core/memory_manager.h"
13 13
14namespace VideoCore {
15class RasterizerInterface;
16}
17
14namespace Tegra { 18namespace Tegra {
15 19
16enum class RenderTargetFormat : u32 { 20enum class RenderTargetFormat : u32 {
@@ -98,7 +102,7 @@ enum class EngineID {
98 102
99class GPU final { 103class GPU final {
100public: 104public:
101 GPU(); 105 explicit GPU(VideoCore::RasterizerInterface& rasterizer);
102 ~GPU(); 106 ~GPU();
103 107
104 /// Processes a command list stored at the specified address in GPU memory. 108 /// Processes a command list stored at the specified address in GPU memory.