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-10-22 18:24:18 +0300
committerSergey Sharybin <sergey@blender.org>2021-10-25 13:12:10 +0300
commit31f6e7837024672a895bba0390f6e25df0482162 (patch)
tree2c8868f11bd74ce4e1154b1d2b5941e4cce37378 /intern/cycles/blender
parentbeea601e7253f1eafbf43ce3c0e59497788335bc (diff)
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
Diffstat (limited to 'intern/cycles/blender')
-rw-r--r--intern/cycles/blender/blender_display_driver.cpp35
-rw-r--r--intern/cycles/blender/blender_display_driver.h3
2 files changed, 29 insertions, 9 deletions
diff --git a/intern/cycles/blender/blender_display_driver.cpp b/intern/cycles/blender/blender_display_driver.cpp
index f55a8ce8c4e..3870f4956f2 100644
--- a/intern/cycles/blender/blender_display_driver.cpp
+++ b/intern/cycles/blender/blender_display_driver.cpp
@@ -357,6 +357,8 @@ bool BlenderDisplayDriver::update_begin(const Params &params,
* centralized place. */
texture_.need_update = true;
+ texture_.params = params;
+
return true;
}
@@ -717,8 +719,23 @@ void BlenderDisplayDriver::texture_update_if_needed()
texture_.need_update = false;
}
-void BlenderDisplayDriver::vertex_buffer_update(const Params &params)
+void BlenderDisplayDriver::vertex_buffer_update(const Params & /*params*/)
{
+ /* Draw at the parameters for which the texture has been updated for. This allows to always draw
+ * texture during bordered-rendered camera view without flickering. The validness of the display
+ * parameters for a texture is guaranteed by the initial "clear" state which makes drawing to
+ * have an early output.
+ *
+ * Such approach can cause some extra "jelly" effect during panning, but it is not more jelly
+ * than overlay of selected objects. Also, it's possible to redraw texture at an intersection of
+ * the texture draw parameters and the latest updated draw paaremters (altohoyugh, complexity of
+ * doing it might not worth it. */
+ const int x = texture_.params.full_offset.x;
+ const int y = texture_.params.full_offset.y;
+
+ const int width = texture_.params.size.x;
+ const int height = texture_.params.size.y;
+
/* Invalidate old contents - avoids stalling if the buffer is still waiting in queue to be
* rendered. */
glBufferData(GL_ARRAY_BUFFER, 16 * sizeof(float), NULL, GL_STREAM_DRAW);
@@ -730,23 +747,23 @@ void BlenderDisplayDriver::vertex_buffer_update(const Params &params)
vpointer[0] = 0.0f;
vpointer[1] = 0.0f;
- vpointer[2] = params.full_offset.x;
- vpointer[3] = params.full_offset.y;
+ vpointer[2] = x;
+ vpointer[3] = y;
vpointer[4] = 1.0f;
vpointer[5] = 0.0f;
- vpointer[6] = (float)params.size.x + params.full_offset.x;
- vpointer[7] = params.full_offset.y;
+ vpointer[6] = x + width;
+ vpointer[7] = y;
vpointer[8] = 1.0f;
vpointer[9] = 1.0f;
- vpointer[10] = (float)params.size.x + params.full_offset.x;
- vpointer[11] = (float)params.size.y + params.full_offset.y;
+ vpointer[10] = x + width;
+ vpointer[11] = y + height;
vpointer[12] = 0.0f;
vpointer[13] = 1.0f;
- vpointer[14] = params.full_offset.x;
- vpointer[15] = (float)params.size.y + params.full_offset.y;
+ vpointer[14] = x;
+ vpointer[15] = y + height;
glUnmapBuffer(GL_ARRAY_BUFFER);
}
diff --git a/intern/cycles/blender/blender_display_driver.h b/intern/cycles/blender/blender_display_driver.h
index 558997c6b4f..5e7e9b01065 100644
--- a/intern/cycles/blender/blender_display_driver.h
+++ b/intern/cycles/blender/blender_display_driver.h
@@ -188,6 +188,9 @@ class BlenderDisplayDriver : public DisplayDriver {
/* Dimensions of the underlying PBO. */
int buffer_width = 0;
int buffer_height = 0;
+
+ /* Display parameters the texture has been updated for. */
+ Params params;
} texture_;
unique_ptr<BlenderDisplayShader> display_shader_;