Merge branch 'blender-v3.2-release'

This commit is contained in:
Richard Antalik 2022-05-17 21:23:55 +02:00
commit df26f4f63a
6 changed files with 49 additions and 18 deletions

View File

@ -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

View File

@ -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

View File

@ -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 {

View File

@ -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.

View File

@ -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)) {

View File

@ -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;
}
}