diff options
-rw-r--r-- | intern/cycles/device/device.h | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 5 | ||||
-rw-r--r-- | intern/cycles/render/session.cpp | 3 | ||||
-rw-r--r-- | intern/cycles/render/shader.cpp | 28 | ||||
-rw-r--r-- | intern/cycles/render/shader.h | 7 |
5 files changed, 31 insertions, 22 deletions
diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index 769fb3ccf9d..b956090a199 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -100,6 +100,9 @@ public: /* Denotes whether baking functionality is needed. */ bool use_baking; + /* Use subsurface scattering materials. */ + bool use_subsurface; + DeviceRequestedFeatures() { /* TODO(sergey): Find more meaningful defaults. */ @@ -111,6 +114,7 @@ public: use_object_motion = false; use_camera_motion = false; use_baking = false; + use_subsurface = false; } bool modified(const DeviceRequestedFeatures& requested_features) @@ -122,7 +126,8 @@ public: use_hair == requested_features.use_hair && use_object_motion == requested_features.use_object_motion && use_camera_motion == requested_features.use_camera_motion && - use_baking == requested_features.use_baking); + use_baking == requested_features.use_baking && + use_subsurface == requested_features.use_subsurface); } /* Convert the requested features structure to a build options, @@ -151,6 +156,9 @@ public: if(!use_baking) { build_options += " -D__NO_BAKING__"; } + if(!use_subsurface) { + build_options += " -D__NO_SUBSURFACE__"; + } return build_options; } }; diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 75a9e213d4f..31ad4940152 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -180,7 +180,7 @@ CCL_NAMESPACE_BEGIN # define __KERNEL_DEBUG__ #endif -/* Scene-based selective featrues compilation/ */ +/* Scene-based selective featrues compilation. */ #ifdef __NO_CAMERA_MOTION__ # undef __CAMERA_MOTION__ #endif @@ -190,6 +190,9 @@ CCL_NAMESPACE_BEGIN #ifdef __NO_HAIR__ # undef __HAIR__ #endif +#ifdef __NO_SUBSURFACE__ +# undef __SUBSURFACE__ +#endif /* Random Numbers */ diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index 837c2694894..b5bc4109630 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -619,8 +619,7 @@ DeviceRequestedFeatures Session::get_requested_device_features() requested_features.max_closure = get_max_closure_count(); scene->shader_manager->get_requested_features( scene, - requested_features.max_nodes_group, - requested_features.nodes_features); + &requested_features); } /* This features are not being tweaked as often as shaders, diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index ae00bfb30a7..556fbe4f78d 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -490,42 +490,42 @@ void ShaderManager::add_default(Scene *scene) } } -/* NOTE: Expects max_group and features to be initialized in the callee. */ void ShaderManager::get_requested_graph_features(ShaderGraph *graph, - int& max_group, - int& features) + DeviceRequestedFeatures *requested_features) { foreach(ShaderNode *node, graph->nodes) { - max_group = max(max_group, node->get_group()); - features |= node->get_feature(); + requested_features->max_nodes_group = max(requested_features->max_nodes_group, + node->get_group()); + requested_features->nodes_features |= node->get_feature(); if(node->special_type == SHADER_SPECIAL_TYPE_CLOSURE) { BsdfNode *bsdf_node = static_cast<BsdfNode*>(node); if(CLOSURE_IS_VOLUME(bsdf_node->closure)) { - features |= NODE_FEATURE_VOLUME; + requested_features->nodes_features |= NODE_FEATURE_VOLUME; } } + if(node->has_surface_bssrdf()) { + requested_features->use_subsurface = true; + } } } void ShaderManager::get_requested_features(Scene *scene, - int& max_group, - int& features) + DeviceRequestedFeatures *requested_features) { - max_group = NODE_GROUP_LEVEL_0; - features = 0; + requested_features->max_nodes_group = NODE_GROUP_LEVEL_0; + requested_features->nodes_features = 0; for(int i = 0; i < scene->shaders.size(); i++) { Shader *shader = scene->shaders[i]; /* Gather requested features from all the nodes from the graph nodes. */ - get_requested_graph_features(shader->graph, max_group, features); + get_requested_graph_features(shader->graph, requested_features); /* Gather requested features from the graph itself. */ if(shader->graph_bump) { get_requested_graph_features(shader->graph_bump, - max_group, - features); + requested_features); } ShaderNode *output_node = shader->graph->output(); if(output_node->input("Displacement")->link != NULL) { - features |= NODE_FEATURE_BUMP; + requested_features->nodes_features |= NODE_FEATURE_BUMP; } } } diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h index e34e78476a0..b19b1c619a2 100644 --- a/intern/cycles/render/shader.h +++ b/intern/cycles/render/shader.h @@ -43,6 +43,7 @@ CCL_NAMESPACE_BEGIN class Device; class DeviceScene; +class DeviceRequestedFeatures; class Mesh; class Progress; class Scene; @@ -168,8 +169,7 @@ public: /* Selective nodes compilation. */ void get_requested_features(Scene *scene, - int& max_group, - int& features); + DeviceRequestedFeatures *requested_features); protected: ShaderManager(); @@ -183,8 +183,7 @@ protected: size_t beckmann_table_offset; void get_requested_graph_features(ShaderGraph *graph, - int& max_group, - int& features); + DeviceRequestedFeatures *requested_features); }; CCL_NAMESPACE_END |