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.
This commit is contained in:
parent
5f632f9f6e
commit
ae0f944a57
|
@ -485,12 +485,6 @@ void BlenderGPUDisplay::do_draw(const GPUDisplayParams ¶ms)
|
|||
/* 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 ¶ms)
|
|||
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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue