GLContext: Remove global context pointer

This commit is contained in:
Stenzek
2018-10-03 23:03:26 +10:00
parent eb284b5d66
commit dcdd02d646
19 changed files with 183 additions and 150 deletions

View File

@ -11,15 +11,18 @@
#include "Common/CommonTypes.h"
#include "VideoCommon/VideoCommon.h"
class GLContext;
class AbstractTexture;
struct WindowSystemInfo;
class SWOGLWindow
{
public:
static void Init(const WindowSystemInfo& wsi);
static void Shutdown();
void Prepare();
~SWOGLWindow();
GLContext* GetContext() const { return m_gl_context.get(); }
bool IsHeadless() const;
// Will be printed on the *next* image
void PrintText(const std::string& text, int x, int y, u32 color);
@ -27,10 +30,13 @@ public:
// Image to show, will be swapped immediately
void ShowImage(AbstractTexture* image, const EFBRectangle& xfb_region);
static std::unique_ptr<SWOGLWindow> s_instance;
static std::unique_ptr<SWOGLWindow> Create(const WindowSystemInfo& wsi);
private:
SWOGLWindow() {}
SWOGLWindow();
bool Initialize(const WindowSystemInfo& wsi);
struct TextData
{
std::string text;
@ -39,7 +45,9 @@ private:
};
std::vector<TextData> m_text;
bool m_init{false};
u32 m_image_program = 0;
u32 m_image_texture = 0;
u32 m_image_vao = 0;
u32 m_image_program, m_image_texture, m_image_vao;
std::unique_ptr<GLContext> m_gl_context;
};