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-08-31 12:03:33 +0300
committerSergey Sharybin <sergey@blender.org>2021-08-31 12:05:57 +0300
commitf6d133e2d2ee30efd6d9c89dd5df2898983c3584 (patch)
tree50fb9bcd862f5e3d0e9e83d1a29110bb0642143b /source/blender
parentf4eacad48f594b9bffc7e857b211513d6f780f8e (diff)
Fix possible wrongly highlighted tiles
Run into it when was re-working tiles in the Cycles X project. Make sure the storage of highlighted tiles is emptied when the render is finished or cancelled). The error is only possible to happen if the engine did not do something correct, but is still good to deal with such situations more gracefully.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/render/intern/pipeline.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/render/intern/pipeline.c b/source/blender/render/intern/pipeline.c
index bf42adbab87..0f9e1c944f5 100644
--- a/source/blender/render/intern/pipeline.c
+++ b/source/blender/render/intern/pipeline.c
@@ -1870,6 +1870,21 @@ static void render_pipeline_free(Render *re)
}
/* Destroy the opengl context in the correct thread. */
RE_gl_context_destroy(re);
+
+ /* In the case the engine did not mark tiles as finished (un-highlight, which could happen in the
+ * case of cancelled render) ensure the storage is empty. */
+ if (re->highlighted_tiles != NULL) {
+ BLI_mutex_lock(&re->highlighted_tiles_mutex);
+
+ /* Rendering is supposed to be finished here, so no new tiles are expected to be written.
+ * Only make it so possible read-only access to the highlighted tiles is thread-safe. */
+ BLI_assert(re->highlighted_tiles);
+
+ BLI_gset_free(re->highlighted_tiles, MEM_freeN);
+ re->highlighted_tiles = NULL;
+
+ BLI_mutex_unlock(&re->highlighted_tiles_mutex);
+ }
}
/* general Blender frame render call */