[Bf-blender-cvs] [0d4c53ecfeb] master: Fix wrong tile size calculated in Cycles

Sergey Sharybin noreply at git.blender.org
Thu Oct 7 16:21:33 CEST 2021


Commit: 0d4c53ecfebb49a8c4e00f984756e0d243968abe
Author: Sergey Sharybin
Date:   Thu Oct 7 16:19:50 2021 +0200
Branches: master
https://developer.blender.org/rB0d4c53ecfebb49a8c4e00f984756e0d243968abe

Fix wrong tile size calculated in Cycles

Was causing extra overscan pixels, and was confusing multiple workers
check after fix T91994.

===================================================================

M	intern/cycles/render/tile.cpp

===================================================================

diff --git a/intern/cycles/render/tile.cpp b/intern/cycles/render/tile.cpp
index 75c1f78982d..3070e93eff3 100644
--- a/intern/cycles/render/tile.cpp
+++ b/intern/cycles/render/tile.cpp
@@ -411,25 +411,22 @@ Tile TileManager::get_tile_for_index(int index) const
   const int tile_index_y = index / tile_state_.num_tiles_x;
   const int tile_index_x = index - tile_index_y * tile_state_.num_tiles_x;
 
-  const int tile_x = tile_index_x * tile_size_.x;
-  const int tile_y = tile_index_y * tile_size_.y;
+  const int tile_window_x = tile_index_x * tile_size_.x;
+  const int tile_window_y = tile_index_y * tile_size_.y;
 
   Tile tile;
 
-  tile.x = tile_x - overscan_;
-  tile.y = tile_y - overscan_;
-  tile.width = tile_size_.x + 2 * overscan_;
-  tile.height = tile_size_.y + 2 * overscan_;
+  tile.x = max(0, tile_window_x - overscan_);
+  tile.y = max(0, tile_window_y - overscan_);
 
-  tile.x = max(tile.x, 0);
-  tile.y = max(tile.y, 0);
-  tile.width = min(tile.width, buffer_params_.width - tile.x);
-  tile.height = min(tile.height, buffer_params_.height - tile.y);
+  tile.window_x = tile_window_x - tile.x;
+  tile.window_y = tile_window_y - tile.y;
+  tile.window_width = min(tile_size_.x, buffer_params_.width - tile_window_x);
+  tile.window_height = min(tile_size_.y, buffer_params_.height - tile_window_y);
 
-  tile.window_x = tile_x - tile.x;
-  tile.window_y = tile_y - tile.y;
-  tile.window_width = min(tile_size_.x, buffer_params_.width - (tile.x + tile.window_x));
-  tile.window_height = min(tile_size_.y, buffer_params_.height - (tile.y + tile.window_y));
+  tile.width = min(buffer_params_.width - tile.x, tile.window_x + tile.window_width + overscan_);
+  tile.height = min(buffer_params_.height - tile.y,
+                    tile.window_y + tile.window_height + overscan_);
 
   return tile;
 }



More information about the Bf-blender-cvs mailing list