[Cogl] [PATCH 02/13] offscreen: allocate texture before querying slicing

Robert Bragg robert at sixbynine.org
Wed Dec 11 10:31:23 PST 2013


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

Since we are planning on deferring more texture allocation work this
makes sure we don't query whether a texture is sliced until we know it
has been allocated.
---
 cogl/cogl-framebuffer.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/cogl/cogl-framebuffer.c b/cogl/cogl-framebuffer.c
index 9ce2725..24004f7 100644
--- a/cogl/cogl-framebuffer.c
+++ b/cogl/cogl-framebuffer.c
@@ -678,6 +678,11 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
           return FALSE;
         }
 
+      if (!cogl_texture_allocate (offscreen->texture, error))
+        return FALSE;
+
+      /* NB: it's only after allocating the texture that we will
+       * determine whether a texture needs slicing... */
       if (cogl_texture_is_sliced (offscreen->texture))
         {
           _cogl_set_error (error, COGL_SYSTEM_ERROR,
@@ -687,9 +692,6 @@ cogl_framebuffer_allocate (CoglFramebuffer *framebuffer,
           return FALSE;
         }
 
-      if (!cogl_texture_allocate (offscreen->texture, error))
-        return FALSE;
-
       /* Forward the texture format as the internal format of the
        * framebuffer */
       framebuffer->internal_format =
-- 
1.8.3.1



More information about the Cogl mailing list