forked from bartvdbraak/blender
Cycles: bumping OpenPGL minimum version to 0.5 and removing version checks
This commit is contained in:
parent
40484a6586
commit
493856427d
@ -1305,9 +1305,7 @@ void PathTrace::set_guiding_params(const GuidingParams &guiding_params, const bo
|
||||
break;
|
||||
}
|
||||
}
|
||||
# if OPENPGL_VERSION_MINOR >= 4
|
||||
field_args.deterministic = guiding_params.deterministic;
|
||||
# endif
|
||||
reinterpret_cast<PGLKDTreeArguments *>(field_args.spatialSturctureArguments)->maxDepth = 16;
|
||||
openpgl::cpp::Device *guiding_device = static_cast<openpgl::cpp::Device *>(
|
||||
device_->get_guiding_device());
|
||||
@ -1374,12 +1372,7 @@ void PathTrace::guiding_update_structures()
|
||||
|
||||
/* we wait until we have at least 1024 samples */
|
||||
if (num_valid_samples >= 1024) {
|
||||
# if OPENPGL_VERSION_MINOR < 4
|
||||
const size_t num_samples = 1;
|
||||
guiding_field_->Update(*guiding_sample_data_storage_, num_samples);
|
||||
# else
|
||||
guiding_field_->Update(*guiding_sample_data_storage_);
|
||||
# endif
|
||||
guiding_update_count++;
|
||||
|
||||
VLOG_DEBUG << "Path guiding field valid: " << guiding_field_->Validate();
|
||||
|
@ -358,12 +358,7 @@ void PathTraceWorkCPU::guiding_push_sample_data_to_global_storage(
|
||||
# if PATH_GUIDING_LEVEL >= 2
|
||||
const bool use_direct_light = kernel_data.integrator.use_guiding_direct_light;
|
||||
const bool use_mis_weights = kernel_data.integrator.use_guiding_mis_weights;
|
||||
# if OPENPGL_VERSION_MINOR >= 5
|
||||
kg->opgl_path_segment_storage->PrepareSamples(use_mis_weights, use_direct_light, false);
|
||||
# else
|
||||
kg->opgl_path_segment_storage->PrepareSamples(
|
||||
false, nullptr, use_mis_weights, use_direct_light, false);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef WITH_CYCLES_DEBUG
|
||||
|
@ -7,10 +7,6 @@
|
||||
#include "kernel/closure/bsdf.h"
|
||||
#include "kernel/film/write.h"
|
||||
|
||||
#if OPENPGL_VERSION_MINOR >= 5
|
||||
# define RIS_INCOMING_RADIANCE
|
||||
#endif
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* Utilities. */
|
||||
@ -27,11 +23,7 @@ struct GuidingRISSample {
|
||||
float ris_pdf{0.0f};
|
||||
float ris_weight{0.0f};
|
||||
|
||||
#ifdef RIS_INCOMING_RADIANCE
|
||||
float incoming_radiance_pdf{0.0f};
|
||||
#else
|
||||
float cosine{0.0f};
|
||||
#endif
|
||||
BsdfEval bsdf_eval;
|
||||
float avg_bsdf_eval{0.0f};
|
||||
Spectrum eval{zero_spectrum()};
|
||||
@ -45,16 +37,9 @@ ccl_device_forceinline bool calculate_ris_target(ccl_private GuidingRISSample *r
|
||||
if (ris_sample->avg_bsdf_eval > 0.0f && ris_sample->bsdf_pdf > 1e-10f &&
|
||||
ris_sample->guide_pdf > 0.0f)
|
||||
{
|
||||
|
||||
# ifdef RIS_INCOMING_RADIANCE
|
||||
ris_sample->ris_target = (ris_sample->avg_bsdf_eval *
|
||||
((((1.0f - guiding_sampling_prob) * (1.0f / (pi_factor * M_PI_F))) +
|
||||
(guiding_sampling_prob * ris_sample->incoming_radiance_pdf))));
|
||||
# else
|
||||
ris_sample->ris_target = (ris_sample->avg_bsdf_eval / ris_sample->cosine *
|
||||
((((1.0f - guiding_sampling_prob) * (1.0f / (pi_factor * M_PI_F))) +
|
||||
(guiding_sampling_prob * ris_sample->guide_pdf))));
|
||||
# endif
|
||||
ris_sample->ris_pdf = (0.5f * (ris_sample->bsdf_pdf + ris_sample->guide_pdf));
|
||||
ris_sample->ris_weight = ris_sample->ris_target / ris_sample->ris_pdf;
|
||||
return true;
|
||||
@ -511,14 +496,8 @@ ccl_device_forceinline bool guiding_bsdf_init(KernelGlobals kg,
|
||||
ccl_private float &rand)
|
||||
{
|
||||
#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
|
||||
# if OPENPGL_VERSION_MINOR >= 5
|
||||
if (kg->opgl_surface_sampling_distribution->Init(
|
||||
kg->opgl_guiding_field, guiding_point3f(P), rand)) {
|
||||
# else
|
||||
if (kg->opgl_surface_sampling_distribution->Init(
|
||||
kg->opgl_guiding_field, guiding_point3f(P), rand, true))
|
||||
{
|
||||
# endif
|
||||
kg->opgl_surface_sampling_distribution->ApplyCosineProduct(guiding_point3f(N));
|
||||
return true;
|
||||
}
|
||||
@ -558,7 +537,7 @@ ccl_device_forceinline float guiding_surface_incoming_radiance_pdf(KernelGlobals
|
||||
IntegratorState state,
|
||||
const float3 wo)
|
||||
{
|
||||
#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4 && OPENPGL_VERSION_MINOR >= 5
|
||||
#if defined(__PATH_GUIDING__) && PATH_GUIDING_LEVEL >= 4
|
||||
return kg->opgl_surface_sampling_distribution->IncomingRadiancePDF(guiding_vec3f(wo));
|
||||
#else
|
||||
return 0.0f;
|
||||
@ -580,14 +559,8 @@ ccl_device_forceinline bool guiding_phase_init(KernelGlobals kg,
|
||||
return false;
|
||||
}
|
||||
|
||||
# if OPENPGL_VERSION_MINOR >= 5
|
||||
if (kg->opgl_volume_sampling_distribution->Init(
|
||||
kg->opgl_guiding_field, guiding_point3f(P), rand)) {
|
||||
# else
|
||||
if (kg->opgl_volume_sampling_distribution->Init(
|
||||
kg->opgl_guiding_field, guiding_point3f(P), rand, true))
|
||||
{
|
||||
# endif
|
||||
kg->opgl_volume_sampling_distribution->ApplySingleLobeHenyeyGreensteinProduct(guiding_vec3f(D),
|
||||
g);
|
||||
return true;
|
||||
|
@ -620,14 +620,9 @@ ccl_device_forceinline void volume_integrate_heterogeneous(
|
||||
const Spectrum emission = volume_emission_integrate(
|
||||
&coeff, closure_flag, transmittance, dt);
|
||||
accum_emission += result.indirect_throughput * emission;
|
||||
# if OPENPGL_VERSION_MINOR < 5 // WORKAROUND #104329
|
||||
if (kernel_data.integrator.max_volume_bounce > 1)
|
||||
# endif
|
||||
{
|
||||
guiding_record_volume_emission(kg, state, emission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (closure_flag & SD_EXTINCTION) {
|
||||
if ((closure_flag & SD_SCATTER) || !vstate.absorption_only) {
|
||||
@ -969,13 +964,9 @@ ccl_device_forceinline bool integrate_volume_phase_scatter(
|
||||
const Spectrum phase_weight = bsdf_eval_sum(&phase_eval) / phase_pdf;
|
||||
|
||||
/* Add phase function sampling data to the path segment. */
|
||||
# if OPENPGL_VERSION_MINOR < 5 // WORKAROUND #104329
|
||||
if (kernel_data.integrator.max_volume_bounce > 1)
|
||||
# endif
|
||||
{
|
||||
guiding_record_volume_bounce(
|
||||
kg, state, sd, phase_weight, phase_pdf, normalize(phase_wo), sampled_roughness);
|
||||
}
|
||||
|
||||
/* Update throughput. */
|
||||
const Spectrum throughput = INTEGRATOR_STATE(state, path, throughput);
|
||||
const Spectrum throughput_phase = throughput * phase_weight;
|
||||
@ -1070,11 +1061,7 @@ ccl_device VolumeIntegrateEvent volume_integrate(KernelGlobals kg,
|
||||
const float3 direct_P = ray->P + result.direct_t * ray->D;
|
||||
|
||||
# ifdef __PATH_GUIDING__
|
||||
# if OPENPGL_VERSION_MINOR < 5 // WORKAROUND #104329
|
||||
if (kernel_data.integrator.use_guiding && kernel_data.integrator.max_volume_bounce > 1) {
|
||||
# else
|
||||
if (kernel_data.integrator.use_guiding) {
|
||||
# endif
|
||||
# if PATH_GUIDING_LEVEL >= 1
|
||||
if (result.direct_sample_method == VOLUME_SAMPLE_DISTANCE) {
|
||||
/* If the direct scatter event is generated using VOLUME_SAMPLE_DISTANCE the direct event
|
||||
@ -1147,13 +1134,8 @@ ccl_device VolumeIntegrateEvent volume_integrate(KernelGlobals kg,
|
||||
# if defined(__PATH_GUIDING__)
|
||||
# if PATH_GUIDING_LEVEL >= 1
|
||||
if (!guiding_generated_new_segment) {
|
||||
# if OPENPGL_VERSION_MINOR < 5 // WORKAROUND #104329
|
||||
if (kernel_data.integrator.max_volume_bounce > 1)
|
||||
# endif
|
||||
{
|
||||
guiding_record_volume_segment(kg, state, sd.P, sd.wi);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
# if PATH_GUIDING_LEVEL >= 4
|
||||
/* If the direct scatter event was generated using VOLUME_SAMPLE_EQUIANGULAR we need to
|
||||
|
@ -670,12 +670,8 @@ ccl_device int surface_shader_bsdf_guided_sample_closure_ris(KernelGlobals kg,
|
||||
ris_samples[0].avg_bsdf_eval = average(ris_samples[0].bsdf_eval.sum);
|
||||
ris_samples[0].guide_pdf = guiding_bsdf_pdf(kg, state, ris_samples[0].wo);
|
||||
ris_samples[0].guide_pdf *= (1.0f - bssrdf_sampling_prob);
|
||||
# ifdef RIS_INCOMING_RADIANCE
|
||||
ris_samples[0].incoming_radiance_pdf = guiding_surface_incoming_radiance_pdf(
|
||||
kg, state, ris_samples[0].wo);
|
||||
# else
|
||||
ris_samples[0].cosine = max(0.01f, fabsf(dot(sd->N, ris_samples[0].wo)));
|
||||
# endif
|
||||
ris_samples[0].bsdf_pdf = max(0.0f, ris_samples[0].bsdf_pdf);
|
||||
}
|
||||
|
||||
@ -687,12 +683,8 @@ ccl_device int surface_shader_bsdf_guided_sample_closure_ris(KernelGlobals kg,
|
||||
ris_samples[1].guide_pdf = guiding_bsdf_sample(
|
||||
kg, state, float3_to_float2(ris_samples[1].rand), &ris_samples[1].wo);
|
||||
ris_samples[1].guide_pdf *= (1.0f - bssrdf_sampling_prob);
|
||||
# ifdef RIS_INCOMING_RADIANCE
|
||||
ris_samples[1].incoming_radiance_pdf = guiding_surface_incoming_radiance_pdf(
|
||||
kg, state, ris_samples[1].wo);
|
||||
# else
|
||||
ris_samples[1].cosine = max(0.01f, fabsf(dot(sd->N, ris_samples[1].wo)));
|
||||
# endif
|
||||
ris_samples[1].bsdf_pdf = surface_shader_bsdf_eval_pdfs(
|
||||
kg, sd, ris_samples[1].wo, &ris_samples[1].bsdf_eval, unguided_bsdf_pdfs, 0);
|
||||
ris_samples[1].label = ris_samples[0].label;
|
||||
|
@ -18,11 +18,9 @@ static int guiding_device_type()
|
||||
# if defined(__ARM_NEON)
|
||||
return 8;
|
||||
# else
|
||||
# if OPENPGL_VERSION_MINOR >= 4
|
||||
if (system_cpu_support_avx2()) {
|
||||
return 8;
|
||||
}
|
||||
# endif
|
||||
if (system_cpu_support_sse41()) {
|
||||
return 4;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user