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
path: root/intern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2021-09-30 12:44:53 +0300
committerSergey Sharybin <sergey@blender.org>2021-09-30 12:44:53 +0300
commitae0f944a579c98af0095258d83665d1d5b3423da (patch)
tree6b371fbcb772920928a66a4d2c402a310d2abcf8 /intern
parent5f632f9f6ed901baccf4d44fe0a2d846ccc266af (diff)
Fix Cycles viewport flickering
Caused by a lack of synchronization between update process which sets clear flag and the draw code checking the flag outside of a lock.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/blender/blender_gpu_display.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/intern/cycles/blender/blender_gpu_display.cpp b/intern/cycles/blender/blender_gpu_display.cpp
index 456ca676cce..5a4567deac3 100644
--- a/intern/cycles/blender/blender_gpu_display.cpp
+++ b/intern/cycles/blender/blender_gpu_display.cpp
@@ -485,12 +485,6 @@ void BlenderGPUDisplay::do_draw(const GPUDisplayParams &params)
/* See do_update_begin() for why no locking is required here. */
const bool transparent = true; // TODO(sergey): Derive this from Film.
- if (texture_.need_clear) {
- /* Texture is requested to be cleared and was not yet cleared.
- * Do early return which should be equivalent of drawing all-zero texture. */
- return;
- }
-
if (!gl_draw_resources_ensure()) {
return;
}
@@ -499,6 +493,16 @@ void BlenderGPUDisplay::do_draw(const GPUDisplayParams &params)
gl_context_mutex_.lock();
}
+ if (texture_.need_clear) {
+ /* Texture is requested to be cleared and was not yet cleared.
+ *
+ * Do early return which should be equivalent of drawing all-zero texture.
+ * Watchout for the lock though so that the clear happening during update is properly
+ * synchronized here. */
+ gl_context_mutex_.unlock();
+ return;
+ }
+
if (gl_upload_sync_) {
glWaitSync((GLsync)gl_upload_sync_, 0, GL_TIMEOUT_IGNORED);
}