[gegl/gsoc2009-gpu] GeglTile: force synchronization of tile data before a clone



commit a255b15a1c38b1404b735127459f84e4317fdee2
Author: Jerson Michael Perpetua <jersonperpetua gmail com>
Date:   Thu Jul 16 09:08:21 2009 +0800

    GeglTile: force synchronization of tile data before a clone
    
    Synchronize the tile's data and GPU data before a clone through
    gegl_tile_dup ().

 gegl/buffer/gegl-tile.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile.c b/gegl/buffer/gegl-tile.c
index a057658..ff5408e 100644
--- a/gegl/buffer/gegl-tile.c
+++ b/gegl/buffer/gegl-tile.c
@@ -231,6 +231,24 @@ gegl_tile_dup (GeglTile *src)
 {
   GeglTile *tile = g_object_new (GEGL_TYPE_TILE, NULL);
 
+  if (gegl_gpu_is_accelerated ())
+    {
+      if (src->rev > src->gpu_rev)
+        {
+          gegl_gpu_texture_set (src->gpu_data, NULL, src->data,
+                                gegl_tile_get_format (src));
+
+          src->gpu_rev = src->rev;
+        }
+      else if (src->gpu_rev > src->rev)
+        {
+          gegl_gpu_texture_get (src->gpu_data, NULL, src->data,
+                                gegl_tile_get_format (src));
+
+          src->rev = src->gpu_rev;
+        }
+    }
+
   tile->data     = src->data;
   tile->size     = src->size;
   tile->gpu_data = src->gpu_data;



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