2007-11-27 19:40:25 +00:00
|
|
|
/********************************************************************
|
2007-04-29 17:35:43 +00:00
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
|
|
|
|
|
|
|
Copyright (C) 2007 Rivo Laks <rivolaks@hot.ee>
|
|
|
|
|
2007-11-27 19:40:25 +00:00
|
|
|
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 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*********************************************************************/
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
#include "kwinglutils.h"
|
|
|
|
|
|
|
|
#include <dlfcn.h>
|
|
|
|
|
|
|
|
|
|
|
|
// Resolves given function, using getProcAddress
|
2012-09-29 11:19:35 +00:00
|
|
|
#ifdef KWIN_HAVE_EGL
|
|
|
|
#define GL_RESOLVE( function ) \
|
|
|
|
if (platformInterface == GlxPlatformInterface) \
|
|
|
|
function = (function ## _func)getProcAddress( #function ); \
|
|
|
|
else if (platformInterface == EglPlatformInterface) \
|
|
|
|
function = (function ## _func)eglGetProcAddress( #function );
|
2012-10-03 07:32:25 +00:00
|
|
|
// Same as above but tries to use function "symbolName"
|
|
|
|
// Useful when functionality is defined in an extension with a different name
|
|
|
|
#define GL_RESOLVE_WITH_EXT( function, symbolName ) \
|
2012-09-29 11:19:35 +00:00
|
|
|
if (platformInterface == GlxPlatformInterface) { \
|
2012-10-03 07:32:25 +00:00
|
|
|
function = (function ## _func)getProcAddress( #symbolName ); \
|
2012-09-29 11:19:35 +00:00
|
|
|
} else if (platformInterface == EglPlatformInterface) { \
|
2012-10-03 07:32:25 +00:00
|
|
|
function = (function ## _func)eglGetProcAddress( #symbolName ); \
|
2012-09-29 11:19:35 +00:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
// same without the switch to egl
|
|
|
|
#define GL_RESOLVE( function ) function = (function ## _func)getProcAddress( #function );
|
|
|
|
|
2012-10-03 07:32:25 +00:00
|
|
|
#define GL_RESOLVE_WITH_EXT( function, symbolName ) \
|
|
|
|
function = (function ## _func)getProcAddress( #symbolName );
|
2012-09-29 11:19:35 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define EGL_RESOLVE( function ) function = (function ## _func)eglGetProcAddress( #function );
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace KWin
|
|
|
|
{
|
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
#ifndef KWIN_HAVE_OPENGLES
|
2007-04-29 17:35:43 +00:00
|
|
|
// Function pointers
|
|
|
|
glXGetProcAddress_func glXGetProcAddress;
|
|
|
|
// GLX 1.3
|
|
|
|
glXQueryDrawable_func glXQueryDrawable;
|
|
|
|
// texture_from_pixmap extension functions
|
|
|
|
glXReleaseTexImageEXT_func glXReleaseTexImageEXT;
|
|
|
|
glXBindTexImageEXT_func glXBindTexImageEXT;
|
|
|
|
// glXCopySubBufferMESA
|
|
|
|
glXCopySubBuffer_func glXCopySubBuffer;
|
|
|
|
// video_sync extension functions
|
|
|
|
glXGetVideoSync_func glXGetVideoSync;
|
|
|
|
glXWaitVideoSync_func glXWaitVideoSync;
|
2012-03-29 20:11:28 +00:00
|
|
|
glXSwapInterval_func glXSwapInterval;
|
2007-10-05 14:10:13 +00:00
|
|
|
|
2007-04-29 17:35:43 +00:00
|
|
|
// glActiveTexture
|
|
|
|
glActiveTexture_func glActiveTexture;
|
|
|
|
// framebuffer_object extension functions
|
|
|
|
glIsRenderbuffer_func glIsRenderbuffer;
|
|
|
|
glBindRenderbuffer_func glBindRenderbuffer;
|
|
|
|
glDeleteRenderbuffers_func glDeleteRenderbuffers;
|
|
|
|
glGenRenderbuffers_func glGenRenderbuffers;
|
|
|
|
glRenderbufferStorage_func glRenderbufferStorage;
|
|
|
|
glGetRenderbufferParameteriv_func glGetRenderbufferParameteriv;
|
|
|
|
glIsFramebuffer_func glIsFramebuffer;
|
|
|
|
glBindFramebuffer_func glBindFramebuffer;
|
|
|
|
glDeleteFramebuffers_func glDeleteFramebuffers;
|
|
|
|
glGenFramebuffers_func glGenFramebuffers;
|
|
|
|
glCheckFramebufferStatus_func glCheckFramebufferStatus;
|
|
|
|
glFramebufferTexture1D_func glFramebufferTexture1D;
|
|
|
|
glFramebufferTexture2D_func glFramebufferTexture2D;
|
|
|
|
glFramebufferTexture3D_func glFramebufferTexture3D;
|
|
|
|
glFramebufferRenderbuffer_func glFramebufferRenderbuffer;
|
|
|
|
glGetFramebufferAttachmentParameteriv_func glGetFramebufferAttachmentParameteriv;
|
|
|
|
glGenerateMipmap_func glGenerateMipmap;
|
2011-08-17 17:32:36 +00:00
|
|
|
glBlitFramebuffer_func glBlitFramebuffer;
|
2007-04-29 17:35:43 +00:00
|
|
|
// Shader functions
|
|
|
|
glCreateShader_func glCreateShader;
|
|
|
|
glShaderSource_func glShaderSource;
|
|
|
|
glCompileShader_func glCompileShader;
|
|
|
|
glDeleteShader_func glDeleteShader;
|
|
|
|
glCreateProgram_func glCreateProgram;
|
|
|
|
glAttachShader_func glAttachShader;
|
|
|
|
glLinkProgram_func glLinkProgram;
|
|
|
|
glUseProgram_func glUseProgram;
|
|
|
|
glDeleteProgram_func glDeleteProgram;
|
|
|
|
glGetShaderInfoLog_func glGetShaderInfoLog;
|
|
|
|
glGetProgramInfoLog_func glGetProgramInfoLog;
|
|
|
|
glGetProgramiv_func glGetProgramiv;
|
|
|
|
glGetShaderiv_func glGetShaderiv;
|
|
|
|
glUniform1f_func glUniform1f;
|
2010-11-14 19:49:00 +00:00
|
|
|
glUniform2f_func glUniform2f;
|
|
|
|
glUniform3f_func glUniform3f;
|
|
|
|
glUniform4f_func glUniform4f;
|
2007-04-29 17:35:43 +00:00
|
|
|
glUniform1i_func glUniform1i;
|
|
|
|
glUniform1fv_func glUniform1fv;
|
|
|
|
glUniform2fv_func glUniform2fv;
|
2010-03-08 20:38:30 +00:00
|
|
|
glUniform3fv_func glUniform3fv;
|
|
|
|
glUniform4fv_func glUniform4fv;
|
2011-01-01 12:30:04 +00:00
|
|
|
glGetUniformfv_func glGetUniformfv;
|
2010-12-04 11:25:49 +00:00
|
|
|
glUniformMatrix4fv_func glUniformMatrix4fv;
|
2007-04-29 17:35:43 +00:00
|
|
|
glValidateProgram_func glValidateProgram;
|
|
|
|
glGetUniformLocation_func glGetUniformLocation;
|
|
|
|
glVertexAttrib1f_func glVertexAttrib1f;
|
|
|
|
glGetAttribLocation_func glGetAttribLocation;
|
2010-11-14 19:49:00 +00:00
|
|
|
glBindAttribLocation_func glBindAttribLocation;
|
2010-03-05 17:26:04 +00:00
|
|
|
glGenProgramsARB_func glGenProgramsARB;
|
|
|
|
glBindProgramARB_func glBindProgramARB;
|
|
|
|
glProgramStringARB_func glProgramStringARB;
|
|
|
|
glProgramLocalParameter4fARB_func glProgramLocalParameter4fARB;
|
|
|
|
glDeleteProgramsARB_func glDeleteProgramsARB;
|
2010-03-10 18:15:04 +00:00
|
|
|
glGetProgramivARB_func glGetProgramivARB;
|
2010-07-19 20:53:32 +00:00
|
|
|
// vertex buffer objects
|
|
|
|
glGenBuffers_func glGenBuffers;
|
|
|
|
glDeleteBuffers_func glDeleteBuffers;
|
|
|
|
glBindBuffer_func glBindBuffer;
|
|
|
|
glBufferData_func glBufferData;
|
2010-11-14 19:49:00 +00:00
|
|
|
glEnableVertexAttribArray_func glEnableVertexAttribArray;
|
|
|
|
glDisableVertexAttribArray_func glDisableVertexAttribArray;
|
|
|
|
glVertexAttribPointer_func glVertexAttribPointer;
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
|
2011-01-30 14:34:42 +00:00
|
|
|
static glXFuncPtr getProcAddress(const char* name)
|
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
glXFuncPtr ret = NULL;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (glXGetProcAddress != NULL)
|
|
|
|
ret = glXGetProcAddress((const GLubyte*) name);
|
|
|
|
if (ret == NULL)
|
|
|
|
ret = (glXFuncPtr) dlsym(RTLD_DEFAULT, name);
|
2007-04-29 17:35:43 +00:00
|
|
|
return ret;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2007-04-29 17:35:43 +00:00
|
|
|
|
|
|
|
void glxResolveFunctions()
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2007-04-29 17:35:43 +00:00
|
|
|
// handle OpenGL extensions functions
|
2011-01-30 14:34:42 +00:00
|
|
|
glXGetProcAddress = (glXGetProcAddress_func) getProcAddress("glXGetProcAddress");
|
|
|
|
if (glXGetProcAddress == NULL)
|
|
|
|
glXGetProcAddress = (glXGetProcAddress_func) getProcAddress("glXGetProcAddressARB");
|
|
|
|
glXQueryDrawable = (glXQueryDrawable_func) getProcAddress("glXQueryDrawable");
|
|
|
|
if (hasGLExtension("GLX_EXT_texture_from_pixmap")) {
|
|
|
|
glXBindTexImageEXT = (glXBindTexImageEXT_func) getProcAddress("glXBindTexImageEXT");
|
|
|
|
glXReleaseTexImageEXT = (glXReleaseTexImageEXT_func) getProcAddress("glXReleaseTexImageEXT");
|
|
|
|
} else {
|
2007-04-29 17:35:43 +00:00
|
|
|
glXBindTexImageEXT = NULL;
|
|
|
|
glXReleaseTexImageEXT = NULL;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (hasGLExtension("GLX_MESA_copy_sub_buffer"))
|
|
|
|
glXCopySubBuffer = (glXCopySubBuffer_func) getProcAddress("glXCopySubBufferMESA");
|
2007-04-29 17:35:43 +00:00
|
|
|
else
|
|
|
|
glXCopySubBuffer = NULL;
|
2011-01-30 14:34:42 +00:00
|
|
|
if (hasGLExtension("GLX_SGI_video_sync")) {
|
|
|
|
glXGetVideoSync = (glXGetVideoSync_func) getProcAddress("glXGetVideoSyncSGI");
|
|
|
|
glXWaitVideoSync = (glXWaitVideoSync_func) getProcAddress("glXWaitVideoSyncSGI");
|
|
|
|
} else {
|
2007-04-29 17:35:43 +00:00
|
|
|
glXGetVideoSync = NULL;
|
|
|
|
glXWaitVideoSync = NULL;
|
|
|
|
}
|
|
|
|
|
2012-03-29 20:11:28 +00:00
|
|
|
if (hasGLExtension("GLX_SGI_swap_control")) {
|
|
|
|
glXSwapInterval = (glXSwapInterval_func) getProcAddress("glXSwapIntervalSGI");
|
|
|
|
} else if (hasGLExtension("GLX_EXT_swap_control")) {
|
|
|
|
glXSwapInterval = (glXSwapInterval_func) getProcAddress("glXSwapIntervalEXT");
|
|
|
|
} else if (hasGLExtension("GLX_MESA_swap_control")) {
|
|
|
|
glXSwapInterval = (glXSwapInterval_func) getProcAddress("glXSwapIntervalMESA");
|
|
|
|
} else if (hasGLExtension("GLX_OML_sync_control")) {
|
|
|
|
glXSwapInterval = (glXSwapInterval_func) getProcAddress("glXSwapIntervalOML");
|
|
|
|
} else {
|
|
|
|
glXSwapInterval = NULL;
|
|
|
|
}
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2012-09-29 11:19:35 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef KWIN_HAVE_EGL
|
|
|
|
|
|
|
|
// EGL
|
|
|
|
eglCreateImageKHR_func eglCreateImageKHR;
|
|
|
|
eglDestroyImageKHR_func eglDestroyImageKHR;
|
|
|
|
eglPostSubBufferNV_func eglPostSubBufferNV;
|
|
|
|
// GLES
|
|
|
|
glEGLImageTargetTexture2DOES_func glEGLImageTargetTexture2DOES;
|
|
|
|
|
|
|
|
void eglResolveFunctions()
|
|
|
|
{
|
|
|
|
if (hasGLExtension("EGL_KHR_image") ||
|
|
|
|
(hasGLExtension("EGL_KHR_image_base") &&
|
|
|
|
hasGLExtension("EGL_KHR_image_pixmap"))) {
|
|
|
|
eglCreateImageKHR = (eglCreateImageKHR_func)eglGetProcAddress("eglCreateImageKHR");
|
|
|
|
eglDestroyImageKHR = (eglDestroyImageKHR_func)eglGetProcAddress("eglDestroyImageKHR");
|
|
|
|
} else {
|
|
|
|
eglCreateImageKHR = NULL;
|
|
|
|
eglDestroyImageKHR = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasGLExtension("EGL_NV_post_sub_buffer")) {
|
|
|
|
eglPostSubBufferNV = (eglPostSubBufferNV_func)eglGetProcAddress("eglPostSubBufferNV");
|
|
|
|
} else {
|
|
|
|
eglPostSubBufferNV = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
2011-01-30 14:34:42 +00:00
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
void glResolveFunctions(OpenGLPlatformInterface platformInterface)
|
2011-01-30 14:34:42 +00:00
|
|
|
{
|
2012-09-29 11:19:35 +00:00
|
|
|
#ifndef KWIN_HAVE_OPENGLES
|
2011-01-30 14:34:42 +00:00
|
|
|
if (hasGLExtension("GL_ARB_multitexture")) {
|
|
|
|
GL_RESOLVE_WITH_EXT(glActiveTexture, glActiveTextureARB);
|
2007-04-29 17:35:43 +00:00
|
|
|
// Get number of texture units
|
|
|
|
glGetIntegerv(GL_MAX_TEXTURE_UNITS, &glTextureUnitsCount);
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2007-04-29 17:35:43 +00:00
|
|
|
glActiveTexture = NULL;
|
|
|
|
glTextureUnitsCount = 0;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2012-10-03 07:32:25 +00:00
|
|
|
|
|
|
|
if (hasGLExtension("GL_ARB_framebuffer_object")) {
|
|
|
|
// see http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt
|
|
|
|
GL_RESOLVE(glIsRenderbuffer);
|
|
|
|
GL_RESOLVE(glBindRenderbuffer);
|
|
|
|
GL_RESOLVE(glDeleteRenderbuffers);
|
|
|
|
GL_RESOLVE(glGenRenderbuffers);
|
|
|
|
|
|
|
|
GL_RESOLVE(glRenderbufferStorage);
|
|
|
|
|
|
|
|
GL_RESOLVE(glGetRenderbufferParameteriv);
|
|
|
|
|
|
|
|
GL_RESOLVE(glIsFramebuffer);
|
|
|
|
GL_RESOLVE(glBindFramebuffer);
|
|
|
|
GL_RESOLVE(glDeleteFramebuffers);
|
|
|
|
GL_RESOLVE(glGenFramebuffers);
|
|
|
|
|
|
|
|
GL_RESOLVE(glCheckFramebufferStatus);
|
|
|
|
|
|
|
|
GL_RESOLVE(glFramebufferTexture1D);
|
|
|
|
GL_RESOLVE(glFramebufferTexture2D);
|
|
|
|
GL_RESOLVE(glFramebufferTexture3D);
|
|
|
|
|
|
|
|
GL_RESOLVE(glFramebufferRenderbuffer);
|
|
|
|
|
|
|
|
GL_RESOLVE(glGetFramebufferAttachmentParameteriv);
|
|
|
|
|
|
|
|
GL_RESOLVE(glGenerateMipmap);
|
|
|
|
} else if (hasGLExtension("GL_EXT_framebuffer_object")) {
|
|
|
|
// see http://www.opengl.org/registry/specs/EXT/framebuffer_object.txt
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glIsRenderbuffer, glIsRenderbufferEXT);
|
|
|
|
GL_RESOLVE_WITH_EXT(glBindRenderbuffer, glBindRenderbufferEXT);
|
|
|
|
GL_RESOLVE_WITH_EXT(glDeleteRenderbuffers, glDeleteRenderbuffersEXT);
|
|
|
|
GL_RESOLVE_WITH_EXT(glGenRenderbuffers, glGenRenderbuffersEXT);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glRenderbufferStorage, glRenderbufferStorageEXT);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glGetRenderbufferParameteriv, glGetRenderbufferParameterivEXT);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glIsFramebuffer, glIsFramebufferEXT);
|
|
|
|
GL_RESOLVE_WITH_EXT(glBindFramebuffer, glBindFramebufferEXT);
|
|
|
|
GL_RESOLVE_WITH_EXT(glDeleteFramebuffers, glDeleteFramebuffersEXT);
|
|
|
|
GL_RESOLVE_WITH_EXT(glGenFramebuffers, glGenFramebuffersEXT);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glCheckFramebufferStatus, glCheckFramebufferStatusEXT);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glFramebufferTexture1D, glFramebufferTexture1DEXT);
|
|
|
|
GL_RESOLVE_WITH_EXT(glFramebufferTexture2D, glFramebufferTexture2DEXT);
|
|
|
|
GL_RESOLVE_WITH_EXT(glFramebufferTexture3D, glFramebufferTexture3DEXT);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glFramebufferRenderbuffer, glFramebufferRenderbufferEXT);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glGetFramebufferAttachmentParameteriv, glGetFramebufferAttachmentParameterivEXT);
|
2007-04-29 17:35:43 +00:00
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glGenerateMipmap, glGenerateMipmapEXT);
|
2011-01-30 14:34:42 +00:00
|
|
|
} else {
|
2007-04-29 17:35:43 +00:00
|
|
|
glIsRenderbuffer = NULL;
|
|
|
|
glBindRenderbuffer = NULL;
|
|
|
|
glDeleteRenderbuffers = NULL;
|
|
|
|
glGenRenderbuffers = NULL;
|
|
|
|
glRenderbufferStorage = NULL;
|
|
|
|
glGetRenderbufferParameteriv = NULL;
|
|
|
|
glIsFramebuffer = NULL;
|
|
|
|
glBindFramebuffer = NULL;
|
|
|
|
glDeleteFramebuffers = NULL;
|
|
|
|
glGenFramebuffers = NULL;
|
|
|
|
glCheckFramebufferStatus = NULL;
|
|
|
|
glFramebufferTexture1D = NULL;
|
|
|
|
glFramebufferTexture2D = NULL;
|
|
|
|
glFramebufferTexture3D = NULL;
|
|
|
|
glFramebufferRenderbuffer = NULL;
|
|
|
|
glGetFramebufferAttachmentParameteriv = NULL;
|
|
|
|
glGenerateMipmap = NULL;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
2011-11-09 17:03:10 +00:00
|
|
|
|
|
|
|
if (hasGLExtension("GL_ARB_framebuffer_object")) {
|
2012-10-03 07:32:25 +00:00
|
|
|
// see http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE(glBlitFramebuffer);
|
2011-11-09 17:03:10 +00:00
|
|
|
} else if (hasGLExtension("GL_EXT_framebuffer_blit")) {
|
2012-10-03 07:32:25 +00:00
|
|
|
// see http://www.opengl.org/registry/specs/EXT/framebuffer_blit.txt
|
2012-09-29 11:19:35 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glBlitFramebuffer, glBlitFramebufferEXT);
|
2011-08-17 17:32:36 +00:00
|
|
|
} else {
|
|
|
|
glBlitFramebuffer = NULL;
|
|
|
|
}
|
2011-11-09 17:03:10 +00:00
|
|
|
|
2012-10-03 07:32:25 +00:00
|
|
|
if (hasGLExtension("GL_ARB_shader_objects")) {
|
|
|
|
// see http://www.opengl.org/registry/specs/ARB/shader_objects.txt
|
2011-01-30 14:34:42 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glCreateShader, glCreateShaderObjectARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glShaderSource, glShaderSourceARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glCompileShader, glCompileShaderARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glDeleteShader, glDeleteObjectARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glCreateProgram, glCreateProgramObjectARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glAttachShader, glAttachObjectARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glLinkProgram, glLinkProgramARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUseProgram, glUseProgramObjectARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glDeleteProgram, glDeleteObjectARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glGetShaderInfoLog, glGetInfoLogARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glGetProgramInfoLog, glGetInfoLogARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glGetProgramiv, glGetObjectParameterivARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glGetShaderiv, glGetObjectParameterivARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUniform1f, glUniform1fARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUniform2f, glUniform2fARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUniform3f, glUniform3fARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUniform4f, glUniform4fARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUniform1i, glUniform1iARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUniform1fv, glUniform1fvARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUniform2fv, glUniform2fvARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUniform3fv, glUniform3fvARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUniform4fv, glUniform4fvARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glUniformMatrix4fv, glUniformMatrix4fvARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glValidateProgram, glValidateProgramARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glGetUniformLocation, glGetUniformLocationARB);
|
2012-10-03 07:32:25 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glGetUniformfv, glGetUniformfvARB);
|
|
|
|
} else {
|
|
|
|
glCreateShader = NULL;
|
|
|
|
glShaderSource = NULL;
|
|
|
|
glCompileShader = NULL;
|
|
|
|
glDeleteShader = NULL;
|
|
|
|
glCreateProgram = NULL;
|
|
|
|
glAttachShader = NULL;
|
|
|
|
glLinkProgram = NULL;
|
|
|
|
glUseProgram = NULL;
|
|
|
|
glDeleteProgram = NULL;
|
|
|
|
glGetShaderInfoLog = NULL;
|
|
|
|
glGetProgramInfoLog = NULL;
|
|
|
|
glGetProgramiv = NULL;
|
|
|
|
glGetShaderiv = NULL;
|
|
|
|
glUniform1f = NULL;
|
|
|
|
glUniform2f = NULL;
|
|
|
|
glUniform3f = NULL;
|
|
|
|
glUniform4f = NULL;
|
|
|
|
glUniform1i = NULL;
|
|
|
|
glUniform1fv = NULL;
|
|
|
|
glUniform2fv = NULL;
|
|
|
|
glUniform3fv = NULL;
|
|
|
|
glUniform4fv = NULL;
|
|
|
|
glUniformMatrix4fv = NULL;
|
|
|
|
glValidateProgram = NULL;
|
|
|
|
glGetUniformLocation = NULL;
|
|
|
|
glGetUniformfv = NULL;
|
|
|
|
}
|
|
|
|
if (hasGLExtension("GL_ARB_vertex_shader")) {
|
|
|
|
// see http://www.opengl.org/registry/specs/ARB/vertex_shader.txt
|
2011-01-30 14:34:42 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glVertexAttrib1f, glVertexAttrib1fARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glBindAttribLocation, glBindAttribLocationARB);
|
2012-10-03 07:32:25 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glGetAttribLocation, glGetAttribLocationARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glEnableVertexAttribArray, glEnableVertexAttribArrayARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glDisableVertexAttribArray, glDisableVertexAttribArrayARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glVertexAttribPointer, glVertexAttribPointerARB);
|
|
|
|
} else {
|
|
|
|
glVertexAttrib1f = NULL;
|
|
|
|
glBindAttribLocation = NULL;
|
|
|
|
glGetAttribLocation = NULL;
|
|
|
|
glEnableVertexAttribArray = NULL;
|
|
|
|
glDisableVertexAttribArray = NULL;
|
|
|
|
glVertexAttribPointer = NULL;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (hasGLExtension("GL_ARB_fragment_program") && hasGLExtension("GL_ARB_vertex_program")) {
|
2012-10-03 07:32:25 +00:00
|
|
|
// see http://www.opengl.org/registry/specs/ARB/fragment_program.txt
|
2011-01-30 14:34:42 +00:00
|
|
|
GL_RESOLVE(glProgramStringARB);
|
|
|
|
GL_RESOLVE(glBindProgramARB);
|
|
|
|
GL_RESOLVE(glDeleteProgramsARB);
|
|
|
|
GL_RESOLVE(glGenProgramsARB);
|
|
|
|
GL_RESOLVE(glProgramLocalParameter4fARB);
|
|
|
|
GL_RESOLVE(glGetProgramivARB);
|
2012-10-03 07:32:25 +00:00
|
|
|
} else {
|
|
|
|
glProgramStringARB = NULL;
|
|
|
|
glBindProgramARB = NULL;
|
|
|
|
glDeleteProgramsARB = NULL;
|
|
|
|
glGenProgramsARB = NULL;
|
|
|
|
glProgramLocalParameter4fARB = NULL;
|
|
|
|
glGetProgramivARB = NULL;
|
2011-01-30 14:34:42 +00:00
|
|
|
}
|
|
|
|
if (hasGLExtension("GL_ARB_vertex_buffer_object")) {
|
2012-10-03 07:32:25 +00:00
|
|
|
// see http://www.opengl.org/registry/specs/ARB/vertex_buffer_object.txt
|
2011-01-30 14:34:42 +00:00
|
|
|
GL_RESOLVE_WITH_EXT(glGenBuffers, glGenBuffersARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glDeleteBuffers, glDeleteBuffersARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glBindBuffer, glBindBufferARB);
|
|
|
|
GL_RESOLVE_WITH_EXT(glBufferData, glBufferDataARB);
|
|
|
|
} else {
|
2010-07-19 20:53:32 +00:00
|
|
|
glGenBuffers = NULL;
|
|
|
|
glDeleteBuffers = NULL;
|
|
|
|
glBindBuffer = NULL;
|
|
|
|
glBufferData = NULL;
|
2007-04-29 17:35:43 +00:00
|
|
|
}
|
2012-09-29 11:19:35 +00:00
|
|
|
#endif
|
2010-12-05 11:35:40 +00:00
|
|
|
|
2012-09-29 11:19:35 +00:00
|
|
|
#ifdef KWIN_HAVE_EGL
|
|
|
|
if (platformInterface == EglPlatformInterface) {
|
|
|
|
if (hasGLExtension("GL_OES_EGL_image")) {
|
|
|
|
glEGLImageTargetTexture2DOES = (glEGLImageTargetTexture2DOES_func)eglGetProcAddress("glEGLImageTargetTexture2DOES");
|
|
|
|
} else {
|
|
|
|
glEGLImageTargetTexture2DOES = NULL;
|
|
|
|
}
|
2010-12-05 11:35:40 +00:00
|
|
|
}
|
2012-09-29 11:19:35 +00:00
|
|
|
#endif
|
2010-12-05 11:35:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|