Don't try to use clip planes on GL3

GL3 has support for clip planes but they are used differently and
involve writing to a builtin output variable in the vertex shader. The
current clip plane code assumes it is only used with a fixed function
driver and tries to directly push to the matrix builtins. This
obviously won't work on GL3 so for now let's just disable clip planes.

Reviewed-by: Robert Bragg <robert@linux.intel.com>

(cherry picked from commit 5f621589467ab961f5130590298dc8e26d658a92)
This commit is contained in:
Neil Roberts 2012-12-13 16:28:41 +00:00 committed by Robert Bragg
parent 988486ac7d
commit 82615e292d

View File

@ -359,7 +359,6 @@ _cogl_driver_update_features (CoglContext *ctx,
CoglPrivateFeatureFlags private_flags = 0; CoglPrivateFeatureFlags private_flags = 0;
CoglFeatureFlags flags = 0; CoglFeatureFlags flags = 0;
char **gl_extensions; char **gl_extensions;
int max_clip_planes = 0;
int gl_major = 0, gl_minor = 0; int gl_major = 0, gl_minor = 0;
/* We have to special case getting the pointer to the glGetString* /* We have to special case getting the pointer to the glGetString*
@ -449,10 +448,6 @@ _cogl_driver_update_features (CoglContext *ctx,
if (_cogl_check_extension ("GL_MESA_pack_invert", gl_extensions)) if (_cogl_check_extension ("GL_MESA_pack_invert", gl_extensions))
private_flags |= COGL_PRIVATE_FEATURE_MESA_PACK_INVERT; private_flags |= COGL_PRIVATE_FEATURE_MESA_PACK_INVERT;
GE( ctx, glGetIntegerv (GL_MAX_CLIP_PLANES, &max_clip_planes) );
if (max_clip_planes >= 4)
private_flags |= COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES;
if (ctx->glGenRenderbuffers) if (ctx->glGenRenderbuffers)
{ {
flags |= COGL_FEATURE_OFFSCREEN; flags |= COGL_FEATURE_OFFSCREEN;
@ -580,12 +575,20 @@ _cogl_driver_update_features (CoglContext *ctx,
private_flags |= COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE; private_flags |= COGL_PRIVATE_FEATURE_TEXTURE_SWIZZLE;
if (ctx->driver == COGL_DRIVER_GL) if (ctx->driver == COGL_DRIVER_GL)
{
int max_clip_planes = 0;
/* Features which are not available in GL 3 */ /* Features which are not available in GL 3 */
private_flags |= (COGL_PRIVATE_FEATURE_FIXED_FUNCTION | private_flags |= (COGL_PRIVATE_FEATURE_FIXED_FUNCTION |
COGL_PRIVATE_FEATURE_ALPHA_TEST | COGL_PRIVATE_FEATURE_ALPHA_TEST |
COGL_PRIVATE_FEATURE_QUADS | COGL_PRIVATE_FEATURE_QUADS |
COGL_PRIVATE_FEATURE_ALPHA_TEXTURES); COGL_PRIVATE_FEATURE_ALPHA_TEXTURES);
GE( ctx, glGetIntegerv (GL_MAX_CLIP_PLANES, &max_clip_planes) );
if (max_clip_planes >= 4)
private_flags |= COGL_PRIVATE_FEATURE_FOUR_CLIP_PLANES;
}
private_flags |= (COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT | private_flags |= (COGL_PRIVATE_FEATURE_READ_PIXELS_ANY_FORMAT |
COGL_PRIVATE_FEATURE_ANY_GL | COGL_PRIVATE_FEATURE_ANY_GL |
COGL_PRIVATE_FEATURE_FORMAT_CONVERSION | COGL_PRIVATE_FEATURE_FORMAT_CONVERSION |