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 <robert@linux.intel.com>
This commit is contained in:
Neil Roberts 2013-01-30 13:53:48 +00:00
parent d3f084d4a1
commit 23eca5c793

View File

@ -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