From 8a723b3be8f065bdb82fdb78d53c35cc1fbb4763 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Fri, 1 Feb 2019 11:34:59 +0100 Subject: [PATCH] gsdx-ogl: clean partially the GL1 mess Remaining will require a move to glcorearb.h --- plugins/GSdx/Renderers/OpenGL/GLLoader.cpp | 7 +++--- plugins/GSdx/Renderers/OpenGL/GLLoader.h | 23 ++++++++++--------- plugins/GSdx/Renderers/OpenGL/GSDeviceOGL.cpp | 2 +- plugins/GSdx/Window/GSWnd.cpp | 4 +--- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/plugins/GSdx/Renderers/OpenGL/GLLoader.cpp b/plugins/GSdx/Renderers/OpenGL/GLLoader.cpp index 9d29d8313d..3588a4c78e 100644 --- a/plugins/GSdx/Renderers/OpenGL/GLLoader.cpp +++ b/plugins/GSdx/Renderers/OpenGL/GLLoader.cpp @@ -23,10 +23,9 @@ #include "GSdx.h" #include "GS.h" -// GL1.x mess -PFNGLBLENDCOLORPROC gl_BlendColor = NULL; -PFNGLACTIVETEXTUREPROC gl_ActiveTexture = NULL; +#ifdef __unix__ PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate = NULL; +#endif #include "PFN_GLLOADER_CPP.h" @@ -52,7 +51,7 @@ namespace ReplaceGL { namespace Emulate_DSA { // Texture entry point void APIENTRY BindTextureUnit(GLuint unit, GLuint texture) { - gl_ActiveTexture(GL_TEXTURE0 + unit); + glActiveTexture(GL_TEXTURE0 + unit); glBindTexture(GL_TEXTURE_2D, texture); } diff --git a/plugins/GSdx/Renderers/OpenGL/GLLoader.h b/plugins/GSdx/Renderers/OpenGL/GLLoader.h index fa72c1b710..ca91311c8b 100644 --- a/plugins/GSdx/Renderers/OpenGL/GLLoader.h +++ b/plugins/GSdx/Renderers/OpenGL/GLLoader.h @@ -221,14 +221,17 @@ typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, // #define ENABLE_GL_KHR_blend_equation_advanced 1 // #define ENABLE_GL_KHR_parallel_shader_compile 1 -// Dark age of openGL. Potentially it should be fixed with a migration -// to the new header glcorearb.h. But we need to check old distribution -// support first +// Dark age of openGL. GL_10 and GL_11 are provided by opengl32.dll on windows. +// Linux is a royal mess +// // #define ENABLE_GL_VERSION_1_0 1 // #define ENABLE_GL_VERSION_1_1 1 -// #define ENABLE_GL_VERSION_1_2 1 -// #define ENABLE_GL_VERSION_1_3 1 -// #define ENABLE_GL_VERSION_1_4 1 +#ifdef _WIN32 +#define ENABLE_GL_VERSION_1_2 1 +#define ENABLE_GL_VERSION_1_3 1 +#define ENABLE_GL_VERSION_1_4 1 +#endif + #define ENABLE_GL_VERSION_1_5 1 #define ENABLE_GL_VERSION_2_0 1 #define ENABLE_GL_VERSION_2_1 1 @@ -244,12 +247,10 @@ typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, #define ENABLE_GL_VERSION_4_5 1 // #define ENABLE_GL_VERSION_4_6 1 -// Note: glActiveTexture & glBlendColor aren't included in the win GL ABI. -// (maybe gl.h is outdated, or my setup is wrong) -// Anyway, let's just keep the mangled function pointer for those 2 functions. -extern PFNGLBLENDCOLORPROC gl_BlendColor; -extern PFNGLACTIVETEXTUREPROC gl_ActiveTexture; +// It should be done by ENABLE_GL_VERSION_1_4 but it conflicts with the old gl.h +#ifdef __unix__ extern PFNGLBLENDFUNCSEPARATEPROC glBlendFuncSeparate; +#endif #include "PFN_GLLOADER_HPP.h" diff --git a/plugins/GSdx/Renderers/OpenGL/GSDeviceOGL.cpp b/plugins/GSdx/Renderers/OpenGL/GSDeviceOGL.cpp index 4570af6e59..a0064bc541 100644 --- a/plugins/GSdx/Renderers/OpenGL/GSDeviceOGL.cpp +++ b/plugins/GSdx/Renderers/OpenGL/GSDeviceOGL.cpp @@ -1719,7 +1719,7 @@ void GSDeviceOGL::OMSetBlendState(uint8 blend_index, uint8 blend_factor, bool is if (is_blend_constant && GLState::bf != blend_factor) { GLState::bf = blend_factor; float bf = (float)blend_factor / 128.0f; - gl_BlendColor(bf, bf, bf, bf); + glBlendColor(bf, bf, bf, bf); } OGLBlend b = m_blendMapOGL[blend_index]; diff --git a/plugins/GSdx/Window/GSWnd.cpp b/plugins/GSdx/Window/GSWnd.cpp index 2cd7eb304e..82ad34d875 100644 --- a/plugins/GSdx/Window/GSWnd.cpp +++ b/plugins/GSdx/Window/GSWnd.cpp @@ -33,10 +33,8 @@ void GSWndGL::PopulateGlFunction() #include "PFN_WND.h" // GL1.X mess - *(void**)&(gl_BlendColor) = GetProcAddress("glBlendColor"); +#ifdef __unix__ GL_EXT_LOAD(glBlendFuncSeparate); -#ifdef _WIN32 - *(void**)&(gl_ActiveTexture) = GetProcAddress("glActiveTexture"); #endif // Check openGL requirement as soon as possible so we can switch to another