renderer: Create rasterizer and cleanup.

This commit is contained in:
bunnei 2018-03-22 19:46:37 -04:00
parent ec5ede68e7
commit 656de23d93
4 changed files with 16 additions and 4 deletions

View File

@ -5,6 +5,11 @@
#include <atomic>
#include <memory>
#include "video_core/renderer_base.h"
#include "video_core/renderer_opengl/gl_rasterizer.h"
#include "video_core/video_core.h"
void RendererBase::RefreshRasterizerSetting() {}
void RendererBase::RefreshRasterizerSetting() {
if (rasterizer == nullptr) {
rasterizer = std::make_unique<RasterizerOpenGL>();
}
}

View File

@ -8,6 +8,7 @@
#include <boost/optional.hpp>
#include "common/assert.h"
#include "common/common_types.h"
#include "video_core/rasterizer_interface.h"
class EmuWindow;
@ -74,12 +75,16 @@ public:
return m_current_frame;
}
VideoCore::RasterizerInterface* Rasterizer() const {
return rasterizer.get();
}
void RefreshRasterizerSetting();
protected:
std::unique_ptr<VideoCore::RasterizerInterface> rasterizer;
f32 m_current_fps = 0.0f; ///< Current framerate, should be set by the renderer
int m_current_frame = 0; ///< Current frame, should be set by the renderer
private:
bool opengl_rasterizer_active = false;
};

View File

@ -211,8 +211,8 @@ struct SurfaceParams {
MathUtil::Rectangle<u32> GetSubRect(const SurfaceParams& sub_surface) const;
MathUtil::Rectangle<u32> GetScaledSubRect(const SurfaceParams& sub_surface) const;
PAddr addr = 0;
PAddr end = 0;
VAddr addr = 0;
VAddr end = 0;
u64 size = 0;
u32 width = 0;

View File

@ -15,6 +15,8 @@ class RendererBase;
namespace VideoCore {
enum class Renderer { Software, OpenGL };
extern std::unique_ptr<RendererBase> g_renderer; ///< Renderer plugin
extern EmuWindow* g_emu_window; ///< Emu window