[Cogl] [PATCH 8/8] framebuffer: lazily alloc on _get_depth_texture()

Robert Bragg robert at sixbynine.org
Thu Sep 6 09:29:36 PDT 2012


From: Robert Bragg <robert at linux.intel.com>

Since depth-textures aren't created until a framebuffer is allocated we
now lazily allocate a framebuffer if
cogl_framebuffer_get_depth_texture() is called.
---
 cogl/cogl-framebuffer.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 528abcd..984b3b8 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -2046,6 +2046,10 @@ cogl_framebuffer_get_depth_texture (CoglFramebuffer *framebuffer)
 {
   _COGL_RETURN_VAL_IF_FAIL (cogl_is_offscreen (framebuffer), NULL);
 
+  /* lazily allocate the framebuffer... */
+  if (!cogl_framebuffer_allocate (framebuffer, NULL))
+    return NULL;
+
   return COGL_OFFSCREEN(framebuffer)->depth_texture;
 }
 
-- 
1.7.7.6



More information about the Cogl mailing list