diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2020-05-14 15:30:34 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2020-05-14 15:30:34 +0300 |
commit | 236794d07a707a5cf4b8aff9d441f88590d69901 (patch) | |
tree | eb309de08263b2c0c5b4928ee1f112b1c3cd60bf /source/blender/draw | |
parent | c9360b239bc7ebe09721b7d740995f01ee7d8bb3 (diff) | |
parent | 7965c735f12b885803933363e9b1ca8e85067af6 (diff) |
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'source/blender/draw')
11 files changed, 48 insertions, 25 deletions
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c index ab53f7025c0..6658fea7825 100644 --- a/source/blender/draw/engines/basic/basic_engine.c +++ b/source/blender/draw/engines/basic/basic_engine.c @@ -202,7 +202,7 @@ static void basic_cache_populate(void *vedata, Object *ob) stl->g_data->depth_shgrp[do_in_front]; if (use_sculpt_pbvh) { - DRW_shgroup_call_sculpt(shgrp, ob, false, false, false); + DRW_shgroup_call_sculpt(shgrp, ob, false, false); } else { struct GPUBatch *geom = DRW_cache_object_surface_get(ob); diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index f0dbd47e146..03cdb02a48a 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -2073,23 +2073,21 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, } if (use_sculpt_pbvh) { - /* Vcol is not supported in the modes that require PBVH drawing. */ - const bool use_vcol = false; struct DRWShadingGroup **sculpt_shgrps_array = BLI_array_alloca(sculpt_shgrps_array, materials_len); for (int i = 0; i < materials_len; i++) { sculpt_shgrps_array[i] = shgrps_array[i].shading_grp; } - DRW_shgroup_call_sculpt_with_materials(sculpt_shgrps_array, materials_len, ob, use_vcol); + DRW_shgroup_call_sculpt_with_materials(sculpt_shgrps_array, materials_len, ob); for (int i = 0; i < materials_len; i++) { sculpt_shgrps_array[i] = shgrps_array[i].depth_grp; } - DRW_shgroup_call_sculpt_with_materials(sculpt_shgrps_array, materials_len, ob, use_vcol); + DRW_shgroup_call_sculpt_with_materials(sculpt_shgrps_array, materials_len, ob); for (int i = 0; i < materials_len; i++) { sculpt_shgrps_array[i] = shgrps_array[i].depth_clip_grp; } - DRW_shgroup_call_sculpt_with_materials(sculpt_shgrps_array, materials_len, ob, use_vcol); + DRW_shgroup_call_sculpt_with_materials(sculpt_shgrps_array, materials_len, ob); for (int renderpass_index = 0; renderpass_index < stl->g_data->render_passes_material_count; @@ -2097,7 +2095,7 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata, for (int i = 0; i < materials_len; i++) { sculpt_shgrps_array[i] = shgrps_array[i].material_accum_grp[renderpass_index]; } - DRW_shgroup_call_sculpt_with_materials(sculpt_shgrps_array, materials_len, ob, use_vcol); + DRW_shgroup_call_sculpt_with_materials(sculpt_shgrps_array, materials_len, ob); } /* TODO(fclem): Support shadows in sculpt mode. */ diff --git a/source/blender/draw/engines/external/external_engine.c b/source/blender/draw/engines/external/external_engine.c index ee4bd58ab80..7dddbd07623 100644 --- a/source/blender/draw/engines/external/external_engine.c +++ b/source/blender/draw/engines/external/external_engine.c @@ -25,10 +25,12 @@ #include "DRW_render.h" +#include "DNA_modifier_types.h" #include "DNA_screen_types.h" #include "DNA_view3d_types.h" #include "BKE_object.h" +#include "BKE_particle.h" #include "ED_screen.h" @@ -166,6 +168,24 @@ static void external_cache_populate(void *vedata, Object *ob) return; } + if (ob->type == OB_MESH && ob->modifiers.first != NULL) { + LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { + if (md->type != eModifierType_ParticleSystem) { + continue; + } + ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; + if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { + continue; + } + ParticleSettings *part = psys->part; + const int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as; + + if (draw_as == PART_DRAW_PATH) { + struct GPUBatch *hairs = DRW_cache_particles_get_hair(ob, psys, NULL); + DRW_shgroup_call(stl->g_data->depth_shgrp, hairs, NULL); + } + } + } struct GPUBatch *geom = DRW_cache_object_surface_get(ob); if (geom) { /* Depth Prepass */ diff --git a/source/blender/draw/engines/overlay/overlay_facing.c b/source/blender/draw/engines/overlay/overlay_facing.c index e98181ea718..9216ae61b3e 100644 --- a/source/blender/draw/engines/overlay/overlay_facing.c +++ b/source/blender/draw/engines/overlay/overlay_facing.c @@ -63,7 +63,7 @@ void OVERLAY_facing_cache_populate(OVERLAY_Data *vedata, Object *ob) const bool is_xray = (ob->dtx & OB_DRAWXRAY) != 0; if (use_sculpt_pbvh) { - DRW_shgroup_call_sculpt(pd->facing_grp[is_xray], ob, false, false, false); + DRW_shgroup_call_sculpt(pd->facing_grp[is_xray], ob, false, false); } else { struct GPUBatch *geom = DRW_cache_object_surface_get(ob); diff --git a/source/blender/draw/engines/overlay/overlay_sculpt.c b/source/blender/draw/engines/overlay/overlay_sculpt.c index 391c49e0695..111fa6316ed 100644 --- a/source/blender/draw/engines/overlay/overlay_sculpt.c +++ b/source/blender/draw/engines/overlay/overlay_sculpt.c @@ -54,7 +54,7 @@ void OVERLAY_sculpt_cache_populate(OVERLAY_Data *vedata, Object *ob) if (use_pbvh || !ob->sculpt->deform_modifiers_active || ob->sculpt->shapekey_active) { if (!use_pbvh || pbvh_has_mask(pbvh) || pbvh_has_face_sets(pbvh)) { - DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true, false); + DRW_shgroup_call_sculpt(pd->sculpt_mask_grp, ob, false, true); } } } diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.c b/source/blender/draw/engines/overlay/overlay_wireframe.c index 63a1a72c9a6..99ff7f67d49 100644 --- a/source/blender/draw/engines/overlay/overlay_wireframe.c +++ b/source/blender/draw/engines/overlay/overlay_wireframe.c @@ -230,7 +230,7 @@ void OVERLAY_wireframe_cache_populate(OVERLAY_Data *vedata, DRW_shgroup_call_no_cull(shgrp, geom, ob); } else if (use_sculpt_pbvh) { - DRW_shgroup_call_sculpt(shgrp, ob, true, false, false); + DRW_shgroup_call_sculpt(shgrp, ob, true, false); } else { DRW_shgroup_call(shgrp, geom, ob); diff --git a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c index 5c8730ac8f9..d2bd653a656 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c +++ b/source/blender/draw/engines/workbench/workbench_effect_antialiasing.c @@ -176,6 +176,14 @@ void workbench_antialiasing_engine_init(WORKBENCH_Data *vedata) } } + /* Reset the TAA when we have already draw a sample, but the sample count differs from previous + * time. This removes render artifacts when the viewport anti-aliasing in the user preferences is + * set to a lower value. */ + if (wpd->taa_sample_len != wpd->taa_sample_len_previous) { + wpd->taa_sample = 0; + wpd->taa_sample_len_previous = wpd->taa_sample_len; + } + if (wpd->view_updated) { wpd->taa_sample = 0; wpd->view_updated = false; diff --git a/source/blender/draw/engines/workbench/workbench_engine.c b/source/blender/draw/engines/workbench/workbench_engine.c index e75ba80608b..270a33fdd85 100644 --- a/source/blender/draw/engines/workbench/workbench_engine.c +++ b/source/blender/draw/engines/workbench/workbench_engine.c @@ -55,6 +55,7 @@ void workbench_engine_init(void *ved) if (!stl->wpd) { stl->wpd = MEM_callocN(sizeof(*stl->wpd), __func__); + stl->wpd->taa_sample_len_previous = -1; stl->wpd->view_updated = true; } @@ -118,7 +119,7 @@ static void workbench_cache_sculpt_populate(WORKBENCH_PrivateData *wpd, if (use_single_drawcall) { DRWShadingGroup *grp = workbench_material_setup(wpd, ob, 0, color_type, NULL); - DRW_shgroup_call_sculpt(grp, ob, false, false, use_vcol); + DRW_shgroup_call_sculpt(grp, ob, false, false); } else { const int materials_len = DRW_cache_object_material_count_get(ob); @@ -126,7 +127,7 @@ static void workbench_cache_sculpt_populate(WORKBENCH_PrivateData *wpd, for (int i = 0; i < materials_len; i++) { shgrps[i] = workbench_material_setup(wpd, ob, i + 1, color_type, NULL); } - DRW_shgroup_call_sculpt_with_materials(shgrps, materials_len, ob, false); + DRW_shgroup_call_sculpt_with_materials(shgrps, materials_len, ob); } } diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index 2191e09bc24..967bdf9bae0 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -261,6 +261,8 @@ typedef struct WORKBENCH_PrivateData { /* Temporal Antialiasing */ /** Total number of samples to after which TAA stops accumulating samples. */ int taa_sample_len; + /** Total number of samples of the previous TAA. When changed TAA will be reset. */ + int taa_sample_len_previous; /** Current TAA sample index in [0..taa_sample_len[ range. */ int taa_sample; /** Inverse of taa_sample to divide the accumulation buffer. */ diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 663567fd51e..c4d9396307a 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -410,11 +410,8 @@ void DRW_shgroup_call_instances_with_attrs(DRWShadingGroup *shgroup, struct GPUBatch *geom, struct GPUBatch *inst_attributes); -void DRW_shgroup_call_sculpt(DRWShadingGroup *sh, Object *ob, bool wire, bool mask, bool vcol); -void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **sh, - int num_sh, - Object *ob, - bool vcol); +void DRW_shgroup_call_sculpt(DRWShadingGroup *sh, Object *ob, bool wire, bool mask); +void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **sh, int num_sh, Object *ob); DRWCallBuffer *DRW_shgroup_call_buffer(DRWShadingGroup *shading_group, struct GPUVertFormat *format, diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 1d0fe957631..95b204ac004 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -954,7 +954,7 @@ static void drw_sculpt_get_frustum_planes(Object *ob, float planes[6][4]) } } -static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd, bool use_vcol) +static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd) { /* PBVH should always exist for non-empty meshes, created by depsgrah eval. */ PBVH *pbvh = (scd->ob->sculpt) ? scd->ob->sculpt->pbvh : NULL; @@ -1015,7 +1015,6 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd, bool use_vcol) BKE_pbvh_update_normals(pbvh, mesh->runtime.subdiv_ccg); BKE_pbvh_draw_cb(pbvh, - use_vcol, update_only_visible, &update_frustum, &draw_frustum, @@ -1033,8 +1032,7 @@ static void drw_sculpt_generate_calls(DRWSculptCallbackData *scd, bool use_vcol) } } -void DRW_shgroup_call_sculpt( - DRWShadingGroup *shgroup, Object *ob, bool use_wire, bool use_mask, bool use_vcol) +void DRW_shgroup_call_sculpt(DRWShadingGroup *shgroup, Object *ob, bool use_wire, bool use_mask) { DRWSculptCallbackData scd = { .ob = ob, @@ -1044,13 +1042,12 @@ void DRW_shgroup_call_sculpt( .use_mats = false, .use_mask = use_mask, }; - drw_sculpt_generate_calls(&scd, use_vcol); + drw_sculpt_generate_calls(&scd); } void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **shgroups, int num_shgroups, - Object *ob, - bool use_vcol) + Object *ob) { DRWSculptCallbackData scd = { .ob = ob, @@ -1060,7 +1057,7 @@ void DRW_shgroup_call_sculpt_with_materials(DRWShadingGroup **shgroups, .use_mats = true, .use_mask = false, }; - drw_sculpt_generate_calls(&scd, use_vcol); + drw_sculpt_generate_calls(&scd); } static GPUVertFormat inst_select_format = {0}; |