[cogl] cogl-primitives: Copy across the texture coordinates if no texture



commit 88f8780367311ff23479352d887048c2f08c7ffd
Author: Neil Roberts <neil linux intel com>
Date:   Wed Feb 8 15:58:07 2012 +0000

    cogl-primitives: Copy across the texture coordinates if no texture
    
    Previously when using the cogl_rectangle_* family of functions with a
    pipeline that doesn't have a texture for a particular layer then
    validate_tex_coords_cb would bail out immediately leaving the texture
    coords for that layer uninitialised. This patch changes it so that it
    bails out after copying in the texture coordinates instead. This was
    causing problems for pipelines that were trying to completely generate
    the texture values in a CoglSnippet because they wouldn't get any
    texture coordinates.
    
    Reviewed-by: Robert Bragg <robert linux intel com>

 cogl/cogl-primitives.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/cogl/cogl-primitives.c b/cogl/cogl-primitives.c
index aca9c20..4a40916 100644
--- a/cogl/cogl-primitives.c
+++ b/cogl/cogl-primitives.c
@@ -308,12 +308,6 @@ validate_tex_coords_cb (CoglPipeline *pipeline,
 
   state->i++;
 
-  texture = cogl_pipeline_get_layer_texture (pipeline, layer_index);
-
-  /* NB: NULL textures are handled by _cogl_pipeline_flush_gl_state */
-  if (!texture)
-    return TRUE;
-
   /* FIXME: we should be able to avoid this copying when no
    * transform is required by the texture backend and the user
    * has supplied enough coordinates for all the layers.
@@ -330,6 +324,12 @@ validate_tex_coords_cb (CoglPipeline *pipeline,
 
   memcpy (out_tex_coords, in_tex_coords, sizeof (float) * 4);
 
+  texture = cogl_pipeline_get_layer_texture (pipeline, layer_index);
+
+  /* NB: NULL textures are handled by _cogl_pipeline_flush_gl_state */
+  if (!texture)
+    return TRUE;
+
   /* Convert the texture coordinates to GL.
    */
   transform_result =



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]