diff options
| author | 2018-08-20 19:22:43 -0400 | |
|---|---|---|
| committer | 2018-08-20 19:28:00 -0400 | |
| commit | bc16f7f3cce7b3a689f45697d9f6fbd970993e32 (patch) | |
| tree | 5bdf30d31fda49f68ec7e7ec6d9bb8f4d68db051 /src/video_core/renderer_opengl | |
| parent | Merge pull request #1104 from Subv/instanced_arrays (diff) | |
| download | yuzu-bc16f7f3cce7b3a689f45697d9f6fbd970993e32.tar.gz yuzu-bc16f7f3cce7b3a689f45697d9f6fbd970993e32.tar.xz yuzu-bc16f7f3cce7b3a689f45697d9f6fbd970993e32.zip | |
renderer_base: Make creation of the rasterizer, the responsibility of the renderers themselves
Given we use a base-class type within the renderer for the rasterizer
(RasterizerInterface), we want to allow renderers to perform more
complex initialization if they need to do such a thing. This makes it
important to reserve type information.
Given the OpenGL renderer is quite simple settings-wise, this is just a
simple shuffling of the initialization code. For something like Vulkan
however this might involve doing something like:
// Initialize and call rasterizer-specific function that requires
// the full type of the instance created.
auto raster = std::make_unique<VulkanRasterizer>(some, params);
raster->CallSomeVulkanRasterizerSpecificFunction();
// Assign to base class variable
rasterizer = std::move(raster)
Diffstat (limited to 'src/video_core/renderer_opengl')
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 13 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.h | 2 |
2 files changed, 12 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index bf30eda6d..4a23a931e 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include "core/memory.h" | 16 | #include "core/memory.h" |
| 17 | #include "core/settings.h" | 17 | #include "core/settings.h" |
| 18 | #include "core/tracer/recorder.h" | 18 | #include "core/tracer/recorder.h" |
| 19 | #include "video_core/renderer_opengl/gl_rasterizer.h" | ||
| 19 | #include "video_core/renderer_opengl/renderer_opengl.h" | 20 | #include "video_core/renderer_opengl/renderer_opengl.h" |
| 20 | #include "video_core/utils.h" | 21 | #include "video_core/utils.h" |
| 21 | 22 | ||
| @@ -142,7 +143,6 @@ void RendererOpenGL::SwapBuffers(boost::optional<const Tegra::FramebufferConfig& | |||
| 142 | 143 | ||
| 143 | // Restore the rasterizer state | 144 | // Restore the rasterizer state |
| 144 | prev_state.Apply(); | 145 | prev_state.Apply(); |
| 145 | RefreshRasterizerSetting(); | ||
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | /** | 148 | /** |
| @@ -276,6 +276,14 @@ void RendererOpenGL::InitOpenGLObjects() { | |||
| 276 | LoadColorToActiveGLTexture(0, 0, 0, 0, screen_info.texture); | 276 | LoadColorToActiveGLTexture(0, 0, 0, 0, screen_info.texture); |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | void RendererOpenGL::CreateRasterizer() { | ||
| 280 | if (rasterizer) { | ||
| 281 | return; | ||
| 282 | } | ||
| 283 | |||
| 284 | rasterizer = std::make_unique<RasterizerOpenGL>(render_window); | ||
| 285 | } | ||
| 286 | |||
| 279 | void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture, | 287 | void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture, |
| 280 | const Tegra::FramebufferConfig& framebuffer) { | 288 | const Tegra::FramebufferConfig& framebuffer) { |
| 281 | 289 | ||
| @@ -463,8 +471,7 @@ bool RendererOpenGL::Init() { | |||
| 463 | } | 471 | } |
| 464 | 472 | ||
| 465 | InitOpenGLObjects(); | 473 | InitOpenGLObjects(); |
| 466 | 474 | CreateRasterizer(); | |
| 467 | RefreshRasterizerSetting(); | ||
| 468 | 475 | ||
| 469 | return true; | 476 | return true; |
| 470 | } | 477 | } |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index a5eab6997..6f048ed06 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h | |||
| @@ -59,6 +59,8 @@ public: | |||
| 59 | 59 | ||
| 60 | private: | 60 | private: |
| 61 | void InitOpenGLObjects(); | 61 | void InitOpenGLObjects(); |
| 62 | void CreateRasterizer(); | ||
| 63 | |||
| 62 | void ConfigureFramebufferTexture(TextureInfo& texture, | 64 | void ConfigureFramebufferTexture(TextureInfo& texture, |
| 63 | const Tegra::FramebufferConfig& framebuffer); | 65 | const Tegra::FramebufferConfig& framebuffer); |
| 64 | void DrawScreen(); | 66 | void DrawScreen(); |