diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp index cd5dca34d2a..f627466c9a7 100644 --- a/intern/cycles/integrator/path_trace.cpp +++ b/intern/cycles/integrator/path_trace.cpp @@ -1285,42 +1285,78 @@ void PathTrace::set_guiding_params(const GuidingParams &guiding_params, const bo if (guiding_params_.modified(guiding_params)) { guiding_params_ = guiding_params; +# if !(OPENPGL_VERSION_MAJOR == 0 && OPENPGL_VERSION_MINOR <= 5) +# define OPENPGL_USE_FIELD_CONFIG +# endif + if (guiding_params_.use) { +# ifdef OPENPGL_USE_FIELD_CONFIG + openpgl::cpp::FieldConfig field_config; +# else PGLFieldArguments field_args; +# endif switch (guiding_params_.type) { default: /* Parallax-aware von Mises-Fisher mixture models. */ case GUIDING_TYPE_PARALLAX_AWARE_VMM: { +# ifdef OPENPGL_USE_FIELD_CONFIG + field_config.Init( + PGL_SPATIAL_STRUCTURE_TYPE::PGL_SPATIAL_STRUCTURE_KDTREE, + PGL_DIRECTIONAL_DISTRIBUTION_TYPE::PGL_DIRECTIONAL_DISTRIBUTION_PARALLAX_AWARE_VMM, + guiding_params.deterministic); +# else pglFieldArgumentsSetDefaults( field_args, PGL_SPATIAL_STRUCTURE_TYPE::PGL_SPATIAL_STRUCTURE_KDTREE, PGL_DIRECTIONAL_DISTRIBUTION_TYPE::PGL_DIRECTIONAL_DISTRIBUTION_PARALLAX_AWARE_VMM); +# endif break; } /* Directional quad-trees. */ case GUIDING_TYPE_DIRECTIONAL_QUAD_TREE: { +# ifdef OPENPGL_USE_FIELD_CONFIG + field_config.Init( + PGL_SPATIAL_STRUCTURE_TYPE::PGL_SPATIAL_STRUCTURE_KDTREE, + PGL_DIRECTIONAL_DISTRIBUTION_TYPE::PGL_DIRECTIONAL_DISTRIBUTION_QUADTREE, + guiding_params.deterministic); +# else pglFieldArgumentsSetDefaults( field_args, PGL_SPATIAL_STRUCTURE_TYPE::PGL_SPATIAL_STRUCTURE_KDTREE, PGL_DIRECTIONAL_DISTRIBUTION_TYPE::PGL_DIRECTIONAL_DISTRIBUTION_QUADTREE); +# endif break; } /* von Mises-Fisher mixture models. */ case GUIDING_TYPE_VMM: { +# ifdef OPENPGL_USE_FIELD_CONFIG + field_config.Init(PGL_SPATIAL_STRUCTURE_TYPE::PGL_SPATIAL_STRUCTURE_KDTREE, + PGL_DIRECTIONAL_DISTRIBUTION_TYPE::PGL_DIRECTIONAL_DISTRIBUTION_VMM, + guiding_params.deterministic); +# else pglFieldArgumentsSetDefaults( field_args, PGL_SPATIAL_STRUCTURE_TYPE::PGL_SPATIAL_STRUCTURE_KDTREE, PGL_DIRECTIONAL_DISTRIBUTION_TYPE::PGL_DIRECTIONAL_DISTRIBUTION_VMM); +# endif break; } } +# ifdef OPENPGL_USE_FIELD_CONFIG + field_config.SetSpatialStructureArgMaxDepth(16); +# else field_args.deterministic = guiding_params.deterministic; reinterpret_cast(field_args.spatialSturctureArguments)->maxDepth = 16; +# endif openpgl::cpp::Device *guiding_device = static_cast( device_->get_guiding_device()); if (guiding_device) { guiding_sample_data_storage_ = make_unique(); +# ifdef OPENPGL_USE_FIELD_CONFIG + guiding_field_ = make_unique(guiding_device, field_config); +# else guiding_field_ = make_unique(guiding_device, field_args); +# endif } else { guiding_sample_data_storage_ = nullptr; diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index 5daf58df38d..dac81b40fe7 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -956,6 +956,9 @@ if(WITH_GTESTS) endif() if(WITH_VULKAN_BACKEND) add_definitions(-DWITH_VULKAN_BACKEND) + list(APPEND INC_SYS + PUBLIC ${VULKAN_INCLUDE_DIRS} + ) endif() endif() endif()