Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Mours <pmours@nvidia.com>2019-10-02 13:06:30 +0300
committerPatrick Mours <pmours@nvidia.com>2019-10-02 14:23:29 +0300
commit0091b84df0281c44c98194cf94af7e894ff990e5 (patch)
tree12a822c23907ae50672657fc9fe00f2213d81934 /intern/cycles/device/device_optix.cpp
parent97ba7f3c322aab0dc4cf4617281c258f7480fbc8 (diff)
Fix T70268: Render failures with Vector pass active with OptiX in Cycles
Rendering would produce invalid results or crash if the Vector pass was active but motion blur was inactive. This caused the OptiX BVH to be built with motion (because objects reported motion available), but the pipeline to be built without motion support (since with disabled motion blur this is not in the list of requested features). The two are not compatible and therefore caused issues. This patch fixes that by not building the BVH with motion if motion blur is not active (which makes sense). Reviewed By: brecht Differential Revision: https://developer.blender.org/D5968
Diffstat (limited to 'intern/cycles/device/device_optix.cpp')
-rw-r--r--intern/cycles/device/device_optix.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/intern/cycles/device/device_optix.cpp b/intern/cycles/device/device_optix.cpp
index b745235aed5..6f4734059da 100644
--- a/intern/cycles/device/device_optix.cpp
+++ b/intern/cycles/device/device_optix.cpp
@@ -169,6 +169,7 @@ class OptiXDevice : public Device {
OptixModule optix_module = NULL;
OptixPipeline pipelines[NUM_PIPELINES] = {};
+ bool motion_blur = false;
bool need_texture_info = false;
device_vector<SbtRecord> sbt_data;
device_vector<TextureInfo> texture_info;
@@ -337,7 +338,12 @@ class OptiXDevice : public Device {
# endif
pipeline_options.pipelineLaunchParamsVariableName = "__params"; // See kernel_globals.h
- if (requested_features.use_object_motion) {
+ // Keep track of whether motion blur is enabled, so to enable/disable motion in BVH builds
+ // This is necessary since objects may be reported to have motion if the Vector pass is
+ // active, but may still need to be rendered without motion blur if that isn't active as well
+ motion_blur = requested_features.use_object_motion;
+
+ if (motion_blur) {
pipeline_options.usesMotionBlur = true;
// Motion blur can insert motion transforms into the traversal graph
// It is no longer a two-level graph then, so need to set flags to allow any configuration
@@ -872,7 +878,7 @@ class OptiXDevice : public Device {
size_t num_motion_steps = 1;
Attribute *motion_keys = mesh->curve_attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
- if (mesh->use_motion_blur && motion_keys) {
+ if (motion_blur && mesh->use_motion_blur && motion_keys) {
num_motion_steps = mesh->motion_steps;
}
@@ -942,7 +948,7 @@ class OptiXDevice : public Device {
size_t num_motion_steps = 1;
Attribute *motion_keys = mesh->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION);
- if (mesh->use_motion_blur && motion_keys) {
+ if (motion_blur && mesh->use_motion_blur && motion_keys) {
num_motion_steps = mesh->motion_steps;
}
@@ -1041,7 +1047,7 @@ class OptiXDevice : public Device {
instance.visibilityMask = (ob->mesh->has_volume ? 3 : 1);
// Insert motion traversable if object has motion
- if (ob->use_motion()) {
+ if (motion_blur && ob->use_motion()) {
blas.emplace_back(this, "motion_transform");
device_only_memory<uint8_t> &motion_transform_gpu = blas.back();
motion_transform_gpu.alloc_to_device(sizeof(OptixSRTMotionTransform) +