gsdx-ogl: Make GL_ARB_draw_buffers_blend optinal for limited DX10 drivers

This commit is contained in:
Gregory Hainaut 2015-06-10 22:55:27 +02:00
parent 72b828ef0d
commit 237ffcf796
4 changed files with 18 additions and 6 deletions

View File

@ -84,6 +84,8 @@ PFNGLFENCESYNCPROC gl_FenceSync = NU
PFNGLDELETESYNCPROC gl_DeleteSync = NULL; PFNGLDELETESYNCPROC gl_DeleteSync = NULL;
PFNGLCLIENTWAITSYNCPROC gl_ClientWaitSync = NULL; PFNGLCLIENTWAITSYNCPROC gl_ClientWaitSync = NULL;
PFNGLFLUSHMAPPEDBUFFERRANGEPROC gl_FlushMappedBufferRange = NULL; PFNGLFLUSHMAPPEDBUFFERRANGEPROC gl_FlushMappedBufferRange = NULL;
PFNGLBLENDEQUATIONSEPARATEPROC gl_BlendEquationSeparate = NULL;
PFNGLBLENDFUNCSEPARATEPROC gl_BlendFuncSeparate = NULL;
// GL4.0 // GL4.0
PFNGLUNIFORMSUBROUTINESUIVPROC gl_UniformSubroutinesuiv = NULL; PFNGLUNIFORMSUBROUTINESUIVPROC gl_UniformSubroutinesuiv = NULL;
// GL4.1 // GL4.1
@ -326,6 +328,7 @@ namespace GLLoader {
bool found_geometry_shader = true; // we require GL3.3 so geometry must be supported by default bool found_geometry_shader = true; // we require GL3.3 so geometry must be supported by default
bool found_GL_EXT_texture_filter_anisotropic = false; bool found_GL_EXT_texture_filter_anisotropic = false;
bool found_GL_ARB_clear_texture = false; // Don't know if GL3 GPU can support it bool found_GL_ARB_clear_texture = false; // Don't know if GL3 GPU can support it
bool found_GL_ARB_draw_buffers_blend = false; // DX10 GPU limited driver on windows!
// Note: except Apple, all drivers support explicit uniform location // Note: except Apple, all drivers support explicit uniform location
bool found_GL_ARB_explicit_uniform_location = false; // need by subroutine and bindless texture bool found_GL_ARB_explicit_uniform_location = false; // need by subroutine and bindless texture
@ -345,7 +348,6 @@ namespace GLLoader {
// Mandatory // Mandatory
bool found_GL_ARB_texture_storage = false; bool found_GL_ARB_texture_storage = false;
bool found_GL_ARB_shading_language_420pack = false; bool found_GL_ARB_shading_language_420pack = false;
bool found_GL_ARB_draw_buffers_blend = false; // could be easily be optional, but I'm lazy
static bool status_and_override(bool& found, const std::string& name, bool mandatory = false) static bool status_and_override(bool& found, const std::string& name, bool mandatory = false)
{ {
@ -475,7 +477,7 @@ namespace GLLoader {
status &= status_and_override(found_GL_EXT_texture_filter_anisotropic, "GL_EXT_texture_filter_anisotropic"); status &= status_and_override(found_GL_EXT_texture_filter_anisotropic, "GL_EXT_texture_filter_anisotropic");
// GL4.0 // GL4.0
status &= status_and_override(found_GL_ARB_gpu_shader5, "GL_ARB_gpu_shader5"); status &= status_and_override(found_GL_ARB_gpu_shader5, "GL_ARB_gpu_shader5");
status &= status_and_override(found_GL_ARB_draw_buffers_blend, "GL_ARB_draw_buffers_blend", true); status &= status_and_override(found_GL_ARB_draw_buffers_blend, "GL_ARB_draw_buffers_blend");
// GL4.1 // GL4.1
status &= status_and_override(found_GL_ARB_separate_shader_objects, "GL_ARB_separate_shader_objects"); status &= status_and_override(found_GL_ARB_separate_shader_objects, "GL_ARB_separate_shader_objects");
status &= status_and_override(found_GL_ARB_shader_subroutine, "GL_ARB_shader_subroutine"); status &= status_and_override(found_GL_ARB_shader_subroutine, "GL_ARB_shader_subroutine");

View File

@ -268,6 +268,8 @@ extern PFNGLFENCESYNCPROC gl_FenceSync;
extern PFNGLDELETESYNCPROC gl_DeleteSync; extern PFNGLDELETESYNCPROC gl_DeleteSync;
extern PFNGLCLIENTWAITSYNCPROC gl_ClientWaitSync; extern PFNGLCLIENTWAITSYNCPROC gl_ClientWaitSync;
extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC gl_FlushMappedBufferRange; extern PFNGLFLUSHMAPPEDBUFFERRANGEPROC gl_FlushMappedBufferRange;
extern PFNGLBLENDEQUATIONSEPARATEPROC gl_BlendEquationSeparate;
extern PFNGLBLENDFUNCSEPARATEPROC gl_BlendFuncSeparate;
// GL4.0 // GL4.0
extern PFNGLUNIFORMSUBROUTINESUIVPROC gl_UniformSubroutinesuiv; extern PFNGLUNIFORMSUBROUTINESUIVPROC gl_UniformSubroutinesuiv;
// GL4.1 // GL4.1

View File

@ -99,12 +99,18 @@ public:
if (GLState::eq_RGB != m_equation_RGB) { if (GLState::eq_RGB != m_equation_RGB) {
GLState::eq_RGB = m_equation_RGB; GLState::eq_RGB = m_equation_RGB;
gl_BlendEquationSeparateiARB(0, m_equation_RGB, GL_FUNC_ADD); if (gl_BlendEquationSeparateiARB)
gl_BlendEquationSeparateiARB(0, m_equation_RGB, GL_FUNC_ADD);
else
gl_BlendEquationSeparate(m_equation_RGB, GL_FUNC_ADD);
} }
if (GLState::f_sRGB != m_func_sRGB || GLState::f_dRGB != m_func_dRGB) { if (GLState::f_sRGB != m_func_sRGB || GLState::f_dRGB != m_func_dRGB) {
GLState::f_sRGB = m_func_sRGB; GLState::f_sRGB = m_func_sRGB;
GLState::f_dRGB = m_func_dRGB; GLState::f_dRGB = m_func_dRGB;
gl_BlendFuncSeparateiARB(0, m_func_sRGB, m_func_dRGB, GL_ONE, GL_ZERO); if (gl_BlendFuncSeparateiARB)
gl_BlendFuncSeparateiARB(0, m_func_sRGB, m_func_dRGB, GL_ONE, GL_ZERO);
else
gl_BlendFuncSeparate(m_func_sRGB, m_func_dRGB, GL_ONE, GL_ZERO);
} }
} }
} }

View File

@ -27,14 +27,14 @@ void GSWndGL::PopulateGlFunction()
{ {
*(void**)&(gl_ActiveTexture) = GetProcAddress("glActiveTexture"); *(void**)&(gl_ActiveTexture) = GetProcAddress("glActiveTexture");
*(void**)&(gl_BlendColor) = GetProcAddress("glBlendColor"); *(void**)&(gl_BlendColor) = GetProcAddress("glBlendColor");
*(void**)&(gl_BlendEquationSeparate) = GetProcAddress("glBlendEquationSeparate");
*(void**)&(gl_BlendFuncSeparate) = GetProcAddress("glBlendFuncSeparate");
*(void**)&(gl_AttachShader) = GetProcAddress("glAttachShader"); *(void**)&(gl_AttachShader) = GetProcAddress("glAttachShader");
*(void**)&(gl_BindBuffer) = GetProcAddress("glBindBuffer"); *(void**)&(gl_BindBuffer) = GetProcAddress("glBindBuffer");
*(void**)&(gl_BindBufferBase) = GetProcAddress("glBindBufferBase"); *(void**)&(gl_BindBufferBase) = GetProcAddress("glBindBufferBase");
*(void**)&(gl_BindFramebuffer) = GetProcAddress("glBindFramebuffer"); *(void**)&(gl_BindFramebuffer) = GetProcAddress("glBindFramebuffer");
*(void**)&(gl_BindSampler) = GetProcAddress("glBindSampler"); *(void**)&(gl_BindSampler) = GetProcAddress("glBindSampler");
*(void**)&(gl_BindVertexArray) = GetProcAddress("glBindVertexArray"); *(void**)&(gl_BindVertexArray) = GetProcAddress("glBindVertexArray");
*(void**)&(gl_BlendEquationSeparateiARB) = GetProcAddress("glBlendEquationSeparateiARB");
*(void**)&(gl_BlendFuncSeparateiARB) = GetProcAddress("glBlendFuncSeparateiARB");
*(void**)&(gl_BlitFramebuffer) = GetProcAddress("glBlitFramebuffer"); *(void**)&(gl_BlitFramebuffer) = GetProcAddress("glBlitFramebuffer");
*(void**)&(gl_BufferData) = GetProcAddress("glBufferData"); *(void**)&(gl_BufferData) = GetProcAddress("glBufferData");
*(void**)&(gl_CheckFramebufferStatus) = GetProcAddress("glCheckFramebufferStatus"); *(void**)&(gl_CheckFramebufferStatus) = GetProcAddress("glCheckFramebufferStatus");
@ -81,6 +81,8 @@ void GSWndGL::PopulateGlFunction()
*(void**)&(gl_FlushMappedBufferRange) = GetProcAddress("glFlushMappedBufferRange"); *(void**)&(gl_FlushMappedBufferRange) = GetProcAddress("glFlushMappedBufferRange");
// GL4.0 // GL4.0
*(void**)&(gl_UniformSubroutinesuiv) = GetProcAddress("glUniformSubroutinesuiv", true); *(void**)&(gl_UniformSubroutinesuiv) = GetProcAddress("glUniformSubroutinesuiv", true);
*(void**)&(gl_BlendEquationSeparateiARB) = GetProcAddress("glBlendEquationSeparateiARB", true);
*(void**)&(gl_BlendFuncSeparateiARB) = GetProcAddress("glBlendFuncSeparateiARB", true);
// GL4.1 // GL4.1
*(void**)&(gl_CreateShaderProgramv) = GetProcAddress("glCreateShaderProgramv", true); *(void**)&(gl_CreateShaderProgramv) = GetProcAddress("glCreateShaderProgramv", true);
*(void**)&(gl_BindProgramPipeline) = GetProcAddress("glBindProgramPipeline", true); *(void**)&(gl_BindProgramPipeline) = GetProcAddress("glBindProgramPipeline", true);