diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-04-25 17:24:06 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-04-30 15:01:22 +0300 |
commit | d1f6ea2793d2b756b4f903f3ee7d09a90cf11890 (patch) | |
tree | 29a7b2954f6408afa682d446eaf433692c432528 | |
parent | 3e780507bd613d2b7e2ca3de178bf8108dcae9bc (diff) |
Sequencer: Scene Strip Performance
- Merged SEQ_OFSDRAW with V3D_OFSDRAW and define in the
DNA_view3d_types: Due to this FSAA always kicked in making the
rendering slow.
- Removed `Texture Solid` and `DOF`.
- Now when chosing Solid rendering the settings
of the original scene is used.
- Added a global override to use scene specific shading. In the
Future we will need to enhanced this so user can change the
settings.
- Added support for LookDev. LookDev crashed as it needed the
`evil_C` what was not set
- LookDev mode will always show the scene + world lights.
Reviewed By: brecht, fclem
Maniphest Tasks: T62517
Differential Revision: https://developer.blender.org/D4738
-rw-r--r-- | release/scripts/startup/bl_ui/space_sequencer.py | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_sequencer.h | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 18 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager_shader.c | 6 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 12 | ||||
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 3 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 20 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_view3d_types.h | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 15 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 1 |
11 files changed, 49 insertions, 61 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index b6494e33f93..7f54276c7e5 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -1291,7 +1291,7 @@ class SEQUENCER_PT_strip_cache(SequencerButtonsPanel, Panel): class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): - bl_label = "Scene Preview & Render" + bl_label = "Scene Shading" bl_space_type = 'SEQUENCE_EDITOR' bl_region_type = 'UI' bl_category = "Strip" @@ -1304,11 +1304,8 @@ class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): col = layout.column() col.prop(render, "sequencer_gl_preview", text="") - row = col.row() - row.active = render.sequencer_gl_preview == 'SOLID' - row.prop(render, "use_sequencer_gl_textured_solid") - - col.prop(render, "use_sequencer_gl_dof") + if render.sequencer_gl_preview in ['SOLID', 'WIREFRAME']: + col.prop(render, "use_sequencer_override_scene_strip") class SEQUENCER_PT_view(SequencerButtonsPanel_Output, Panel): diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h index 5485b2d3619..84d26bd1db9 100644 --- a/source/blender/blenkernel/BKE_sequencer.h +++ b/source/blender/blenkernel/BKE_sequencer.h @@ -100,7 +100,6 @@ typedef struct SeqRenderData { /* special case for OpenGL render */ struct GPUOffScreen *gpu_offscreen; - struct GPUFX *gpu_fx; int gpu_samples; bool gpu_full_samples; } SeqRenderData; @@ -487,19 +486,9 @@ struct Sequence *BKE_sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load); -/* view3d draw callback, run when not in background view */ -/* NOTE: Keep in sync with V3D_OFSDRAW_* flags. */ -enum { - SEQ_OFSDRAW_NONE = (0), - SEQ_OFSDRAW_USE_BACKGROUND = (1 << 0), - SEQ_OFSDRAW_USE_FULL_SAMPLE = (1 << 1), - SEQ_OFSDRAW_USE_GPENCIL = (1 << 2), - SEQ_OFSDRAW_USE_SOLID_TEX = (1 << 2), - SEQ_OFSDRAW_USE_CAMERA_DOF = (1 << 3), -}; - typedef struct ImBuf *(*SequencerDrawView)(struct Depsgraph *depsgraph, struct Scene *scene, + struct View3DShading *shading_override, int drawtype, struct Object *camera, int width, diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 2887f30532e..47f9c841e12 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -3454,9 +3454,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, const bool is_rendering = G.is_rendering; const bool is_background = G.background; - const bool do_seq_gl = is_rendering ? 0 /* (context->scene->r.seq_flag & R_SEQ_GL_REND) */ : - (context->scene->r.seq_prev_type) != OB_RENDER; - // bool have_seq = false; /* UNUSED */ + const bool do_seq_gl = is_rendering ? 0 : (context->scene->r.seq_prev_type) != OB_RENDER; bool have_comp = false; bool use_gpencil = true; /* do we need to re-evaluate the frame after rendering? */ @@ -3521,15 +3519,14 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, char err_out[256] = "unknown"; const int width = (scene->r.xsch * scene->r.size) / 100; const int height = (scene->r.ysch * scene->r.size) / 100; - const bool use_background = (scene->r.alphamode == R_ADDSKY); const char *viewname = BKE_scene_multiview_render_view_name_get(&scene->r, context->view_id); - unsigned int draw_flags = SEQ_OFSDRAW_NONE; - draw_flags |= (use_gpencil) ? SEQ_OFSDRAW_USE_GPENCIL : 0; - draw_flags |= (use_background) ? SEQ_OFSDRAW_USE_BACKGROUND : 0; - draw_flags |= (context->gpu_full_samples) ? SEQ_OFSDRAW_USE_FULL_SAMPLE : 0; - draw_flags |= (context->scene->r.seq_flag & R_SEQ_SOLID_TEX) ? SEQ_OFSDRAW_USE_SOLID_TEX : 0; - draw_flags |= (context->scene->r.seq_flag & R_SEQ_CAMERA_DOF) ? SEQ_OFSDRAW_USE_CAMERA_DOF : 0; + unsigned int draw_flags = V3D_OFSDRAW_NONE; + draw_flags |= (use_gpencil) ? V3D_OFSDRAW_SHOW_ANNOTATION : 0; + draw_flags |= (context->gpu_full_samples) ? V3D_OFSDRAW_USE_FULL_SAMPLE : 0; + draw_flags |= (context->scene->r.seq_flag & R_SEQ_OVERRIDE_SCENE_SETTINGS) ? + V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS : + 0; /* for old scene this can be uninitialized, * should probably be added to do_versions at some point if the functionality stays */ @@ -3544,6 +3541,7 @@ static ImBuf *seq_render_scene_strip(const SeqRenderData *context, /* set for OpenGL render (NULL when scrubbing) */ depsgraph, scene, + &context->scene->display.shading, context->scene->r.seq_prev_type, camera, width, diff --git a/source/blender/draw/intern/draw_manager_shader.c b/source/blender/draw/intern/draw_manager_shader.c index 9cb3c1bf226..40d6ae1024a 100644 --- a/source/blender/draw/intern/draw_manager_shader.c +++ b/source/blender/draw/intern/draw_manager_shader.c @@ -161,8 +161,10 @@ static void drw_deferred_shader_compilation_free(void *custom_data) static void drw_deferred_shader_add(GPUMaterial *mat, bool deferred) { - /* Do not deferre the compilation if we are rendering for image. */ - if (DRW_state_is_image_render() || !USE_DEFERRED_COMPILATION || !deferred) { + /* Do not deferre the compilation if we are rendering for image. + * deferred rendering is only possible when `evil_C` is available */ + if (DST.draw_ctx.evil_C == NULL || DRW_state_is_image_render() || !USE_DEFERRED_COMPILATION || + !deferred) { /* Double checking that this GPUMaterial is not going to be * compiled by another thread. */ DRW_deferred_shader_remove(mat); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index caa202c46a8..fd51419a3ee 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -54,6 +54,7 @@ struct RenderEngineType; struct Scene; struct ScrArea; struct View3D; +struct View3DShading; struct ViewContext; struct ViewLayer; struct WorkSpace; @@ -584,16 +585,6 @@ void ED_view3d_draw_setup_view(struct wmWindow *win, float winmat[4][4], const struct rcti *rect); -enum { - V3D_OFSDRAW_NONE = (0), - - V3D_OFSDRAW_USE_FULL_SAMPLE = (1 << 0), - - /* Only works with ED_view3d_draw_offscreen_imbuf_simple(). */ - V3D_OFSDRAW_USE_GPENCIL = (1 << 1), - V3D_OFSDRAW_USE_CAMERA_DOF = (1 << 2), -}; - struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph, struct Scene *scene, int drawtype, @@ -610,6 +601,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph, char err_out[256]); struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(struct Depsgraph *depsgraph, struct Scene *scene, + struct View3DShading *shading_override, int drawtype, struct Object *camera, int width, diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 41ef5d81901..28cfce00e6e 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -381,9 +381,10 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R } } else { - draw_flags |= V3D_OFSDRAW_USE_GPENCIL; + draw_flags |= V3D_OFSDRAW_SHOW_ANNOTATION; ibuf_view = ED_view3d_draw_offscreen_imbuf_simple(depsgraph, scene, + NULL, OB_SOLID, scene->camera, oglrender->sizex, diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 12ce793e3ef..3cd4c65e65d 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1824,6 +1824,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph, */ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph, Scene *scene, + View3DShading *shading_override, int drawtype, Object *camera, int width, @@ -1846,22 +1847,25 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph, ar.regiontype = RGN_TYPE_WINDOW; v3d.camera = camera; + View3DShading *source_shading_settings = &scene->display.shading; + if (draw_flags & V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS && shading_override != NULL) { + source_shading_settings = shading_override; + } + memcpy(&v3d.shading, source_shading_settings, sizeof(View3DShading)); v3d.shading.type = drawtype; + + if (drawtype == OB_MATERIAL) { + v3d.shading.flag = V3D_SHADING_SCENE_WORLD | V3D_SHADING_SCENE_LIGHTS; + } + v3d.flag2 = V3D_HIDE_OVERLAYS; - if (draw_flags & V3D_OFSDRAW_USE_GPENCIL) { + if (draw_flags & V3D_OFSDRAW_SHOW_ANNOTATION) { v3d.flag2 |= V3D_SHOW_ANNOTATION; } v3d.shading.background_type = V3D_SHADING_BACKGROUND_WORLD; - if (draw_flags & V3D_OFSDRAW_USE_CAMERA_DOF) { - if (camera->type == OB_CAMERA) { - v3d.fx_settings.dof = &((Camera *)camera->data)->gpu_dof; - v3d.fx_settings.fx_flag |= GPU_FX_FLAG_DOF; - } - } - rv3d.persp = RV3D_CAMOB; copy_m4_m4(rv3d.viewinv, v3d.camera->obmat); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index e3285a510ac..6d0977c5eef 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1816,8 +1816,9 @@ enum { R_SEQ_UNUSED_0 = (1 << 0), /* cleared */ R_SEQ_UNUSED_1 = (1 << 1), /* cleared */ R_SEQ_UNUSED_2 = (1 << 2), /* cleared */ - R_SEQ_SOLID_TEX = (1 << 3), - R_SEQ_CAMERA_DOF = (1 << 4), + R_SEQ_UNUSED_3 = (1 << 3), /* cleared */ + R_SEQ_UNUSED_4 = (1 << 4), /* cleared */ + R_SEQ_OVERRIDE_SCENE_SETTINGS = (1 << 5), }; /* RenderData.displaymode */ diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index 0667ab3aee0..d5ac8cc197b 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -581,6 +581,14 @@ enum { V3D_GIZMO_SHOW_CAMERA_DOF_DIST = (1 << 2), }; +/** Settings for offscreen rendering */ +enum { + V3D_OFSDRAW_NONE = (0), + V3D_OFSDRAW_USE_FULL_SAMPLE = (1 << 0), + V3D_OFSDRAW_SHOW_ANNOTATION = (1 << 1), + V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS = (1 << 2), +}; + #define RV3D_CAMZOOM_MIN -30 #define RV3D_CAMZOOM_MAX 600 diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index bb42c044c6d..fb820f93c1d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -6154,17 +6154,12 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop, "Sequencer Preview Shading", "Method to draw in the sequencer view"); # endif - prop = RNA_def_property(srna, "use_sequencer_gl_textured_solid", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_SOLID_TEX); - RNA_def_property_ui_text( - prop, "Textured Solid", "Display face-assigned textures in solid draw method"); - RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update"); - - prop = RNA_def_property(srna, "use_sequencer_gl_dof", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_CAMERA_DOF); + prop = RNA_def_property(srna, "use_sequencer_override_scene_strip", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_OVERRIDE_SCENE_SETTINGS); RNA_def_property_ui_text(prop, - "Depth of Field", - "Use depth of field using the values from scene strip active camera"); + "Override Scene Settings", + "Use workbench render settings from the sequencer scene, instead of " + "each individual scene used in the strip"); RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update"); prop = RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index d75853d623d..6d90d4745a6 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1223,6 +1223,7 @@ static ImBuf *blend_file_thumb(const bContext *C, if (scene->camera) { ibuf = ED_view3d_draw_offscreen_imbuf_simple(depsgraph, scene, + NULL, OB_SOLID, scene->camera, BLEN_THUMB_SIZE * 2, |