2010-04-25 00:31:27 +00:00
|
|
|
/*
|
2014-09-07 15:27:49 +00:00
|
|
|
* Copyright (C) 2011-2014 Gregory hainaut
|
2009-02-09 21:15:56 +00:00
|
|
|
* Copyright (C) 2007-2009 Gabest
|
|
|
|
* http://www.gabest.org
|
|
|
|
*
|
|
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* This Program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
2012-09-09 18:16:11 +00:00
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
2009-02-09 21:15:56 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
2013-01-04 15:47:11 +00:00
|
|
|
|
|
|
|
#include "stdafx.h"
|
2013-06-16 08:43:50 +00:00
|
|
|
#include "GSWnd.h"
|
|
|
|
|
|
|
|
void GSWndGL::PopulateGlFunction()
|
|
|
|
{
|
2015-10-18 09:16:54 +00:00
|
|
|
*(void**)&(gl_BlendColor) = GetProcAddress("glBlendColor");
|
|
|
|
|
2016-03-10 21:22:33 +00:00
|
|
|
// Load mandatory function pointer
|
2016-05-16 16:45:04 +00:00
|
|
|
#define GL_EXT_LOAD(ext) *(void**)&(ext) = GetProcAddress(#ext, false)
|
2016-03-10 21:22:33 +00:00
|
|
|
// Load extra function pointer
|
2016-05-16 16:45:04 +00:00
|
|
|
#define GL_EXT_LOAD_OPT(ext) *(void**)&(ext) = GetProcAddress(#ext, true)
|
2016-03-10 21:22:33 +00:00
|
|
|
|
|
|
|
GL_EXT_LOAD(glBlendEquationSeparate);
|
|
|
|
GL_EXT_LOAD(glBlendFuncSeparate);
|
|
|
|
GL_EXT_LOAD(glAttachShader);
|
|
|
|
GL_EXT_LOAD(glBindBuffer);
|
|
|
|
GL_EXT_LOAD(glBindBufferBase);
|
|
|
|
GL_EXT_LOAD(glBindBufferRange);
|
|
|
|
GL_EXT_LOAD(glBindFramebuffer);
|
|
|
|
GL_EXT_LOAD(glBindSampler);
|
|
|
|
GL_EXT_LOAD(glBindVertexArray);
|
|
|
|
GL_EXT_LOAD(glBlitFramebuffer);
|
|
|
|
GL_EXT_LOAD(glBufferData);
|
|
|
|
GL_EXT_LOAD(glCheckFramebufferStatus);
|
|
|
|
GL_EXT_LOAD(glClearBufferfv);
|
|
|
|
GL_EXT_LOAD(glClearBufferiv);
|
|
|
|
GL_EXT_LOAD(glClearBufferuiv);
|
|
|
|
GL_EXT_LOAD(glColorMaski);
|
|
|
|
GL_EXT_LOAD(glDeleteBuffers);
|
|
|
|
GL_EXT_LOAD(glDeleteFramebuffers);
|
|
|
|
GL_EXT_LOAD(glDeleteSamplers);
|
|
|
|
GL_EXT_LOAD(glDeleteVertexArrays);
|
|
|
|
GL_EXT_LOAD(glDetachShader);
|
|
|
|
GL_EXT_LOAD(glDrawBuffers);
|
|
|
|
GL_EXT_LOAD(glDrawElementsBaseVertex);
|
|
|
|
GL_EXT_LOAD(glEnableVertexAttribArray);
|
|
|
|
GL_EXT_LOAD(glFramebufferRenderbuffer);
|
|
|
|
GL_EXT_LOAD(glFramebufferTexture2D);
|
|
|
|
GL_EXT_LOAD(glGenBuffers);
|
|
|
|
GL_EXT_LOAD(glGenFramebuffers);
|
|
|
|
GL_EXT_LOAD(glGenVertexArrays);
|
|
|
|
GL_EXT_LOAD(glGetBufferParameteriv);
|
|
|
|
GL_EXT_LOAD(glGetDebugMessageLogARB);
|
|
|
|
GL_EXT_LOAD(glGetProgramInfoLog);
|
|
|
|
GL_EXT_LOAD(glGetProgramiv);
|
|
|
|
GL_EXT_LOAD(glGetShaderiv);
|
|
|
|
GL_EXT_LOAD(glGetStringi);
|
|
|
|
GL_EXT_LOAD(glIsFramebuffer);
|
|
|
|
GL_EXT_LOAD(glMapBuffer);
|
|
|
|
GL_EXT_LOAD(glMapBufferRange);
|
|
|
|
GL_EXT_LOAD(glProgramParameteri);
|
|
|
|
GL_EXT_LOAD(glSamplerParameterf);
|
|
|
|
GL_EXT_LOAD(glSamplerParameteri);
|
|
|
|
GL_EXT_LOAD(glShaderSource);
|
|
|
|
GL_EXT_LOAD(glUniform1i);
|
|
|
|
GL_EXT_LOAD(glUnmapBuffer);
|
|
|
|
GL_EXT_LOAD(glVertexAttribIPointer);
|
|
|
|
GL_EXT_LOAD(glVertexAttribPointer);
|
|
|
|
GL_EXT_LOAD(glBufferSubData);
|
|
|
|
GL_EXT_LOAD(glFenceSync);
|
|
|
|
GL_EXT_LOAD(glDeleteSync);
|
|
|
|
GL_EXT_LOAD(glClientWaitSync);
|
|
|
|
GL_EXT_LOAD(glFlushMappedBufferRange);
|
2016-03-04 20:42:17 +00:00
|
|
|
// Query object
|
2016-06-26 13:27:57 +00:00
|
|
|
GL_EXT_LOAD_OPT(glBeginQuery);
|
|
|
|
GL_EXT_LOAD_OPT(glEndQuery);
|
|
|
|
GL_EXT_LOAD_OPT(glGetQueryiv);
|
|
|
|
GL_EXT_LOAD_OPT(glGetQueryObjectiv);
|
|
|
|
GL_EXT_LOAD_OPT(glGetQueryObjectuiv);
|
|
|
|
GL_EXT_LOAD_OPT(glQueryCounter);
|
|
|
|
GL_EXT_LOAD_OPT(glGetQueryObjecti64v);
|
|
|
|
GL_EXT_LOAD_OPT(glGetQueryObjectui64v);
|
|
|
|
GL_EXT_LOAD_OPT(glGetInteger64v);
|
|
|
|
GL_EXT_LOAD_OPT(glCreateQueries);
|
|
|
|
GL_EXT_LOAD_OPT(glDeleteQueries);
|
2013-07-06 10:08:52 +00:00
|
|
|
// GL4.1
|
2016-04-07 20:11:35 +00:00
|
|
|
GL_EXT_LOAD(glCreateShaderProgramv);
|
|
|
|
GL_EXT_LOAD(glBindProgramPipeline);
|
|
|
|
GL_EXT_LOAD(glDeleteProgramPipelines);
|
|
|
|
GL_EXT_LOAD(glGetProgramPipelineiv);
|
|
|
|
GL_EXT_LOAD(glGetProgramPipelineInfoLog);
|
|
|
|
GL_EXT_LOAD(glValidateProgramPipeline);
|
|
|
|
GL_EXT_LOAD(glUseProgramStages);
|
2016-03-10 21:22:33 +00:00
|
|
|
GL_EXT_LOAD_OPT(glGetProgramBinary);
|
|
|
|
GL_EXT_LOAD_OPT(glViewportIndexedf);
|
|
|
|
GL_EXT_LOAD_OPT(glViewportIndexedfv);
|
|
|
|
GL_EXT_LOAD_OPT(glScissorIndexed);
|
|
|
|
GL_EXT_LOAD_OPT(glScissorIndexedv);
|
2016-06-01 07:23:48 +00:00
|
|
|
// NO GL4.1 (or broken driver...)
|
2016-03-10 21:22:33 +00:00
|
|
|
GL_EXT_LOAD(glDeleteProgram);
|
2016-06-01 07:23:48 +00:00
|
|
|
GL_EXT_LOAD(glDeleteShader);
|
|
|
|
GL_EXT_LOAD(glCompileShader);
|
|
|
|
GL_EXT_LOAD(glCreateProgram);
|
|
|
|
GL_EXT_LOAD(glCreateShader);
|
|
|
|
GL_EXT_LOAD(glUseProgram);
|
|
|
|
GL_EXT_LOAD(glGetShaderInfoLog);
|
|
|
|
GL_EXT_LOAD(glLinkProgram);
|
2013-07-28 14:40:43 +00:00
|
|
|
// GL4.2
|
2016-03-10 21:22:33 +00:00
|
|
|
GL_EXT_LOAD_OPT(glBindImageTexture);
|
|
|
|
GL_EXT_LOAD_OPT(glMemoryBarrier);
|
2013-08-03 08:29:01 +00:00
|
|
|
// GL4.3
|
2017-04-05 17:35:00 +00:00
|
|
|
GL_EXT_LOAD_OPT(glCopyImageSubData);
|
2016-03-10 21:22:33 +00:00
|
|
|
GL_EXT_LOAD_OPT(glInvalidateTexImage);
|
2016-04-19 21:03:42 +00:00
|
|
|
GL_EXT_LOAD(glPushDebugGroup);
|
|
|
|
GL_EXT_LOAD(glPopDebugGroup);
|
|
|
|
GL_EXT_LOAD(glDebugMessageInsert);
|
|
|
|
GL_EXT_LOAD(glDebugMessageControl);
|
|
|
|
GL_EXT_LOAD(glDebugMessageCallback);
|
2016-06-07 17:49:48 +00:00
|
|
|
GL_EXT_LOAD(glObjectLabel);
|
|
|
|
GL_EXT_LOAD(glObjectPtrLabel);
|
2013-08-03 08:29:01 +00:00
|
|
|
// GL4.4
|
2016-03-10 21:22:33 +00:00
|
|
|
GL_EXT_LOAD_OPT(glClearTexImage);
|
2016-05-15 11:11:21 +00:00
|
|
|
GL_EXT_LOAD_OPT(glClearTexSubImage);
|
2016-04-07 20:17:22 +00:00
|
|
|
GL_EXT_LOAD(glBufferStorage);
|
2013-08-17 08:57:52 +00:00
|
|
|
|
2014-09-07 15:27:49 +00:00
|
|
|
// GL4.5
|
2017-02-17 16:44:26 +00:00
|
|
|
GL_EXT_LOAD_OPT(glCreateTextures);
|
|
|
|
GL_EXT_LOAD_OPT(glTextureStorage2D);
|
|
|
|
GL_EXT_LOAD_OPT(glTextureSubImage2D);
|
|
|
|
GL_EXT_LOAD_OPT(glCopyTextureSubImage2D);
|
|
|
|
GL_EXT_LOAD_OPT(glBindTextureUnit);
|
|
|
|
GL_EXT_LOAD_OPT(glGetTextureImage);
|
|
|
|
GL_EXT_LOAD_OPT(glTextureParameteri);
|
|
|
|
GL_EXT_LOAD_OPT(glGenerateTextureMipmap);
|
2014-09-07 15:27:49 +00:00
|
|
|
|
2017-02-17 16:44:26 +00:00
|
|
|
GL_EXT_LOAD_OPT(glCreateFramebuffers);
|
|
|
|
GL_EXT_LOAD_OPT(glClearNamedFramebufferfv);
|
|
|
|
GL_EXT_LOAD_OPT(glClearNamedFramebufferuiv);
|
|
|
|
GL_EXT_LOAD_OPT(glClearNamedFramebufferiv);
|
|
|
|
GL_EXT_LOAD_OPT(glNamedFramebufferTexture);
|
|
|
|
GL_EXT_LOAD_OPT(glNamedFramebufferDrawBuffers);
|
|
|
|
GL_EXT_LOAD_OPT(glNamedFramebufferReadBuffer);
|
2016-04-07 21:29:03 +00:00
|
|
|
GL_EXT_LOAD_OPT(glNamedFramebufferParameteri);
|
2017-02-17 16:44:26 +00:00
|
|
|
GL_EXT_LOAD_OPT(glCheckNamedFramebufferStatus);
|
2014-09-07 15:27:49 +00:00
|
|
|
|
2017-02-17 16:44:26 +00:00
|
|
|
GL_EXT_LOAD_OPT(glCreateBuffers);
|
|
|
|
GL_EXT_LOAD_OPT(glNamedBufferStorage);
|
|
|
|
GL_EXT_LOAD_OPT(glNamedBufferData);
|
|
|
|
GL_EXT_LOAD_OPT(glNamedBufferSubData);
|
|
|
|
GL_EXT_LOAD_OPT(glMapNamedBuffer);
|
|
|
|
GL_EXT_LOAD_OPT(glMapNamedBufferRange);
|
|
|
|
GL_EXT_LOAD_OPT(glUnmapNamedBuffer);
|
|
|
|
GL_EXT_LOAD_OPT(glFlushMappedNamedBufferRange);
|
2014-09-07 15:27:49 +00:00
|
|
|
|
2017-02-18 18:43:44 +00:00
|
|
|
GL_EXT_LOAD_OPT(glCreateSamplers);
|
|
|
|
GL_EXT_LOAD_OPT(glCreateProgramPipelines);
|
2014-09-07 15:27:49 +00:00
|
|
|
|
2017-04-04 16:37:26 +00:00
|
|
|
GL_EXT_LOAD_OPT(glClipControl);
|
2017-02-18 19:11:56 +00:00
|
|
|
GL_EXT_LOAD_OPT(glTextureBarrier);
|
2016-05-16 16:45:47 +00:00
|
|
|
GL_EXT_LOAD_OPT(glGetTextureSubImage);
|
2017-02-17 16:44:26 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
*(void**)&(gl_ActiveTexture) = GetProcAddress("glActiveTexture");
|
|
|
|
GL_EXT_LOAD(glTexStorage2D);
|
|
|
|
GL_EXT_LOAD(glGenSamplers);
|
|
|
|
GL_EXT_LOAD(glGenProgramPipelines);
|
|
|
|
GL_EXT_LOAD(glGenerateMipmap);
|
|
|
|
#endif
|
2017-02-22 20:31:14 +00:00
|
|
|
|
|
|
|
// Check openGL requirement as soon as possible so we can switch to another
|
|
|
|
// renderer/device
|
2017-05-11 20:35:31 +00:00
|
|
|
GLLoader::check_gl_requirements();
|
2013-06-16 08:43:50 +00:00
|
|
|
}
|