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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-06-28 17:37:13 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-06-28 17:47:55 +0300
commitd44aebd3fe6e706c0c9d7938ed6f695163f268b8 (patch)
tree7384f52307e64b079ff11a621bf461055fc8c57b /source/blender/editors/render/render_preview.c
parente8cb477f8ab081f1a867b1f1716f290ea08b3abf (diff)
Previews: delay icon preview renders a bit for smoother interaction
With Eevee the user interface, 3D viewport and small icon materials previews are rendered on the same GPU. This can lead to some choppy interaction when dragging sliders. Delaying the icon preview render until the user is done with that helps a bit, though it's no guarantee.
Diffstat (limited to 'source/blender/editors/render/render_preview.c')
-rw-r--r--source/blender/editors/render/render_preview.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 76b88b8df22..35130988aba 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -38,6 +38,8 @@
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
+#include "PIL_time.h"
+
#include "BLO_readfile.h"
#include "DNA_world_types.h"
@@ -1206,6 +1208,16 @@ static void icon_preview_startjob_all_sizes(void *customdata,
IconPreview *ip = (IconPreview *)customdata;
IconPreviewSize *cur_size;
+ /* Wait 2s to start rendering icon previews, to not bog down user interaction.
+ * Particularly important for heavy scenes and Eevee using OpenGL that blocks
+ * the user interface drawing. */
+ for (int i = 0; i < 20; i++) {
+ PIL_sleep_ms(100);
+ if (*stop) {
+ return;
+ }
+ }
+
for (cur_size = ip->sizes.first; cur_size; cur_size = cur_size->next) {
PreviewImage *prv = ip->owner;
@@ -1253,6 +1265,10 @@ static void icon_preview_startjob_all_sizes(void *customdata,
common_preview_startjob(sp, stop, do_update, progress);
shader_preview_free(sp);
+
+ if (*stop) {
+ break;
+ }
}
}
@@ -1470,6 +1486,9 @@ void ED_preview_shader_job(const bContext *C,
void ED_preview_kill_jobs(wmWindowManager *wm, Main *UNUSED(bmain))
{
if (wm) {
+ /* This is called to stop all preview jobs before scene data changes, to
+ * avoid invalid memory access. */
WM_jobs_kill(wm, NULL, common_preview_startjob);
+ WM_jobs_kill(wm, NULL, icon_preview_startjob_all_sizes);
}
}