GLInterface: Make GLInterfaceMode an enum class

This commit is contained in:
Lioncash 2016-01-02 14:19:28 -05:00
parent df9c9ad706
commit f3c05d39b9
3 changed files with 12 additions and 11 deletions

View File

@ -25,7 +25,7 @@ void* cInterfaceEGL::GetFuncAddress(const std::string& name)
void cInterfaceEGL::DetectMode()
{
if (s_opengl_mode != MODE_DETECT)
if (s_opengl_mode != GLInterfaceMode::MODE_DETECT)
return;
EGLint num_configs;
@ -136,15 +136,15 @@ bool cInterfaceEGL::Create(void *window_handle, bool core)
};
switch (s_opengl_mode)
{
case MODE_OPENGL:
case GLInterfaceMode::MODE_OPENGL:
attribs[1] = EGL_OPENGL_BIT;
ctx_attribs[0] = EGL_NONE;
break;
case MODE_OPENGLES2:
case GLInterfaceMode::MODE_OPENGLES2:
attribs[1] = EGL_OPENGL_ES2_BIT;
ctx_attribs[1] = 2;
break;
case MODE_OPENGLES3:
case GLInterfaceMode::MODE_OPENGLES3:
attribs[1] = (1 << 6); /* EGL_OPENGL_ES3_BIT_KHR */
ctx_attribs[1] = 3;
break;
@ -160,7 +160,7 @@ bool cInterfaceEGL::Create(void *window_handle, bool core)
exit(1);
}
if (s_opengl_mode == MODE_OPENGL)
if (s_opengl_mode == GLInterfaceMode::MODE_OPENGL)
eglBindAPI(EGL_OPENGL_API);
else
eglBindAPI(EGL_OPENGL_ES_API);

View File

@ -23,7 +23,7 @@ protected:
public:
void Swap() override;
void SwapInterval(int interval) override;
void SetMode(u32 mode) override { s_opengl_mode = mode; }
void SetMode(GLInterfaceMode mode) override { s_opengl_mode = mode; }
void* GetFuncAddress(const std::string& name) override;
bool Create(void* window_handle, bool core) override;
bool MakeCurrent() override;

View File

@ -9,8 +9,9 @@
#include "Common/CommonTypes.h"
enum GLInterfaceMode {
MODE_DETECT = 0,
enum class GLInterfaceMode
{
MODE_DETECT,
MODE_OPENGL,
MODE_OPENGLES2,
MODE_OPENGLES3,
@ -23,12 +24,12 @@ protected:
u32 s_backbuffer_width = 0;
u32 s_backbuffer_height = 0;
u32 s_opengl_mode = GLInterfaceMode::MODE_DETECT;
GLInterfaceMode s_opengl_mode = GLInterfaceMode::MODE_DETECT;
public:
virtual ~cInterfaceBase() {}
virtual void Swap() {}
virtual void SetMode(u32 mode) { s_opengl_mode = GLInterfaceMode::MODE_OPENGL; }
virtual u32 GetMode() { return s_opengl_mode; }
virtual void SetMode(GLInterfaceMode mode) { s_opengl_mode = GLInterfaceMode::MODE_OPENGL; }
virtual GLInterfaceMode GetMode() { return s_opengl_mode; }
virtual void* GetFuncAddress(const std::string& name) { return nullptr; }
virtual bool Create(void *window_handle, bool core = true) { return true; }
virtual bool MakeCurrent() { return true; }