renderer: Add cogl_renderer_get_n_fragment_texture_units()

Add a method on the renderer to know how many texture image units are
accessible from fragment shaders.

https://bugzilla.gnome.org/show_bug.cgi?id=657347

Reviewed-by: Robert Bragg <robert@linux.intel.com>
This commit is contained in:
Damien Lespiau 2011-08-25 17:26:44 +01:00 committed by Robert Bragg
parent 6a2e21183c
commit c36652a4c3
3 changed files with 33 additions and 0 deletions

View File

@ -35,6 +35,7 @@
#include "cogl-internal.h"
#include "cogl-private.h"
#include "cogl-object.h"
#include "cogl-context-private.h"
#include "cogl-renderer.h"
#include "cogl-renderer-private.h"
@ -394,3 +395,18 @@ _cogl_renderer_get_proc_address (CoglRenderer *renderer,
return winsys->renderer_get_proc_address (renderer, name);
}
int
cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer)
{
int n = 0;
_COGL_GET_CONTEXT (ctx, 0);
#if defined (HAVE_COGL_GL) || defined (HAVE_COGL_GLES2)
if (ctx->driver == COGL_DRIVER_GL || ctx->driver == COGL_DRIVER_GLES2)
GE (ctx, glGetIntegerv (GL_MAX_TEXTURE_IMAGE_UNITS, &n));
#endif
return n;
}

View File

@ -114,6 +114,22 @@ cogl_renderer_set_winsys_id (CoglRenderer *renderer,
CoglWinsysID
cogl_renderer_get_winsys_id (CoglRenderer *renderer);
/**
* cogl_renderer_get_n_fragment_texture_units:
* @renderer: A #CoglRenderer
*
* Queries how many texture units can be used from fragment programs
*
* Returns: the number of texture image units.
*
* Since: 1.8
* Stability: Unstable
*/
#define cogl_renderer_get_n_fragment_texture_units \
cogl_renderer_get_n_fragment_texture_units_EXP
int
cogl_renderer_get_n_fragment_texture_units (CoglRenderer *renderer);
#define cogl_renderer_check_onscreen_template \
cogl_renderer_check_onscreen_template_EXP
gboolean

View File

@ -14,6 +14,7 @@ cogl_object_set_user_data
<FILE>cogl-renderer</FILE>
<TITLE>CoglRenderer: Connect to a backend renderer</TITLE>
cogl_renderer_new
cogl_renderer_get_n_fragment_texture_units
cogl_renderer_connect
<SUBSECTION>