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
This commit is contained in:
Sergey Sharybin 2021-11-12 16:12:05 +01:00
parent 3ad2bf1327
commit f71813204c
1 changed files with 15 additions and 3 deletions

View File

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