summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2012-12-13 15:47:35 +0000
committerRobert Bragg <robert@linux.intel.com>2013-01-21 14:20:48 +0000
commite5c7c8b9ce540fd20de238f97151b1e27173a2ed (patch)
treeb3d8caf73e9be2dedbe0b9b36877f3d041648696
parent460242cee187c2851f80e80890ab702c2380c653 (diff)
downloadcogl-e5c7c8b9ce540fd20de238f97151b1e27173a2ed.tar.gz
Add a public cogl_framebuffer_get_depth_bits() function
Cogl publicly exposes the depth buffer state so we might as well have a function to query the number of depth bits of a framebuffer. Reviewed-by: Robert Bragg <robert@linux.intel.com> (cherry picked from commit 853143eb10387f50f8d32cf09af31b8829dc1e01)
-rw-r--r--cogl/cogl-framebuffer-private.h1
-rw-r--r--cogl/cogl-framebuffer.c11
-rw-r--r--cogl/cogl-framebuffer.h14
-rw-r--r--cogl/driver/gl/cogl-framebuffer-gl.c8
-rw-r--r--doc/reference/cogl-2.0-experimental/cogl-2.0-experimental-sections.txt1
5 files changed, 33 insertions, 2 deletions
diff --git a/cogl/cogl-framebuffer-private.h b/cogl/cogl-framebuffer-private.h
index 996bc0ae..49800039 100644
--- a/cogl/cogl-framebuffer-private.h
+++ b/cogl/cogl-framebuffer-private.h
@@ -111,6 +111,7 @@ typedef struct
int blue;
int green;
int alpha;
+ int depth;
} CoglFramebufferBits;
struct _CoglFramebuffer
diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 8edf6564..5fb626d2 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -1133,6 +1133,17 @@ cogl_framebuffer_get_alpha_bits (CoglFramebuffer *framebuffer)
return bits.alpha;
}
+int
+cogl_framebuffer_get_depth_bits (CoglFramebuffer *framebuffer)
+{
+ CoglContext *ctx = framebuffer->context;
+ CoglFramebufferBits bits;
+
+ ctx->driver_vtable->framebuffer_query_bits (framebuffer, &bits);
+
+ return bits.depth;
+}
+
CoglColorMask
cogl_framebuffer_get_color_mask (CoglFramebuffer *framebuffer)
{
diff --git a/cogl/cogl-framebuffer.h b/cogl/cogl-framebuffer.h
index e3b7602c..e3fdb121 100644
--- a/cogl/cogl-framebuffer.h
+++ b/cogl/cogl-framebuffer.h
@@ -720,6 +720,20 @@ int
cogl_framebuffer_get_alpha_bits (CoglFramebuffer *framebuffer);
/**
+ * cogl_framebuffer_get_depth_bits:
+ * @framebuffer: a pointer to a #CoglFramebuffer
+ *
+ * Retrieves the number of depth bits of @framebuffer
+ *
+ * Return value: the number of bits
+ *
+ * Since: 2.0
+ * Stability: unstable
+ */
+int
+cogl_framebuffer_get_depth_bits (CoglFramebuffer *framebuffer);
+
+/**
* cogl_framebuffer_get_dither_enabled:
* @framebuffer: a pointer to a #CoglFramebuffer
*
diff --git a/cogl/driver/gl/cogl-framebuffer-gl.c b/cogl/driver/gl/cogl-framebuffer-gl.c
index 5888f72d..753624a7 100644
--- a/cogl/driver/gl/cogl-framebuffer-gl.c
+++ b/cogl/driver/gl/cogl-framebuffer-gl.c
@@ -920,6 +920,8 @@ _cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer)
offsetof (CoglFramebufferBits, blue) },
{ GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE,
offsetof (CoglFramebufferBits, alpha) },
+ { GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE,
+ offsetof (CoglFramebufferBits, depth) },
};
int i;
@@ -940,11 +942,12 @@ _cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer)
GE( ctx, glGetIntegerv (GL_GREEN_BITS, &framebuffer->bits.green) );
GE( ctx, glGetIntegerv (GL_BLUE_BITS, &framebuffer->bits.blue) );
GE( ctx, glGetIntegerv (GL_ALPHA_BITS, &framebuffer->bits.alpha) );
+ GE( ctx, glGetIntegerv (GL_DEPTH_BITS, &framebuffer->bits.depth) );
}
COGL_NOTE (OFFSCREEN,
- "RGBA Bits for framebuffer[%p, %s]: %d, %d, %d, %d",
+ "RGBA/D Bits for framebuffer[%p, %s]: %d, %d, %d, %d, %d",
framebuffer,
framebuffer->type == COGL_FRAMEBUFFER_TYPE_OFFSCREEN
? "offscreen"
@@ -952,7 +955,8 @@ _cogl_framebuffer_init_bits (CoglFramebuffer *framebuffer)
framebuffer->bits.red,
framebuffer->bits.blue,
framebuffer->bits.green,
- framebuffer->bits.alpha);
+ framebuffer->bits.alpha,
+ framebuffer->bits.depth);
framebuffer->dirty_bitmasks = FALSE;
}
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 e6a4e93e..ac749658 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
@@ -511,6 +511,7 @@ cogl_framebuffer_get_red_bits
cogl_framebuffer_get_green_bits
cogl_framebuffer_get_blue_bits
cogl_framebuffer_get_alpha_bits
+cogl_framebuffer_get_depth_bits
cogl_framebuffer_get_color_mask
cogl_framebuffer_set_color_mask
cogl_framebuffer_get_samples_per_pixel