From 31f6e7837024672a895bba0390f6e25df0482162 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 22 Oct 2021 17:24:18 +0200 Subject: Fix T92073: Cycles flicker when panning in camera view with border render Panning in camera view makes the border to be modified, which was causing the Cycles display to believe the rendered result is unusable. The solution is to draw the render result at the display parameters it was updated for. This allows to avoid flickering during panning, zooming, and camera FOV changes. The suboptimal aspect of this is that it has some jelly effect, although it is on the same level as jelly effect of object outline so it is not terrible. Differential Revision: https://developer.blender.org/D12970 --- intern/cycles/integrator/path_trace_display.cpp | 19 +------------------ intern/cycles/integrator/path_trace_display.h | 9 --------- 2 files changed, 1 insertion(+), 27 deletions(-) (limited to 'intern/cycles/integrator') diff --git a/intern/cycles/integrator/path_trace_display.cpp b/intern/cycles/integrator/path_trace_display.cpp index 28f0a7f7745..e22989bb301 100644 --- a/intern/cycles/integrator/path_trace_display.cpp +++ b/intern/cycles/integrator/path_trace_display.cpp @@ -30,29 +30,16 @@ void PathTraceDisplay::reset(const BufferParams &buffer_params) { thread_scoped_lock lock(mutex_); - const DisplayDriver::Params old_params = params_; - params_.full_offset = make_int2(buffer_params.full_x, buffer_params.full_y); params_.full_size = make_int2(buffer_params.full_width, buffer_params.full_height); params_.size = make_int2(buffer_params.width, buffer_params.height); - /* If the parameters did change tag texture as unusable. This avoids drawing old texture content - * in an updated configuration of the viewport. For example, avoids drawing old frame when render - * border did change. - * If the parameters did not change, allow drawing the current state of the texture, which will - * not count as an up-to-date redraw. This will avoid flickering when doping camera navigation by - * showing a previously rendered frame for until the new one is ready. */ - if (old_params.modified(params_)) { - texture_state_.is_usable = false; - } - texture_state_.is_outdated = true; } void PathTraceDisplay::mark_texture_updated() { texture_state_.is_outdated = false; - texture_state_.is_usable = true; } /* -------------------------------------------------------------------- @@ -248,19 +235,15 @@ bool PathTraceDisplay::draw() * The drawing itself is non-blocking however, for better performance and to avoid * potential deadlocks due to locks held by the subclass. */ DisplayDriver::Params params; - bool is_usable; bool is_outdated; { thread_scoped_lock lock(mutex_); params = params_; - is_usable = texture_state_.is_usable; is_outdated = texture_state_.is_outdated; } - if (is_usable) { - driver_->draw(params); - } + driver_->draw(params); return !is_outdated; } diff --git a/intern/cycles/integrator/path_trace_display.h b/intern/cycles/integrator/path_trace_display.h index 24aaa0df6b1..99d2e0e1203 100644 --- a/intern/cycles/integrator/path_trace_display.h +++ b/intern/cycles/integrator/path_trace_display.h @@ -174,15 +174,6 @@ class PathTraceDisplay { /* State of the texture, which is needed for an integration with render session and interactive * updates and navigation. */ struct { - /* Denotes whether possibly existing state of GPU side texture is still usable. - * It will not be usable in cases like render border did change (in this case we don't want - * previous texture to be rendered at all). - * - * However, if only navigation or object in scene did change, then the outdated state of the - * texture is still usable for draw, preventing display viewport flickering on navigation and - * object modifications. */ - bool is_usable = false; - /* Texture is considered outdated after `reset()` until the next call of * `copy_pixels_to_texture()`. */ bool is_outdated = true; -- cgit v1.2.3