mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
GLUtil: Encapsulate functions in a namespace
This commit is contained in:
parent
e31cc1f679
commit
51a586d11a
@ -11,12 +11,14 @@
|
||||
|
||||
std::unique_ptr<cInterfaceBase> GLInterface;
|
||||
|
||||
namespace GLUtil
|
||||
{
|
||||
void InitInterface()
|
||||
{
|
||||
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
|
||||
GLuint vertexShaderID = glCreateShader(GL_VERTEX_SHADER);
|
||||
@ -100,3 +102,4 @@ GLuint OpenGL_CompileProgram(const std::string& vertexShader, const std::string&
|
||||
|
||||
return programID;
|
||||
}
|
||||
}
|
||||
|
@ -8,12 +8,8 @@
|
||||
|
||||
#include "Common/GL/GLExtensions/GLExtensions.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#endif
|
||||
namespace GLUtil
|
||||
{
|
||||
void InitInterface();
|
||||
|
||||
// Helpers
|
||||
GLuint OpenGL_CompileProgram(const std::string& vertexShader, const std::string& fragmentShader);
|
||||
GLuint CompileProgram(const std::string& vertexShader, const std::string& fragmentShader);
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ bool VideoBackend::Initialize(void* window_handle)
|
||||
InitBackendInfo();
|
||||
InitializeShared();
|
||||
|
||||
InitInterface();
|
||||
GLUtil::InitInterface();
|
||||
GLInterface->SetMode(GLInterfaceMode::MODE_DETECT);
|
||||
if (!GLInterface->Create(window_handle, g_ActiveConfig.stereo_mode == StereoMode::QuadBuffer))
|
||||
return false;
|
||||
|
@ -15,7 +15,7 @@ std::unique_ptr<SWOGLWindow> SWOGLWindow::s_instance;
|
||||
|
||||
void SWOGLWindow::Init(void* window_handle)
|
||||
{
|
||||
InitInterface();
|
||||
GLUtil::InitInterface();
|
||||
GLInterface->SetMode(GLInterfaceMode::MODE_DETECT);
|
||||
if (!GLInterface->Create(window_handle))
|
||||
{
|
||||
@ -71,7 +71,7 @@ void SWOGLWindow::Prepare()
|
||||
"#version 300 es\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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user