From 76542f89c9254511c5bdd09a4b4300ccfb0a26b4 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut" Date: Tue, 3 Jan 2012 17:17:04 +0000 Subject: [PATCH] gsdx-ogl: code seems compatible with an opengl 3.3 context. Only load some shader extensions. git-svn-id: http://pcsx2.googlecode.com/svn/branches/gsdx-ogl@5041 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GSDeviceOGL.cpp | 18 +++++++++++++++--- plugins/GSdx/GSWnd.cpp | 4 ++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index 60f7e6e4f1..0e7071692b 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -203,8 +203,20 @@ bool GSDeviceOGL::Create(GSWnd* wnd) // Note: 4.2 crash on latest nvidia drivers! // So only check 4.1 // if ( (major < 4) || ( major == 4 && minor < 2 ) ) return false; - if ( (major < 4) || ( major == 4 && minor < 1 ) ) return false; + // if ( (major < 4) || ( major == 4 && minor < 1 ) ) return false; + if ( (major < 3) || ( major == 3 && minor < 3 ) ) { + fprintf(stderr, "OPENGL 3.3 is not supported\n"); + return false; + } + if ( !glewIsSupported("GL_ARB_separate_shader_objects")) { + fprintf(stderr, "GL_ARB_separate_shader_objects is not supported\n"); + return false; + } + if ( !glewIsSupported("GL_ARB_shading_language_420pack")) { + fprintf(stderr, "GL_ARB_shading_language_420pack is not supported\n"); + return false; + } } @@ -1164,8 +1176,8 @@ void GSDeviceOGL::CompileShaderFromSource(const std::string& glsl_file, const st // Build a header string // ***************************************************** // First select the version (must be the first line so we need to generate it - //std::string version = "#version 410\n#extension GL_ARB_shading_language_420pack: enable\n"; - std::string version = "#version 420\n"; + std::string version = "#version 330\n#extension GL_ARB_shading_language_420pack: enable\n#extension GL_ARB_separate_shader_objects : enable\n"; + //std::string version = "#version 420\n"; // Allow to puts several shader in 1 files std::string shader_type; diff --git a/plugins/GSdx/GSWnd.cpp b/plugins/GSdx/GSWnd.cpp index cefeba6e55..a977aba0f2 100644 --- a/plugins/GSdx/GSWnd.cpp +++ b/plugins/GSdx/GSWnd.cpp @@ -369,9 +369,9 @@ bool GSWnd::Attach(void* handle, bool managed) // Create a context int context_attribs[] = { - GLX_CONTEXT_MAJOR_VERSION_ARB, 4, + GLX_CONTEXT_MAJOR_VERSION_ARB, 3, // Note: 4.2 crash on latest nvidia drivers! - GLX_CONTEXT_MINOR_VERSION_ARB, 1, + GLX_CONTEXT_MINOR_VERSION_ARB, 3, // FIXME : Request a debug context to ease opengl development // Note: don't support deprecated feature (pre openg 3.1) //GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB | GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB,