This looks good to land to me:<div><br></div><div>Reviewed-by: Robert Bragg <<a href="mailto:robert@linux.intel.com">robert@linux.intel.com</a>></div><div><br></div><div>thanks,</div><div>- Robert</div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Tue, Nov 27, 2012 at 8:11 PM, Neil Roberts <span dir="ltr"><<a href="mailto:neil@linux.intel.com" target="_blank">neil@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Both the texture drivers weren't handling errors correctly when a<br>
CoglPixelBuffer was used to set the contents of an entire texture.<br>
This was causing it to hit an assertion failure in the pixel buffer<br>
tests.<br>
---<br>
 cogl/driver/gl/gl/cogl-texture-driver-gl.c     | 17 ++++++++++++++---<br>
 cogl/driver/gl/gles/cogl-texture-driver-gles.c | 13 +++++++++++--<br>
 tests/conform/test-conform-main.c              |  4 ++--<br>
 3 files changed, 27 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/cogl/driver/gl/gl/cogl-texture-driver-gl.c b/cogl/driver/gl/gl/cogl-texture-driver-gl.c<br>
index 1f0e413..ac6ac98 100644<br>
--- a/cogl/driver/gl/gl/cogl-texture-driver-gl.c<br>
+++ b/cogl/driver/gl/gl/cogl-texture-driver-gl.c<br>
@@ -246,10 +246,21 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx,<br>
   int bpp = _cogl_pixel_format_get_bytes_per_pixel (source_format);<br>
   GLenum gl_error;<br>
   CoglBool status = TRUE;<br>
+  CoglError *internal_error = NULL;<br>
<br>
-  data = _cogl_bitmap_gl_bind (source_bmp, COGL_BUFFER_ACCESS_READ, 0, error);<br>
-  if (!data)<br>
-    return FALSE;<br>
+  data = _cogl_bitmap_gl_bind (source_bmp,<br>
+                               COGL_BUFFER_ACCESS_READ,<br>
+                               0, /* hints */<br>
+                               &internal_error);<br>
+<br>
+  /* NB: _cogl_bitmap_gl_bind() may return NULL when successful so we<br>
+   * have to explicitly check the cogl error pointer to catch<br>
+   * problems... */<br>
+  if (internal_error)<br>
+    {<br>
+      _cogl_propagate_error (error, internal_error);<br>
+      return FALSE;<br>
+    }<br>
<br>
   /* Setup gl alignment to match rowstride and top-left corner */<br>
   prep_gl_for_pixels_upload_full (ctx,<br>
diff --git a/cogl/driver/gl/gles/cogl-texture-driver-gles.c b/cogl/driver/gl/gles/cogl-texture-driver-gles.c<br>
index 360d46a..5a4e0fa 100644<br>
--- a/cogl/driver/gl/gles/cogl-texture-driver-gles.c<br>
+++ b/cogl/driver/gl/gles/cogl-texture-driver-gles.c<br>
@@ -290,6 +290,7 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx,<br>
   CoglBitmap *bmp;<br>
   uint8_t *data;<br>
   GLenum gl_error;<br>
+  CoglError *internal_error = NULL;<br>
   CoglBool status = TRUE;<br>
<br>
   bmp = prepare_bitmap_alignment_for_upload (ctx, source_bmp, error);<br>
@@ -303,10 +304,18 @@ _cogl_texture_driver_upload_to_gl (CoglContext *ctx,<br>
<br>
   _cogl_bind_gl_texture_transient (gl_target, gl_handle, is_foreign);<br>
<br>
-  data = _cogl_bitmap_gl_bind (bmp, COGL_BUFFER_ACCESS_READ, 0, error);<br>
-  if (!data)<br>
+  data = _cogl_bitmap_gl_bind (bmp,<br>
+                               COGL_BUFFER_ACCESS_READ,<br>
+                               0, /* hints */<br>
+                               &internal_error);<br>
+<br>
+  /* NB: _cogl_bitmap_gl_bind() may return NULL when successful so we<br>
+   * have to explicitly check the cogl error pointer to catch<br>
+   * problems... */<br>
+  if (internal_error)<br>
     {<br>
       cogl_object_unref (bmp);<br>
+      _cogl_propagate_error (error, internal_error);<br>
       return FALSE;<br>
     }<br>
<br>
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c<br>
index 78eefc3..ab5dd04 100644<br>
--- a/tests/conform/test-conform-main.c<br>
+++ b/tests/conform/test-conform-main.c<br>
@@ -67,8 +67,8 @@ main (int argc, char **argv)<br>
   UNPORTED_TEST (test_multitexture);<br>
   UNPORTED_TEST (test_texture_mipmaps);<br>
   ADD_TEST (test_sub_texture, 0, 0);<br>
-  ADD_TEST (test_pixel_buffer_map, 0, TEST_KNOWN_FAILURE);<br>
-  ADD_TEST (test_pixel_buffer_set_data, 0, TEST_KNOWN_FAILURE);<br>
+  ADD_TEST (test_pixel_buffer_map, 0, 0);<br>
+  ADD_TEST (test_pixel_buffer_set_data, 0, 0);<br>
   ADD_TEST (test_pixel_buffer_sub_region, 0, 0);<br>
   UNPORTED_TEST (test_texture_rectangle);<br>
   ADD_TEST (test_texture_3d, TEST_REQUIREMENT_TEXTURE_3D, 0);<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.7.11.3.g3c3efa5<br>
<br>
_______________________________________________<br>
Cogl mailing list<br>
<a href="mailto:Cogl@lists.freedesktop.org">Cogl@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/cogl" target="_blank">http://lists.freedesktop.org/mailman/listinfo/cogl</a><br>
</font></span></blockquote></div><br></div>