Revision: 49550
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=49550
Author:   nazgul
Date:     2012-08-04 09:13:52 +0000 (Sat, 04 Aug 2012)
Log Message:
-----------
Tomato Cycles: minor code cleanup

Move center tile acquiring code into own function. Should be
easier for time being when we'll want to support other tile
render orders.

Also now there should be a single bucket growing from center
when multi-GPU is used. Can't test this here tho.

Modified Paths:
--------------
    branches/soc-2011-tomato/intern/cycles/render/tile.cpp
    branches/soc-2011-tomato/intern/cycles/render/tile.h

Modified: branches/soc-2011-tomato/intern/cycles/render/tile.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/render/tile.cpp      2012-08-04 
01:49:33 UTC (rev 49549)
+++ branches/soc-2011-tomato/intern/cycles/render/tile.cpp      2012-08-04 
09:13:52 UTC (rev 49550)
@@ -113,7 +113,7 @@
        state.buffer.full_height = max(1, params.full_height/resolution);
 }
 
-bool TileManager::next_tile(Tile& tile, int device)
+list<Tile>::iterator TileManager::next_center_tile(int device)
 {
        list<Tile>::iterator iter, best = state.tiles.end();
 
@@ -131,7 +131,7 @@
 
        /* find center of rendering tiles, image center counts for 1 too */
        for(iter = state.tiles.begin(); iter != state.tiles.end(); iter++) {
-               if(iter->device == device && iter->rendering) {
+               if(iter->rendering) {
                        Tile &cur_tile = *iter;
                        centx += cur_tile.x + cur_tile.w / 2;
                        centy += cur_tile.y + cur_tile.h / 2;
@@ -151,16 +151,25 @@
                        int64_t disty = centy - (cur_tile.y + cur_tile.h / 2);
                        distx = (int64_t) sqrt((double)distx * distx + disty * 
disty);
 
-                       if (distx < mindist) {
+                       if(distx < mindist) {
                                best = iter;
                                mindist = distx;
                        }
                }
        }
 
-       if (best != state.tiles.end()) {
-               best->rendering = true;
-               tile = *best;
+       return best;
+}
+
+bool TileManager::next_tile(Tile& tile, int device)
+{
+       list<Tile>::iterator tile_it;
+
+       tile_it = next_center_tile(device);
+
+       if(tile_it != state.tiles.end()) {
+               tile_it->rendering = true;
+               tile = *tile_it;
                state.num_rendered_tiles++;
 
                return true;

Modified: branches/soc-2011-tomato/intern/cycles/render/tile.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/render/tile.h        2012-08-04 
01:49:33 UTC (rev 49549)
+++ branches/soc-2011-tomato/intern/cycles/render/tile.h        2012-08-04 
09:13:52 UTC (rev 49550)
@@ -76,6 +76,8 @@
        int num_devices;
 
        int start_resolution;
+
+       list<Tile>::iterator next_center_tile(int device = 0);
 };
 
 CCL_NAMESPACE_END

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to