mirror of
https://github.com/brl/mutter.git
synced 2024-11-10 07:56:14 -05:00
2616ae0fa9
This adds a new CoglDriver for GL 3 called COGL_DRIVER_GL3. When requested, the GLX, EGL and SDL2 winsyss will set the necessary attributes to request a forward-compatible core profile 3.1 context. That means it will have no deprecated features. To simplify the explosion of checks for specific combinations of context->driver, many of these conditionals have now been replaced with private feature flags that are checked instead. The GL and GLES drivers now initialise these private feature flags depending on which driver is used. The fixed function backends now explicitly check whether the fixed function private feature is available which means the GL3 driver will fall back to always using the GLSL progend. Since Rob's latest patches the GLSL progend no longer uses any fixed function API anyway so it should just work. The driver is currently lower priority than COGL_DRIVER_GL so it will not be used unless it is specificly requested. We may want to change this priority at some point because apparently Mesa can make some memory savings if a core profile context is used. In GL 3, getting the combined extensions string with glGetString is deprecated so this patch changes it to use glGetStringi to build up an array of extensions instead. _cogl_context_get_gl_extensions now returns this array instead of trying to return a const string. The caller is expected to free the array. Some issues with this patch: • GL 3 does not support GL_ALPHA format textures. We should probably make this a feature flag or something. Cogl uses this to render text which currently just throws a GL error and breaks so it's pretty important to do something about this before considering the GL3 driver to be stable. • GL 3 doesn't support client side vertex buffers. This probably doesn't matter because CoglBuffer won't normally use malloc'd buffers if VBOs are available, but it might but worth making malloc'd buffers a private feature and forcing it not to use them. • GL 3 doesn't support the default vertex array object. This patch just makes it create and bind a single non-default vertex array object which gets used just like the normal default object. Ideally it would be good to use vertex array objects properly and attach them to a CoglPrimitive to cache the state. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 66c9db993595b3a22e63f4c201ea468bc9b88cb6)
128 lines
4.7 KiB
C
128 lines
4.7 KiB
C
/*
|
|
* Cogl
|
|
*
|
|
* An object oriented GL/GLES Abstraction/Utility Layer
|
|
*
|
|
* Copyright (C) 2010 Intel Corporation.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2 of the License, or (at your option) any later version.
|
|
*
|
|
* This library 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
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library. If not, see
|
|
* <http://www.gnu.org/licenses/>.
|
|
*
|
|
*
|
|
*/
|
|
|
|
/* This can be included multiple times with different definitions for
|
|
* the COGL_WINSYS_FEATURE_* functions.
|
|
*/
|
|
|
|
/* Macro prototypes:
|
|
* COGL_WINSYS_FEATURE_BEGIN (name, namespaces, extension_names,
|
|
* implied_public_feature_flags,
|
|
* implied_private_feature_flags,
|
|
* implied_winsys_feature)
|
|
* COGL_WINSYS_FEATURE_FUNCTION (return_type, function_name,
|
|
* (arguments))
|
|
* ...
|
|
* COGL_WINSYS_FEATURE_END ()
|
|
*
|
|
* Note: You can list multiple namespace and extension names if the
|
|
* corresponding _FEATURE_FUNCTIONS have the same semantics accross
|
|
* the different extension variants.
|
|
*
|
|
* XXX: NB: Don't add a trailing semicolon when using these macros
|
|
*/
|
|
|
|
COGL_WINSYS_FEATURE_BEGIN (texture_from_pixmap,
|
|
"EXT\0",
|
|
"texture_from_pixmap\0",
|
|
0,
|
|
0,
|
|
COGL_WINSYS_FEATURE_TEXTURE_FROM_PIXMAP)
|
|
COGL_WINSYS_FEATURE_FUNCTION (void, glXBindTexImage,
|
|
(Display *display,
|
|
GLXDrawable drawable,
|
|
int buffer,
|
|
int *attribList))
|
|
COGL_WINSYS_FEATURE_FUNCTION (void, glXReleaseTexImage,
|
|
(Display *display,
|
|
GLXDrawable drawable,
|
|
int buffer))
|
|
COGL_WINSYS_FEATURE_END ()
|
|
|
|
COGL_WINSYS_FEATURE_BEGIN (video_sync,
|
|
"SGI\0",
|
|
"video_sync\0",
|
|
0,
|
|
0,
|
|
COGL_WINSYS_FEATURE_VBLANK_COUNTER)
|
|
COGL_WINSYS_FEATURE_FUNCTION (int, glXGetVideoSync,
|
|
(unsigned int *count))
|
|
COGL_WINSYS_FEATURE_FUNCTION (int, glXWaitVideoSync,
|
|
(int divisor,
|
|
int remainder,
|
|
unsigned int *count))
|
|
COGL_WINSYS_FEATURE_END ()
|
|
|
|
COGL_WINSYS_FEATURE_BEGIN (swap_control,
|
|
"SGI\0",
|
|
"swap_control\0",
|
|
0,
|
|
0,
|
|
COGL_WINSYS_FEATURE_SWAP_THROTTLE)
|
|
COGL_WINSYS_FEATURE_FUNCTION (int, glXSwapInterval,
|
|
(int interval))
|
|
COGL_WINSYS_FEATURE_END ()
|
|
|
|
COGL_WINSYS_FEATURE_BEGIN (copy_sub_buffer,
|
|
"MESA\0",
|
|
"copy_sub_buffer\0",
|
|
0,
|
|
0,
|
|
/* We initially assumed that copy_sub_buffer is synchronized on
|
|
* which is only the case for a subset of GPUs for example it is not
|
|
* synchronized on INTEL gen6 and gen7, so we remove this assumption
|
|
* for now
|
|
*/
|
|
#if 0
|
|
COGL_WINSYS_FEATURE_SWAP_REGION_SYNCHRONIZED)
|
|
#endif
|
|
0)
|
|
COGL_WINSYS_FEATURE_FUNCTION (void, glXCopySubBuffer,
|
|
(Display *dpy,
|
|
GLXDrawable drawable,
|
|
int x, int y, int width, int height))
|
|
COGL_WINSYS_FEATURE_END ()
|
|
|
|
COGL_WINSYS_FEATURE_BEGIN (swap_event,
|
|
"INTEL\0",
|
|
"swap_event\0",
|
|
0,
|
|
0,
|
|
COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT)
|
|
COGL_WINSYS_FEATURE_END ()
|
|
|
|
COGL_WINSYS_FEATURE_BEGIN (create_context,
|
|
"ARB\0",
|
|
"create_context",
|
|
0,
|
|
0,
|
|
0)
|
|
COGL_WINSYS_FEATURE_FUNCTION (GLXContext, glXCreateContextAttribs,
|
|
(Display *dpy,
|
|
GLXFBConfig config,
|
|
GLXContext share_context,
|
|
Bool direct,
|
|
const int *attrib_list))
|
|
COGL_WINSYS_FEATURE_END ()
|