Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2021-11-12 18:12:05 +0300
committerSergey Sharybin <sergey@blender.org>2021-11-18 16:27:45 +0300
commitf71813204c405821bb2efb8e4ad65d240d390eaf (patch)
treeaffb62a1b98b00122ecf683846ad61406d6f1d93
parent3ad2bf1327cac5f036d763e1cc690b1b2da8e1c4 (diff)
Cycles: Don't tile if image area fits into tile area
Previously the check was done based on dimension of image and if any of dimensions were larger than tile size tiling was used. This change makes it so that if image does not exceed number of pixels in the tile no tile will be used. Allows to render widescreen images without tiling. Differential Revision: https://developer.blender.org/D13206
-rw-r--r--intern/cycles/session/session.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/intern/cycles/session/session.cpp b/intern/cycles/session/session.cpp
index 65c46d0dd3c..530baa8cafb 100644
--- a/intern/cycles/session/session.cpp
+++ b/intern/cycles/session/session.cpp
@@ -367,14 +367,26 @@ void Session::draw()
int2 Session::get_effective_tile_size() const
{
+ const int image_width = buffer_params_.width;
+ const int image_height = buffer_params_.height;
+
/* No support yet for baking with tiles. */
if (!params.use_auto_tile || scene->bake_manager->get_baking()) {
- return make_int2(buffer_params_.width, buffer_params_.height);
+ return make_int2(image_width, image_height);
}
- /* TODO(sergey): Take available memory into account, and if there is enough memory do not tile
- * and prefer optimal performance. */
+ const int64_t image_area = static_cast<int64_t>(image_width) * image_height;
+
+ /* TODO(sergey): Take available memory into account, and if there is enough memory do not
+ * tile and prefer optimal performance. */
+
const int tile_size = tile_manager_.compute_render_tile_size(params.tile_size);
+ const int64_t actual_tile_area = static_cast<int64_t>(tile_size) * tile_size;
+
+ if (actual_tile_area >= image_area) {
+ return make_int2(image_width, image_height);
+ }
+
return make_int2(tile_size, tile_size);
}