aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_opengl/renderer_opengl.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-08-20 19:22:43 -0400
committerLioncash <mathew1800@gmail.com>2018-08-20 19:28:00 -0400
commitbc16f7f3cce7b3a689f45697d9f6fbd970993e32 (patch)
tree5bdf30d31fda49f68ec7e7ec6d9bb8f4d68db051 /src/video_core/renderer_opengl/renderer_opengl.cpp
parent028d90eb79b75292d352cc8d4b96a2df74cd6b6e (diff)
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/renderer_opengl.cpp')
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp13
1 files changed, 10 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 @@
#include "core/memory.h"
#include "core/settings.h"
#include "core/tracer/recorder.h"
+#include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/renderer_opengl/renderer_opengl.h"
#include "video_core/utils.h"
@@ -142,7 +143,6 @@ void RendererOpenGL::SwapBuffers(boost::optional<const Tegra::FramebufferConfig&
// Restore the rasterizer state
prev_state.Apply();
- RefreshRasterizerSetting();
}
/**
@@ -276,6 +276,14 @@ void RendererOpenGL::InitOpenGLObjects() {
LoadColorToActiveGLTexture(0, 0, 0, 0, screen_info.texture);
}
+void RendererOpenGL::CreateRasterizer() {
+ if (rasterizer) {
+ return;
+ }
+
+ rasterizer = std::make_unique<RasterizerOpenGL>(render_window);
+}
+
void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
const Tegra::FramebufferConfig& framebuffer) {
@@ -463,8 +471,7 @@ bool RendererOpenGL::Init() {
}
InitOpenGLObjects();
-
- RefreshRasterizerSetting();
+ CreateRasterizer();
return true;
}