diff options
Diffstat (limited to 'intern/cycles')
-rw-r--r-- | intern/cycles/blender/blender_sync.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/device/device.h | 2 | ||||
-rw-r--r-- | intern/cycles/device/device_cpu.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/device/device_cuda.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/device/device_network.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/device/device_opencl.cpp | 1 | ||||
-rw-r--r-- | intern/cycles/device/opencl/opencl.h | 1 | ||||
-rw-r--r-- | intern/cycles/device/opencl/opencl_split.cpp | 2 | ||||
-rw-r--r-- | intern/cycles/device/opencl/opencl_util.cpp | 17 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_bake.h | 12 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_compat_opencl.h | 2 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_emission.h | 96 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_shader.h | 91 | ||||
-rw-r--r-- | intern/cycles/kernel/kernel_types.h | 135 | ||||
-rw-r--r-- | intern/cycles/render/light.cpp | 5 | ||||
-rw-r--r-- | intern/cycles/render/shader.cpp | 31 |
16 files changed, 172 insertions, 230 deletions
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index 91317cbb81b..4074d7c99e2 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -510,10 +510,6 @@ vector<Pass> BlenderSync::sync_render_passes(BL::RenderLayer& b_rlay, vector<Pass> passes; Pass::add(PASS_COMBINED, passes); - if(!session_params.device.advanced_shading) { - return passes; - } - /* loop over passes */ BL::RenderLayer::passes_iterator b_pass_iter; diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index 4db8d10a4aa..aa0a8e434d2 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -73,7 +73,6 @@ public: string id; /* used for user preferences, should stay fixed with changing hardware config */ int num; bool display_device; /* GPU is used as a display device. */ - bool advanced_shading; /* Supports full shading system. */ bool has_half_images; /* Support half-float textures. */ bool has_volume_decoupled; /* Decoupled volume shading. */ bool has_osl; /* Support Open Shading Language. */ @@ -89,7 +88,6 @@ public: num = 0; cpu_threads = 0; display_device = false; - advanced_shading = true; has_half_images = false; has_volume_decoupled = false; has_osl = false; diff --git a/intern/cycles/device/device_cpu.cpp b/intern/cycles/device/device_cpu.cpp index 2eb0a40ada0..73f1fc02b08 100644 --- a/intern/cycles/device/device_cpu.cpp +++ b/intern/cycles/device/device_cpu.cpp @@ -1123,7 +1123,6 @@ void device_cpu_info(vector<DeviceInfo>& devices) info.description = system_cpu_brand_string(); info.id = "CPU"; info.num = 0; - info.advanced_shading = true; info.has_volume_decoupled = true; info.has_osl = true; info.has_half_images = true; diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index f8c6aa5cd33..3aa6bce155e 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -2532,7 +2532,6 @@ void device_cuda_info(vector<DeviceInfo>& devices) info.description = string(name); info.num = num; - info.advanced_shading = (major >= 3); info.has_half_images = (major >= 3); info.has_volume_decoupled = false; diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp index 91628490b51..6736480e95a 100644 --- a/intern/cycles/device/device_network.cpp +++ b/intern/cycles/device/device_network.cpp @@ -308,7 +308,6 @@ void device_network_info(vector<DeviceInfo>& devices) info.num = 0; /* todo: get this info from device */ - info.advanced_shading = true; info.has_volume_decoupled = false; info.has_osl = false; diff --git a/intern/cycles/device/device_opencl.cpp b/intern/cycles/device/device_opencl.cpp index 948fe407f63..4cefaa217f1 100644 --- a/intern/cycles/device/device_opencl.cpp +++ b/intern/cycles/device/device_opencl.cpp @@ -119,7 +119,6 @@ void device_opencl_info(vector<DeviceInfo>& devices) info.num = num_devices; /* We don't know if it's used for display, but assume it is. */ info.display_device = true; - info.advanced_shading = OpenCLInfo::kernel_use_advanced_shading(platform_name); info.use_split_kernel = true; info.has_volume_decoupled = false; info.id = id; diff --git a/intern/cycles/device/opencl/opencl.h b/intern/cycles/device/opencl/opencl.h index bb507be4c72..a8ad4a935f7 100644 --- a/intern/cycles/device/opencl/opencl.h +++ b/intern/cycles/device/opencl/opencl.h @@ -84,7 +84,6 @@ class OpenCLInfo public: static cl_device_type device_type(); static bool use_debug(); - static bool kernel_use_advanced_shading(const string& platform_name); static bool device_supported(const string& platform_name, const cl_device_id device_id); static bool platform_version_check(cl_platform_id platform, diff --git a/intern/cycles/device/opencl/opencl_split.cpp b/intern/cycles/device/opencl/opencl_split.cpp index 555707cecd5..fd7eebf0221 100644 --- a/intern/cycles/device/opencl/opencl_split.cpp +++ b/intern/cycles/device/opencl/opencl_split.cpp @@ -184,7 +184,7 @@ string OpenCLDevice::get_build_options(const DeviceRequestedFeatures& requested_ if (preview_kernel) { DeviceRequestedFeatures preview_features; preview_features.use_hair = true; - build_options += "-D__KERNEL_OPENCL_PREVIEW__ "; + build_options += "-D__KERNEL_AO_PREVIEW__ "; build_options += preview_features.get_build_options(); } else if (opencl_program_name == "split_do_volume" && !requested_features.use_volume) { diff --git a/intern/cycles/device/opencl/opencl_util.cpp b/intern/cycles/device/opencl/opencl_util.cpp index 920c8dc4e6a..5a1e12af8ab 100644 --- a/intern/cycles/device/opencl/opencl_util.cpp +++ b/intern/cycles/device/opencl/opencl_util.cpp @@ -737,23 +737,6 @@ bool OpenCLInfo::use_debug() return DebugFlags().opencl.debug; } -bool OpenCLInfo::kernel_use_advanced_shading(const string& platform) -{ - /* keep this in sync with kernel_types.h! */ - if(platform == "NVIDIA CUDA") - return true; - else if(platform == "Apple") - return true; - else if(platform == "AMD Accelerated Parallel Processing") - return true; - else if(platform == "Intel(R) OpenCL") - return true; - /* Make sure officially unsupported OpenCL platforms - * does not set up to use advanced shading. - */ - return false; -} - bool OpenCLInfo::device_supported(const string& platform_name, const cl_device_id device_id) { diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h index 920b10086c5..37c163f2538 100644 --- a/intern/cycles/kernel/kernel_bake.h +++ b/intern/cycles/kernel/kernel_bake.h @@ -351,7 +351,7 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input, out = make_float3(roughness, roughness, roughness); } else { - out = shader_emissive_eval(kg, &sd); + out = shader_emissive_eval(&sd); } break; } @@ -475,8 +475,9 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input, shader_setup_from_background(kg, &sd, &ray); /* evaluate */ - int flag = 0; /* we can't know which type of BSDF this is for */ - out = shader_eval_background(kg, &sd, &state, flag); + int path_flag = 0; /* we can't know which type of BSDF this is for */ + shader_eval_surface(kg, &sd, &state, path_flag | PATH_RAY_EMISSION); + out = shader_background_eval(&sd); break; } default: @@ -554,8 +555,9 @@ ccl_device void kernel_background_evaluate(KernelGlobals *kg, shader_setup_from_background(kg, &sd, &ray); /* evaluate */ - int flag = 0; /* we can't know which type of BSDF this is for */ - float3 color = shader_eval_background(kg, &sd, &state, flag); + int path_flag = 0; /* we can't know which type of BSDF this is for */ + shader_eval_surface(kg, &sd, &state, path_flag | PATH_RAY_EMISSION); + float3 color = shader_background_eval(&sd); /* write output */ output[i] += make_float4(color.x, color.y, color.z, 0.0f); diff --git a/intern/cycles/kernel/kernel_compat_opencl.h b/intern/cycles/kernel/kernel_compat_opencl.h index 21a95098894..3bf8cdebf4a 100644 --- a/intern/cycles/kernel/kernel_compat_opencl.h +++ b/intern/cycles/kernel/kernel_compat_opencl.h @@ -125,7 +125,7 @@ #define fmodf(x, y) fmod((float)(x), (float)(y)) #define sinhf(x) sinh(((float)(x))) -#ifndef __CL_USE_NATIVE__ +#if !(defined(__KERNEL_OPENCL_AMD__) || defined(__KERNEL_OPENCL_INTEL_CPU__)) # define sinf(x) native_sin(((float)(x))) # define cosf(x) native_cos(((float)(x))) # define tanf(x) native_tan(((float)(x))) diff --git a/intern/cycles/kernel/kernel_emission.h b/intern/cycles/kernel/kernel_emission.h index 302bb047647..9c47d1ca7be 100644 --- a/intern/cycles/kernel/kernel_emission.h +++ b/intern/cycles/kernel/kernel_emission.h @@ -29,43 +29,36 @@ ccl_device_noinline float3 direct_emissive_eval(KernelGlobals *kg, /* setup shading at emitter */ float3 eval; - int shader_flag = kernel_tex_fetch(__shaders, (ls->shader & SHADER_MASK)).flags; - -#ifdef __BACKGROUND_MIS__ - if(ls->type == LIGHT_BACKGROUND) { - Ray ray; - ray.D = ls->D; - ray.P = ls->P; - ray.t = 1.0f; - ray.time = time; - ray.dP = differential3_zero(); - ray.dD = dI; - - shader_setup_from_background(kg, emission_sd, &ray); - - path_state_modify_bounce(state, true); - eval = shader_eval_background(kg, emission_sd, state, 0); - path_state_modify_bounce(state, false); - } - else -#endif - if(shader_flag & SD_HAS_CONSTANT_EMISSION) - { - eval.x = kernel_tex_fetch(__shaders, (ls->shader & SHADER_MASK)).constant_emission[0]; - eval.y = kernel_tex_fetch(__shaders, (ls->shader & SHADER_MASK)).constant_emission[1]; - eval.z = kernel_tex_fetch(__shaders, (ls->shader & SHADER_MASK)).constant_emission[2]; + if(shader_constant_emission_eval(kg, ls->shader, &eval)) { if((ls->prim != PRIM_NONE) && dot(ls->Ng, I) < 0.0f) { ls->Ng = -ls->Ng; } } - else - { - shader_setup_from_sample(kg, emission_sd, - ls->P, ls->Ng, I, - ls->shader, ls->object, ls->prim, - ls->u, ls->v, t, time, false, ls->lamp); + else { + /* Setup shader data and call shader_eval_surface once, better + * for GPU coherence and compile times. */ +#ifdef __BACKGROUND_MIS__ + if(ls->type == LIGHT_BACKGROUND) { + Ray ray; + ray.D = ls->D; + ray.P = ls->P; + ray.t = 1.0f; + ray.time = time; + ray.dP = differential3_zero(); + ray.dD = dI; + + shader_setup_from_background(kg, emission_sd, &ray); + } + else +#endif + { + shader_setup_from_sample(kg, emission_sd, + ls->P, ls->Ng, I, + ls->shader, ls->object, ls->prim, + ls->u, ls->v, t, time, false, ls->lamp); - ls->Ng = emission_sd->Ng; + ls->Ng = emission_sd->Ng; + } /* No proper path flag, we're evaluating this for all closures. that's * weak but we'd have to do multiple evaluations otherwise. */ @@ -73,8 +66,16 @@ ccl_device_noinline float3 direct_emissive_eval(KernelGlobals *kg, shader_eval_surface(kg, emission_sd, state, PATH_RAY_EMISSION); path_state_modify_bounce(state, false); - /* Evaluate emissive closure. */ - eval = shader_emissive_eval(kg, emission_sd); + /* Evaluate closures. */ +#ifdef __BACKGROUND_MIS__ + if (ls->type == LIGHT_BACKGROUND) { + eval = shader_background_eval(emission_sd); + } + else +#endif + { + eval = shader_emissive_eval(emission_sd); + } } eval *= ls->eval_fac; @@ -201,7 +202,7 @@ ccl_device_noinline bool direct_emission(KernelGlobals *kg, ccl_device_noinline float3 indirect_primitive_emission(KernelGlobals *kg, ShaderData *sd, float t, int path_flag, float bsdf_pdf) { /* evaluate emissive closure */ - float3 L = shader_emissive_eval(kg, sd); + float3 L = shader_emissive_eval(sd); #ifdef __HAIR__ if(!(path_flag & PATH_RAY_MIS_SKIP) && (sd->flag & SD_USE_MIS) && (sd->type & PRIMITIVE_ALL_TRIANGLE)) @@ -294,7 +295,7 @@ ccl_device_noinline float3 indirect_background(KernelGlobals *kg, #ifdef __BACKGROUND__ int shader = kernel_data.background.surface_shader; - /* use visibility flag to skip lights */ + /* Use visibility flag to skip lights. */ if(shader & SHADER_EXCLUDE_ANY) { if(((shader & SHADER_EXCLUDE_DIFFUSE) && (state->flag & PATH_RAY_DIFFUSE)) || ((shader & SHADER_EXCLUDE_GLOSSY) && @@ -305,20 +306,27 @@ ccl_device_noinline float3 indirect_background(KernelGlobals *kg, return make_float3(0.0f, 0.0f, 0.0f); } - /* evaluate background closure */ + + /* Evaluate background shader. */ + float3 L; + if(!shader_constant_emission_eval(kg, shader, &L)) { # ifdef __SPLIT_KERNEL__ - Ray priv_ray = *ray; - shader_setup_from_background(kg, emission_sd, &priv_ray); + Ray priv_ray = *ray; + shader_setup_from_background(kg, emission_sd, &priv_ray); # else - shader_setup_from_background(kg, emission_sd, ray); + shader_setup_from_background(kg, emission_sd, ray); # endif - path_state_modify_bounce(state, true); - float3 L = shader_eval_background(kg, emission_sd, state, state->flag); - path_state_modify_bounce(state, false); + path_state_modify_bounce(state, true); + shader_eval_surface(kg, emission_sd, state, PATH_RAY_EMISSION); + path_state_modify_bounce(state, false); + + L = shader_background_eval(emission_sd); + } + /* Background MIS weights. */ #ifdef __BACKGROUND_MIS__ - /* check if background light exists or if we should skip pdf */ + /* Check if background light exists or if we should skip pdf. */ int res_x = kernel_data.integrator.pdf_background_res_x; if(!(state->flag & PATH_RAY_MIS_SKIP) && res_x) { diff --git a/intern/cycles/kernel/kernel_shader.h b/intern/cycles/kernel/kernel_shader.h index afb9ff11c10..eff792ec53d 100644 --- a/intern/cycles/kernel/kernel_shader.h +++ b/intern/cycles/kernel/kernel_shader.h @@ -984,9 +984,40 @@ ccl_device float3 shader_bssrdf_sum(ShaderData *sd, float3 *N_, float *texture_b } #endif /* __SUBSURFACE__ */ +/* Constant emission optimization */ + +ccl_device bool shader_constant_emission_eval(KernelGlobals *kg, int shader, float3 *eval) +{ + int shader_index = shader & SHADER_MASK; + int shader_flag = kernel_tex_fetch(__shaders, shader_index).flags; + + if (shader_flag & SD_HAS_CONSTANT_EMISSION) { + *eval = make_float3( + kernel_tex_fetch(__shaders, shader_index).constant_emission[0], + kernel_tex_fetch(__shaders, shader_index).constant_emission[1], + kernel_tex_fetch(__shaders, shader_index).constant_emission[2]); + + return true; + } + + return false; +} + +/* Background */ + +ccl_device float3 shader_background_eval(ShaderData *sd) +{ + if(sd->flag & SD_EMISSION) { + return sd->closure_emission_background; + } + else { + return make_float3(0.0f, 0.0f, 0.0f); + } +} + /* Emission */ -ccl_device float3 shader_emissive_eval(KernelGlobals *kg, ShaderData *sd) +ccl_device float3 shader_emissive_eval(ShaderData *sd) { if(sd->flag & SD_EMISSION) { return emissive_simple_eval(sd->Ng, sd->I) * sd->closure_emission_background; @@ -1034,20 +1065,32 @@ ccl_device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd, sd->num_closure_left = max_closures; #ifdef __OSL__ - if(kg->osl) - OSLShader::eval_surface(kg, sd, state, path_flag); + if(kg->osl) { + if (sd->object == OBJECT_NONE) { + OSLShader::eval_background(kg, sd, state, path_flag); + } + else { + OSLShader::eval_surface(kg, sd, state, path_flag); + } + } else #endif { #ifdef __SVM__ svm_eval_nodes(kg, sd, state, SHADER_TYPE_SURFACE, path_flag); #else - DiffuseBsdf *bsdf = (DiffuseBsdf*)bsdf_alloc(sd, - sizeof(DiffuseBsdf), - make_float3(0.8f, 0.8f, 0.8f)); - if(bsdf != NULL) { - bsdf->N = sd->N; - sd->flag |= bsdf_diffuse_setup(bsdf); + if(sd->object == OBJECT_NONE) { + sd->closure_emission_background = make_float3(0.8f, 0.8f, 0.8f); + sd->flag |= SD_EMISSION; + } + else { + DiffuseBsdf *bsdf = (DiffuseBsdf*)bsdf_alloc(sd, + sizeof(DiffuseBsdf), + make_float3(0.8f, 0.8f, 0.8f)); + if(bsdf != NULL) { + bsdf->N = sd->N; + sd->flag |= bsdf_diffuse_setup(bsdf); + } } #endif } @@ -1057,36 +1100,6 @@ ccl_device void shader_eval_surface(KernelGlobals *kg, ShaderData *sd, } } -/* Background Evaluation */ - -ccl_device float3 shader_eval_background(KernelGlobals *kg, ShaderData *sd, - ccl_addr_space PathState *state, int path_flag) -{ - sd->num_closure = 0; - sd->num_closure_left = 0; - -#ifdef __SVM__ -# ifdef __OSL__ - if(kg->osl) { - OSLShader::eval_background(kg, sd, state, path_flag); - } - else -# endif /* __OSL__ */ - { - svm_eval_nodes(kg, sd, state, SHADER_TYPE_SURFACE, path_flag); - } - - if(sd->flag & SD_EMISSION) { - return sd->closure_emission_background; - } - else { - return make_float3(0.0f, 0.0f, 0.0f); - } -#else /* __SVM__ */ - return make_float3(0.8f, 0.8f, 0.8f); -#endif /* __SVM__ */ -} - /* Volume */ #ifdef __VOLUME__ diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h index 281d9a25047..4b1c8e82dfa 100644 --- a/intern/cycles/kernel/kernel_types.h +++ b/intern/cycles/kernel/kernel_types.h @@ -83,102 +83,6 @@ CCL_NAMESPACE_BEGIN # define SHADER_SORT_LOCAL_SIZE 1 #endif - -/* Device capabilities */ -#ifdef __KERNEL_CPU__ -# ifdef __KERNEL_SSE2__ -# define __QBVH__ -# endif -# define __KERNEL_SHADING__ -# define __KERNEL_ADV_SHADING__ -# define __BRANCHED_PATH__ -# ifdef WITH_OSL -# define __OSL__ -# endif -# define __PRINCIPLED__ -# define __SUBSURFACE__ -# define __CMJ__ -# define __VOLUME__ -# define __VOLUME_SCATTER__ -# define __SHADOW_RECORD_ALL__ -# define __VOLUME_DECOUPLED__ -# define __VOLUME_RECORD_ALL__ -#endif /* __KERNEL_CPU__ */ - -#ifdef __KERNEL_CUDA__ -# define __KERNEL_SHADING__ -# define __KERNEL_ADV_SHADING__ -# define __VOLUME__ -# define __VOLUME_SCATTER__ -# define __SUBSURFACE__ -# define __PRINCIPLED__ -# define __SHADOW_RECORD_ALL__ -# define __CMJ__ -# ifndef __SPLIT_KERNEL__ -# define __BRANCHED_PATH__ -# endif -#endif /* __KERNEL_CUDA__ */ - -#ifdef __KERNEL_OPENCL__ - -# if defined(__KERNEL_OPENCL_AMD__) || defined(__KERNEL_OPENCL_INTEL_CPU__) -# define __CL_USE_NATIVE__ -# endif - -/* Preview kernel is used as a small kernel when the optimized kernel is still being compiled. */ -# ifdef __KERNEL_OPENCL_PREVIEW__ -# define __AO__ -# define __PASSES__ -# define __HAIR__ -# else - -/* keep __KERNEL_ADV_SHADING__ in sync with opencl_kernel_use_advanced_shading! */ - -# ifdef __KERNEL_OPENCL_NVIDIA__ -# define __KERNEL_SHADING__ -# define __KERNEL_ADV_SHADING__ -# define __SUBSURFACE__ -# define __PRINCIPLED__ -# define __VOLUME__ -# define __VOLUME_SCATTER__ -# define __SHADOW_RECORD_ALL__ -# define __CMJ__ -# define __BRANCHED_PATH__ -# endif /* __KERNEL_OPENCL_NVIDIA__ */ - -# ifdef __KERNEL_OPENCL_APPLE__ -# define __KERNEL_SHADING__ -# define __KERNEL_ADV_SHADING__ -# define __PRINCIPLED__ -# define __CMJ__ -/* TODO(sergey): Currently experimental section is ignored here, - * this is because megakernel in device_opencl does not support - * custom cflags depending on the scene features. - */ -# endif /* __KERNEL_OPENCL_APPLE__ */ - -# ifdef __KERNEL_OPENCL_AMD__ -# define __KERNEL_SHADING__ -# define __KERNEL_ADV_SHADING__ -# define __SUBSURFACE__ -# define __PRINCIPLED__ -# define __VOLUME__ -# define __VOLUME_SCATTER__ -# define __SHADOW_RECORD_ALL__ -# define __CMJ__ -# define __BRANCHED_PATH__ -# endif /* __KERNEL_OPENCL_AMD__ */ - -# ifdef __KERNEL_OPENCL_INTEL_CPU__ -# define __KERNEL_SHADING__ -# define __KERNEL_ADV_SHADING__ -# define __PRINCIPLED__ -# define __CMJ__ -# endif /* __KERNEL_OPENCL_INTEL_CPU__ */ - -# endif /* KERNEL_OPENCL_PREVIEW__ */ -#endif /* __KERNEL_OPENCL__ */ - /* Kernel features */ #define __SOBOL__ #define __INSTANCING__ @@ -195,28 +99,55 @@ CCL_NAMESPACE_BEGIN #define __SHADOW_TRICKS__ #define __DENOISING_FEATURES__ #define __SHADER_RAYTRACE__ +#define __AO__ +#define __PASSES__ +#define __HAIR__ -#ifdef __KERNEL_SHADING__ +/* Without these we get an AO render, used by OpenCL preview kernel. */ +#ifndef __KERNEL_AO_PREVIEW__ # define __SVM__ # define __EMISSION__ # define __TEXTURES__ # define __EXTRA_NODES__ # define __HOLDOUT__ -#endif - -#ifdef __KERNEL_ADV_SHADING__ # define __MULTI_CLOSURE__ # define __TRANSPARENT_SHADOWS__ -# define __PASSES__ # define __BACKGROUND_MIS__ # define __LAMP_MIS__ -# define __AO__ # define __CAMERA_MOTION__ # define __OBJECT_MOTION__ # define __HAIR__ # define __BAKING__ +# define __PRINCIPLED__ +# define __SUBSURFACE__ +# define __VOLUME__ +# define __VOLUME_SCATTER__ +# define __CMJ__ +# define __SHADOW_RECORD_ALL__ +# define __BRANCHED_PATH__ #endif +/* Device specific features */ +#ifdef __KERNEL_CPU__ +# ifdef __KERNEL_SSE2__ +# define __QBVH__ +# endif +# ifdef WITH_OSL +# define __OSL__ +# endif +# define __VOLUME_DECOUPLED__ +# define __VOLUME_RECORD_ALL__ +#endif /* __KERNEL_CPU__ */ + +#ifdef __KERNEL_CUDA__ +# ifdef __SPLIT_KERNEL__ +# undef __BRANCHED_PATH__ +# endif +#endif /* __KERNEL_CUDA__ */ + +#ifdef __KERNEL_OPENCL__ +#endif /* __KERNEL_OPENCL__ */ + /* Scene-based selective features compilation. */ #ifdef __NO_CAMERA_MOTION__ # undef __CAMERA_MOTION__ diff --git a/intern/cycles/render/light.cpp b/intern/cycles/render/light.cpp index a5854f022cd..755b941717e 100644 --- a/intern/cycles/render/light.cpp +++ b/intern/cycles/render/light.cpp @@ -185,7 +185,7 @@ LightManager::~LightManager() bool LightManager::has_background_light(Scene *scene) { foreach(Light *light, scene->lights) { - if(light->type == LIGHT_BACKGROUND) { + if(light->type == LIGHT_BACKGROUND && light->is_enabled) { return true; } } @@ -211,8 +211,7 @@ void LightManager::disable_ineffective_light(Device *device, Scene *scene) * - If we don't need it (no HDRs etc.) */ Shader *shader = (scene->background->shader) ? scene->background->shader : scene->default_background; - bool disable_mis = !(has_portal || shader->has_surface_spatial_varying) || - !(device->info.advanced_shading); + bool disable_mis = !(has_portal || shader->has_surface_spatial_varying); if(disable_mis) { VLOG(1) << "Background MIS has been disabled.\n"; foreach(Light *light, scene->lights) { diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp index 21bac460255..3c94f2dfb59 100644 --- a/intern/cycles/render/shader.cpp +++ b/intern/cycles/render/shader.cpp @@ -220,20 +220,37 @@ bool Shader::is_constant_emission(float3 *emission) { ShaderInput *surf = graph->output()->input("Surface"); - if(!surf->link || surf->link->parent->type != EmissionNode::node_type) { + if(surf->link == NULL) { return false; } - EmissionNode *node = (EmissionNode*) surf->link->parent; + if(surf->link->parent->type == EmissionNode::node_type) { + EmissionNode *node = (EmissionNode*) surf->link->parent; - assert(node->input("Color")); - assert(node->input("Strength")); + assert(node->input("Color")); + assert(node->input("Strength")); - if(node->input("Color")->link || node->input("Strength")->link) { - return false; + if(node->input("Color")->link || node->input("Strength")->link) { + return false; + } + + *emission = node->color*node->strength; } + else if(surf->link->parent->type == BackgroundNode::node_type) { + BackgroundNode *node = (BackgroundNode*) surf->link->parent; - *emission = node->color*node->strength; + assert(node->input("Color")); + assert(node->input("Strength")); + + if(node->input("Color")->link || node->input("Strength")->link) { + return false; + } + + *emission = node->color*node->strength; + } + else { + return false; + } return true; } |