mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
GLUtil: Encapsulate functions in a namespace
This commit is contained in:
@ -11,12 +11,14 @@
|
|||||||
|
|
||||||
std::unique_ptr<cInterfaceBase> GLInterface;
|
std::unique_ptr<cInterfaceBase> GLInterface;
|
||||||
|
|
||||||
|
namespace GLUtil
|
||||||
|
{
|
||||||
void InitInterface()
|
void InitInterface()
|
||||||
{
|
{
|
||||||
GLInterface = HostGL_CreateGLInterface();
|
GLInterface = HostGL_CreateGLInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint OpenGL_CompileProgram(const std::string& vertexShader, const std::string& fragmentShader)
|
GLuint CompileProgram(const std::string& vertexShader, const std::string& fragmentShader)
|
||||||
{
|
{
|
||||||
// generate objects
|
// generate objects
|
||||||
GLuint vertexShaderID = glCreateShader(GL_VERTEX_SHADER);
|
GLuint vertexShaderID = glCreateShader(GL_VERTEX_SHADER);
|
||||||
@ -100,3 +102,4 @@ GLuint OpenGL_CompileProgram(const std::string& vertexShader, const std::string&
|
|||||||
|
|
||||||
return programID;
|
return programID;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
@ -8,12 +8,8 @@
|
|||||||
|
|
||||||
#include "Common/GL/GLExtensions/GLExtensions.h"
|
#include "Common/GL/GLExtensions/GLExtensions.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
namespace GLUtil
|
||||||
|
{
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#endif
|
|
||||||
void InitInterface();
|
void InitInterface();
|
||||||
|
GLuint CompileProgram(const std::string& vertexShader, const std::string& fragmentShader);
|
||||||
// Helpers
|
}
|
||||||
GLuint OpenGL_CompileProgram(const std::string& vertexShader, const std::string& fragmentShader);
|
|
||||||
|
@ -160,7 +160,7 @@ bool VideoBackend::Initialize(void* window_handle)
|
|||||||
InitBackendInfo();
|
InitBackendInfo();
|
||||||
InitializeShared();
|
InitializeShared();
|
||||||
|
|
||||||
InitInterface();
|
GLUtil::InitInterface();
|
||||||
GLInterface->SetMode(GLInterfaceMode::MODE_DETECT);
|
GLInterface->SetMode(GLInterfaceMode::MODE_DETECT);
|
||||||
if (!GLInterface->Create(window_handle, g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer))
|
if (!GLInterface->Create(window_handle, g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer))
|
||||||
return false;
|
return false;
|
||||||
|
@ -15,7 +15,7 @@ std::unique_ptr<SWOGLWindow> SWOGLWindow::s_instance;
|
|||||||
|
|
||||||
void SWOGLWindow::Init(void* window_handle)
|
void SWOGLWindow::Init(void* window_handle)
|
||||||
{
|
{
|
||||||
InitInterface();
|
GLUtil::InitInterface();
|
||||||
GLInterface->SetMode(GLInterfaceMode::MODE_DETECT);
|
GLInterface->SetMode(GLInterfaceMode::MODE_DETECT);
|
||||||
if (!GLInterface->Create(window_handle))
|
if (!GLInterface->Create(window_handle))
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ void SWOGLWindow::Prepare()
|
|||||||
"#version 300 es\n"
|
"#version 300 es\n"
|
||||||
"precision highp float;\n";
|
"precision highp float;\n";
|
||||||
|
|
||||||
m_image_program = OpenGL_CompileProgram(header + vertex_shader, header + frag_shader);
|
m_image_program = GLUtil::CompileProgram(header + vertex_shader, header + frag_shader);
|
||||||
|
|
||||||
glUseProgram(m_image_program);
|
glUseProgram(m_image_program);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user