[Bf-blender-cvs] [f71813204c4] blender-v3.0-release: Cycles: Don't tile if image area fits into tile area

Sergey Sharybin noreply at git.blender.org
Thu Nov 18 14:27:52 CET 2021


Commit: f71813204c405821bb2efb8e4ad65d240d390eaf
Author: Sergey Sharybin
Date:   Fri Nov 12 16:12:05 2021 +0100
Branches: blender-v3.0-release
https://developer.blender.org/rBf71813204c405821bb2efb8e4ad65d240d390eaf

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

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

M	intern/cycles/session/session.cpp

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

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);
 }



More information about the Bf-blender-cvs mailing list