From 23eca5c793cb11c66a02d55df4cf680747691551 Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 30 Jan 2013 13:53:48 +0000 Subject: [PATCH] Support cogl_renderer_get_n_fragment_texture_units() for ARBfp There is a cogl_renderer_get_n_fragment_texture_units() function which is documented to return the number of texture units that are accessible from a fragment program. This just directly returns the value from GL_MAX_TEXTURE_IMAGE_UNITS which is available in either the GLSL extensions or the ARBfp extension. Clutter-GST relies on this to determine whether it can use a program to convert the YUV data on the GPU. When the GL3 driver was added in 66c9db993595b this was changed to only query the value when the GLSL feature is available. Previously it would always query the value when the GL or GLES2 driver is used. This change makes sense on master because there is no API for an application to make its own ARBfp programs so the only way to access texture units from a program is via GLSL. However on the 1.14 branch this patch broke clutter-gst when GLSL is disabled because it thinks the ARBfp programs can't use multi-texturing. This patch just changes it to also query the value when ARBfp support is available. Note: it's probably note a good idea to apply this patch to master, but only to the 1.14 branch. On master the function probably needs to be changed anyway because it is using _COGL_GET_CONTEXT(). Reviewed-by: Robert Bragg --- cogl/cogl-renderer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c index 86869354e..1518a1767 100644 --- a/cogl/cogl-renderer.c +++ b/cogl/cogl-renderer.c @@ -590,7 +590,8 @@ cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer) _COGL_GET_CONTEXT (ctx, 0); #if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2) - if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL)) + if (cogl_has_feature (ctx, COGL_FEATURE_ID_GLSL) || + cogl_has_feature (ctx, COGL_FEATURE_ID_ARBFP)) GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n)); #endif