[cogl/wip/msaa: 4/21] renderer: Add cogl_renderer_get_n_fragment_texture_units()
- From: Robert Bragg <rbragg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl/wip/msaa: 4/21] renderer: Add cogl_renderer_get_n_fragment_texture_units()
- Date: Mon, 5 Sep 2011 14:52:38 +0000 (UTC)
commit 049a3147aec8e5ff54e222afe19360f121356721
Author: Damien Lespiau <damien lespiau intel com>
Date: Thu Aug 25 17:26:44 2011 +0100
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>
cogl/cogl-renderer.c | 16 ++++++++++++++++
cogl/cogl-renderer.h | 16 ++++++++++++++++
.../cogl-2.0-experimental-sections.txt | 1 +
3 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-renderer.c b/cogl/cogl-renderer.c
index 7bd4746..0ca3edd 100644
--- a/cogl/cogl-renderer.c
+++ b/cogl/cogl-renderer.c
@@ -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;
+}
diff --git a/cogl/cogl-renderer.h b/cogl/cogl-renderer.h
index 5061c40..15c0ff4 100644
--- a/cogl/cogl-renderer.h
+++ b/cogl/cogl-renderer.h
@@ -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
diff --git a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
index 2237345..571c84b 100644
--- a/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
+++ b/doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt
@@ -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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]