diff options
author | Richard Antalik <richardantalik@gmail.com> | 2022-05-17 22:23:55 +0300 |
---|---|---|
committer | Richard Antalik <richardantalik@gmail.com> | 2022-05-17 22:23:55 +0300 |
commit | df26f4f63a90604c5199c2288f9dde8992abfb25 (patch) | |
tree | 7abcbed9734b97a64b7ce3c00f47f4ea31ecd171 | |
parent | b3b5d4cabb9653b9e5ddb9650378da4dc4aaac20 (diff) | |
parent | 35e73aa3472ab8c1e28feec1829fae79967322b5 (diff) |
Merge branch 'blender-v3.2-release'
-rw-r--r-- | intern/cycles/kernel/integrator/mnee.h | 32 | ||||
-rw-r--r-- | intern/cycles/kernel/integrator/shade_surface.h | 4 | ||||
-rw-r--r-- | source/blender/editors/space_sequencer/sequencer_draw.c | 19 | ||||
-rw-r--r-- | source/blender/sequencer/SEQ_utils.h | 4 | ||||
-rw-r--r-- | source/blender/sequencer/intern/render.c | 4 | ||||
-rw-r--r-- | source/blender/sequencer/intern/utils.c | 4 |
6 files changed, 49 insertions, 18 deletions
diff --git a/intern/cycles/kernel/integrator/mnee.h b/intern/cycles/kernel/integrator/mnee.h index 2f7b711e28c..ad83f82d091 100644 --- a/intern/cycles/kernel/integrator/mnee.h +++ b/intern/cycles/kernel/integrator/mnee.h @@ -807,6 +807,15 @@ ccl_device_forceinline bool mnee_path_contribution(KernelGlobals kg, * and keep pdf in vertex area measure */ mnee_update_light_sample(kg, vertices[vertex_count - 1].p, ls); + /* Save state path bounce info in case a light path node is used in the refractive interface or + * light shader graph. */ + const int transmission_bounce = INTEGRATOR_STATE(state, path, transmission_bounce); + const int diffuse_bounce = INTEGRATOR_STATE(state, path, diffuse_bounce); + const int bounce = INTEGRATOR_STATE(state, path, bounce); + + /* Set diffuse bounce info . */ + INTEGRATOR_STATE_WRITE(state, path, diffuse_bounce) = diffuse_bounce + 1; + /* Evaluate light sample * in case the light has a node-based shader: * 1. sd_mnee will be used to store light data, which is why we need to do @@ -814,6 +823,12 @@ ccl_device_forceinline bool mnee_path_contribution(KernelGlobals kg, * interface data at the end of the call for the shadow ray setup to work. * 2. ls needs to contain the last interface data for the light shader to * evaluate properly */ + + /* Set bounce info in case a light path node is used in the light shader graph. */ + INTEGRATOR_STATE_WRITE(state, path, transmission_bounce) = transmission_bounce + vertex_count - + 1; + INTEGRATOR_STATE_WRITE(state, path, bounce) = bounce + vertex_count; + float3 light_eval = light_sample_shader_eval(kg, state, sd_mnee, ls, sd->time); bsdf_eval_mul3(throughput, light_eval / ls->pdf); @@ -885,6 +900,11 @@ ccl_device_forceinline bool mnee_path_contribution(KernelGlobals kg, false, LAMP_NONE); + /* Set bounce info in case a light path node is used in the refractive interface + * shader graph. */ + INTEGRATOR_STATE_WRITE(state, path, transmission_bounce) = transmission_bounce + vi; + INTEGRATOR_STATE_WRITE(state, path, bounce) = bounce + 1 + vi; + /* Evaluate shader nodes at solution vi. */ shader_eval_surface<KERNEL_FEATURE_NODE_MASK_SURFACE_SHADOW>( kg, state, sd_mnee, NULL, PATH_RAY_DIFFUSE, true); @@ -901,6 +921,11 @@ ccl_device_forceinline bool mnee_path_contribution(KernelGlobals kg, bsdf_eval_mul3(throughput, bsdf_contribution); } + /* Restore original state path bounce info. */ + INTEGRATOR_STATE_WRITE(state, path, transmission_bounce) = transmission_bounce; + INTEGRATOR_STATE_WRITE(state, path, diffuse_bounce) = diffuse_bounce; + INTEGRATOR_STATE_WRITE(state, path, bounce) = bounce; + return true; } @@ -1029,18 +1054,17 @@ ccl_device_forceinline int kernel_path_mnee_sample(KernelGlobals kg, return 0; /* Check whether the transmission depth limit is reached before continuing. */ - if (INTEGRATOR_STATE(state, path, transmission_bounce) + vertex_count >= + if ((INTEGRATOR_STATE(state, path, transmission_bounce) + vertex_count - 1) >= kernel_data.integrator.max_transmission_bounce) return 0; /* Check whether the diffuse depth limit is reached before continuing. */ - if (INTEGRATOR_STATE(state, path, diffuse_bounce) + 1 >= + if ((INTEGRATOR_STATE(state, path, diffuse_bounce) + 1) >= kernel_data.integrator.max_diffuse_bounce) return 0; /* Check whether the overall depth limit is reached before continuing. */ - if (INTEGRATOR_STATE(state, path, bounce) + 1 + vertex_count >= - kernel_data.integrator.max_bounce) + if ((INTEGRATOR_STATE(state, path, bounce) + vertex_count) >= kernel_data.integrator.max_bounce) return 0; /* Mark the manifold walk valid to turn off mollification regardless of how successful the walk diff --git a/intern/cycles/kernel/integrator/shade_surface.h b/intern/cycles/kernel/integrator/shade_surface.h index 859c314b088..896e81b80ff 100644 --- a/intern/cycles/kernel/integrator/shade_surface.h +++ b/intern/cycles/kernel/integrator/shade_surface.h @@ -253,13 +253,13 @@ ccl_device_forceinline void integrate_surface_direct_light(KernelGlobals kg, # ifdef __MNEE__ if (mnee_vertex_count > 0) { INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, transmission_bounce) = - INTEGRATOR_STATE(state, path, transmission_bounce) + mnee_vertex_count; + INTEGRATOR_STATE(state, path, transmission_bounce) + mnee_vertex_count - 1; INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, diffuse_bounce) = INTEGRATOR_STATE(state, path, diffuse_bounce) + 1; INTEGRATOR_STATE_WRITE(shadow_state, shadow_path, - bounce) = INTEGRATOR_STATE(state, path, bounce) + 1 + mnee_vertex_count; + bounce) = INTEGRATOR_STATE(state, path, bounce) + mnee_vertex_count; } else # endif diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 4cb41c702da..a561de1ef64 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -572,8 +572,6 @@ static void drawmeta_contents(Scene *scene, float y2, const bool show_strip_color_tag) { - Editing *ed = SEQ_editing_get(scene); - ListBase *channels = SEQ_channels_displayed_get(ed); Sequence *seq; uchar col[4]; @@ -582,11 +580,16 @@ static void drawmeta_contents(Scene *scene, int chan_range = 0; float draw_range = y2 - y1; float draw_height; - ListBase *seqbase; + + Editing *ed = SEQ_editing_get(scene); + ListBase *channels = SEQ_channels_displayed_get(ed); + ListBase *meta_seqbase; + ListBase *meta_channels; int offset; - seqbase = SEQ_get_seqbase_from_sequence(seqm, &offset); - if (!seqbase || BLI_listbase_is_empty(seqbase)) { + meta_seqbase = SEQ_get_seqbase_from_sequence(seqm, &meta_channels, &offset); + + if (!meta_seqbase || BLI_listbase_is_empty(meta_seqbase)) { return; } @@ -599,7 +602,7 @@ static void drawmeta_contents(Scene *scene, GPU_blend(GPU_BLEND_ALPHA); - for (seq = seqbase->first; seq; seq = seq->next) { + for (seq = meta_seqbase->first; seq; seq = seq->next) { chan_min = min_ii(chan_min, seq->machine); chan_max = max_ii(chan_max, seq->machine); } @@ -613,7 +616,7 @@ static void drawmeta_contents(Scene *scene, immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); /* Draw only immediate children (1 level depth). */ - for (seq = seqbase->first; seq; seq = seq->next) { + for (seq = meta_seqbase->first; seq; seq = seq->next) { const int startdisp = seq->startdisp + offset; const int enddisp = seq->enddisp + offset; @@ -631,7 +634,7 @@ static void drawmeta_contents(Scene *scene, color3ubv_from_seq(scene, seq, show_strip_color_tag, col); } - if (SEQ_render_is_muted(channels, seqm) || SEQ_render_is_muted(&seqm->channels, seq)) { + if (SEQ_render_is_muted(channels, seqm) || SEQ_render_is_muted(meta_channels, seq)) { col[3] = 64; } else { diff --git a/source/blender/sequencer/SEQ_utils.h b/source/blender/sequencer/SEQ_utils.h index ec33bca87a3..ce3c81606ea 100644 --- a/source/blender/sequencer/SEQ_utils.h +++ b/source/blender/sequencer/SEQ_utils.h @@ -32,7 +32,9 @@ void SEQ_sequence_base_unique_name_recursive(struct Scene *scene, struct ListBase *seqbasep, struct Sequence *seq); const char *SEQ_sequence_give_name(struct Sequence *seq); -struct ListBase *SEQ_get_seqbase_from_sequence(struct Sequence *seq, int *r_offset); +struct ListBase *SEQ_get_seqbase_from_sequence(struct Sequence *seq, + struct ListBase **channels, + int *r_offset); const struct Sequence *SEQ_get_topmost_sequence(const struct Scene *scene, int frame); /** * In cases where we don't know the sequence's listbase. diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index 8d8a13be09e..1b9e89a35d5 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -1586,10 +1586,10 @@ static ImBuf *do_render_strip_seqbase(const SeqRenderData *context, { ImBuf *ibuf = NULL; ListBase *seqbase = NULL; - ListBase *channels = &seq->channels; + ListBase *channels = NULL; int offset; - seqbase = SEQ_get_seqbase_from_sequence(seq, &offset); + seqbase = SEQ_get_seqbase_from_sequence(seq, &channels, &offset); if (seqbase && !BLI_listbase_is_empty(seqbase)) { diff --git a/source/blender/sequencer/intern/utils.c b/source/blender/sequencer/intern/utils.c index da422c4228f..0cf47420d8f 100644 --- a/source/blender/sequencer/intern/utils.c +++ b/source/blender/sequencer/intern/utils.c @@ -225,13 +225,14 @@ const char *SEQ_sequence_give_name(Sequence *seq) return name; } -ListBase *SEQ_get_seqbase_from_sequence(Sequence *seq, int *r_offset) +ListBase *SEQ_get_seqbase_from_sequence(Sequence *seq, ListBase **r_channels, int *r_offset) { ListBase *seqbase = NULL; switch (seq->type) { case SEQ_TYPE_META: { seqbase = &seq->seqbase; + *r_channels = &seq->channels; *r_offset = seq->start; break; } @@ -240,6 +241,7 @@ ListBase *SEQ_get_seqbase_from_sequence(Sequence *seq, int *r_offset) Editing *ed = SEQ_editing_get(seq->scene); if (ed) { seqbase = &ed->seqbase; + *r_channels = &ed->channels; *r_offset = seq->scene->r.sfra; } } |