diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2017-07-03 16:07:14 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2017-07-03 16:18:46 +0300 |
commit | d97c3bc7ad13cb9e3ec2248ce035a62c28ac70f8 (patch) | |
tree | 6dc5b6169e1398b4dc53f5aefc7304cb13ccbcda | |
parent | 871325e26fe12efe8bf8a7042d94896f2f7faf6c (diff) | |
parent | eb1532a86094ba5d59bf62b1fbd50f74a639d0a8 (diff) |
Merge branch 'master' into blender2.8
-rw-r--r-- | intern/cycles/device/opencl/opencl_base.cpp | 10 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf.h | 5 | ||||
-rw-r--r-- | intern/cycles/kernel/closure/bsdf_principled_diffuse.h | 8 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_closure.h | 2 | ||||
-rw-r--r-- | intern/cycles/util/util_math_float3.h | 6 | ||||
-rw-r--r-- | intern/elbeem/intern/isosurface.cpp | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/rigidbody.c | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_regions.c | 4 | ||||
-rw-r--r-- | source/blender/editors/util/undo.c | 8 | ||||
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 4 |
12 files changed, 51 insertions, 22 deletions
diff --git a/intern/cycles/device/opencl/opencl_base.cpp b/intern/cycles/device/opencl/opencl_base.cpp index e4ab979dcbf..223a5901197 100644 --- a/intern/cycles/device/opencl/opencl_base.cpp +++ b/intern/cycles/device/opencl/opencl_base.cpp @@ -1226,7 +1226,7 @@ void OpenCLDeviceBase::store_cached_kernel( } string OpenCLDeviceBase::build_options_for_base_program( - const DeviceRequestedFeatures& /*requested_features*/) + const DeviceRequestedFeatures& requested_features) { /* TODO(sergey): By default we compile all features, meaning * mega kernel is not getting feature-based optimizations. @@ -1234,6 +1234,14 @@ string OpenCLDeviceBase::build_options_for_base_program( * Ideally we need always compile kernel with as less features * enabled as possible to keep performance at it's max. */ + + /* For now disable baking when not in use as this has major + * impact on kernel build times. + */ + if(!requested_features.use_baking) { + return "-D__NO_BAKING__"; + } + return ""; } diff --git a/intern/cycles/kernel/closure/bsdf.h b/intern/cycles/kernel/closure/bsdf.h index a04c157dc40..86a00d2124d 100644 --- a/intern/cycles/kernel/closure/bsdf.h +++ b/intern/cycles/kernel/closure/bsdf.h @@ -423,6 +423,11 @@ ccl_device bool bsdf_merge(ShaderClosure *a, ShaderClosure *b) case CLOSURE_BSDF_HAIR_REFLECTION_ID: case CLOSURE_BSDF_HAIR_TRANSMISSION_ID: return bsdf_hair_merge(a, b); +#ifdef __PRINCIPLED__ + case CLOSURE_BSDF_PRINCIPLED_DIFFUSE_ID: + case CLOSURE_BSDF_BSSRDF_PRINCIPLED_ID: + return bsdf_principled_diffuse_merge(a, b); +#endif #ifdef __VOLUME__ case CLOSURE_VOLUME_HENYEY_GREENSTEIN_ID: return volume_henyey_greenstein_merge(a, b); diff --git a/intern/cycles/kernel/closure/bsdf_principled_diffuse.h b/intern/cycles/kernel/closure/bsdf_principled_diffuse.h index 215c32e1ffb..f8ca64293b0 100644 --- a/intern/cycles/kernel/closure/bsdf_principled_diffuse.h +++ b/intern/cycles/kernel/closure/bsdf_principled_diffuse.h @@ -58,6 +58,14 @@ ccl_device int bsdf_principled_diffuse_setup(PrincipledDiffuseBsdf *bsdf) return SD_BSDF|SD_BSDF_HAS_EVAL; } +ccl_device bool bsdf_principled_diffuse_merge(const ShaderClosure *a, const ShaderClosure *b) +{ + const PrincipledDiffuseBsdf *bsdf_a = (const PrincipledDiffuseBsdf*)a; + const PrincipledDiffuseBsdf *bsdf_b = (const PrincipledDiffuseBsdf*)b; + + return (isequal_float3(bsdf_a->N, bsdf_b->N) && bsdf_a->roughness == bsdf_b->roughness); +} + ccl_device float3 bsdf_principled_diffuse_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf) { diff --git a/intern/cycles/kernel/svm/svm_closure.h b/intern/cycles/kernel/svm/svm_closure.h index b3d24f88420..9578fcf2687 100644 --- a/intern/cycles/kernel/svm/svm_closure.h +++ b/intern/cycles/kernel/svm/svm_closure.h @@ -158,7 +158,7 @@ ccl_device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float * } /* diffuse */ - if(fabsf(average(base_color)) > CLOSURE_WEIGHT_CUTOFF) { + if(fabsf(average(mixed_ss_base_color)) > CLOSURE_WEIGHT_CUTOFF) { if(subsurface < CLOSURE_WEIGHT_CUTOFF && diffuse_weight > CLOSURE_WEIGHT_CUTOFF) { float3 diff_weight = weight * base_color * diffuse_weight; diff --git a/intern/cycles/util/util_math_float3.h b/intern/cycles/util/util_math_float3.h index 5327d9f7cc6..bb04c4aa2d9 100644 --- a/intern/cycles/util/util_math_float3.h +++ b/intern/cycles/util/util_math_float3.h @@ -374,9 +374,9 @@ ccl_device_inline bool isfinite3_safe(float3 v) ccl_device_inline float3 ensure_finite3(float3 v) { - if(!isfinite_safe(v.x)) v.x = 0.0; - if(!isfinite_safe(v.y)) v.y = 0.0; - if(!isfinite_safe(v.z)) v.z = 0.0; + if(!isfinite_safe(v.x)) v.x = 0.0f; + if(!isfinite_safe(v.y)) v.y = 0.0f; + if(!isfinite_safe(v.z)) v.z = 0.0f; return v; } diff --git a/intern/elbeem/intern/isosurface.cpp b/intern/elbeem/intern/isosurface.cpp index b29c9e20358..de7bfe8e687 100644 --- a/intern/elbeem/intern/isosurface.cpp +++ b/intern/elbeem/intern/isosurface.cpp @@ -15,6 +15,7 @@ #include "particletracer.h" #include <algorithm> #include <stdio.h> +#include <cmath> #ifdef sun #include "ieeefp.h" @@ -25,6 +26,8 @@ #define round(x) (x) #endif +using std::isfinite; + /****************************************************************************** * Constructor *****************************************************************************/ diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 6056515af9a..11c1a9b6bb1 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1562,12 +1562,8 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime) BKE_ptcache_id_time(&pid, scene, ctime, &startframe, &endframe, NULL); cache = rbw->pointcache; - if (ctime <= startframe) { - rbw->ltime = startframe; - return; - } /* make sure we don't go out of cache frame range */ - else if (ctime > endframe) { + if (ctime > endframe) { ctime = endframe; } @@ -1583,7 +1579,6 @@ void BKE_rigidbody_do_simulation(Scene *scene, float ctime) if (BKE_ptcache_read(&pid, ctime, can_simulate)) { BKE_ptcache_validate(cache, (int)ctime); - rbw->ltime = ctime; return; } diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index e316b7f26e9..bebd3d64b44 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -2084,7 +2084,7 @@ void BKE_sequencer_proxy_set(struct Sequence *seq, bool value) } } else { - seq->flag ^= SEQ_USE_PROXY; + seq->flag &= ~SEQ_USE_PROXY; } } diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index fd6d056f7d4..738ebfcc5c2 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -2107,9 +2107,11 @@ static void ui_update_color_picker_buts_rgb(uiBlock *block, ColorPicker *cpicker continue; if (bt->rnaprop) { - ui_but_v3_set(bt, rgb); + /* original button that created the color picker already does undo + * push, so disable it on RNA buttons in the color picker block */ + UI_but_flag_disable(bt, UI_BUT_UNDO); } else if (STREQ(bt->str, "Hex: ")) { float rgb_gamma[3]; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index f5830e451e3..ff328a28ee9 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -335,6 +335,12 @@ static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op)) return ret ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } +static int ed_undo_redo_poll(bContext *C) +{ + wmOperator *last_op = WM_operator_last_redo(C); + return last_op && ED_operator_screenactive(C) && + WM_operator_check_ui_enabled(C, last_op->type->name); +} /* ********************** */ @@ -386,7 +392,7 @@ void ED_OT_undo_redo(wmOperatorType *ot) /* api callbacks */ ot->exec = ed_undo_redo_exec; - ot->poll = ED_operator_screenactive; + ot->poll = ed_undo_redo_poll; } /* ui callbacks should call this rather than calling WM_operator_repeat() themselves */ diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl index 0c36d6ca618..1f9ab45e556 100644 --- a/source/blender/gpu/shaders/gpu_shader_material.glsl +++ b/source/blender/gpu/shaders/gpu_shader_material.glsl @@ -2690,7 +2690,7 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad /* ambient light */ // TODO: set ambient light to an appropriate value - vec3 L = vec3(mix(0.1, 0.03, metallic)) * base_color.rgb; + vec3 L = mix(0.1, 0.03, metallic) * mix(base_color.rgb, subsurface_color.rgb, subsurface * (1.0 - metallic)); float eta = (2.0 / (1.0 - sqrt(0.08 * specular))) - 1.0; @@ -2704,10 +2704,11 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad /* directional lights */ for (int i = 0; i < NUM_LIGHTS; i++) { vec3 light_position_world = glLightSource[i].position.xyz; - vec3 light_position = normalize(NormalMatrix * light_position_world); + vec3 light_position = normalize(light_position_world); vec3 H = normalize(light_position + V); + vec3 light_diffuse = glLightSource[i].diffuse.rgb; vec3 light_specular = glLightSource[i].specular.rgb; float NdotL = dot(N, light_position); @@ -2748,8 +2749,9 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad // sheen vec3 Fsheen = schlick_fresnel(LdotH) * sheen * Csheen; - diffuse_and_specular_bsdf = (M_1_PI * mix(Fd, ss, subsurface) * base_color.rgb + Fsheen) - * (1.0 - metallic) + Gs * Fs * Ds; + vec3 diffuse_bsdf = (mix(Fd * base_color.rgb, ss * subsurface_color.rgb, subsurface) + Fsheen) * light_diffuse; + vec3 specular_bsdf = Gs * Fs * Ds * light_specular; + diffuse_and_specular_bsdf = diffuse_bsdf * (1.0 - metallic) + specular_bsdf; } diffuse_and_specular_bsdf *= max(NdotL, 0.0); @@ -2766,11 +2768,11 @@ void node_bsdf_principled(vec4 base_color, float subsurface, vec3 subsurface_rad float Fr = fresnel_dielectric_cos(LdotH, 1.5); //mix(0.04, 1.0, FH); float Gr = smithG_GGX(CNdotL, 0.25) * smithG_GGX(CNdotV, 0.25); - clearcoat_bsdf = clearcoat * Gr * Fr * Dr * vec3(0.25); + clearcoat_bsdf = clearcoat * Gr * Fr * Dr * vec3(0.25) * light_specular; } clearcoat_bsdf *= max(CNdotL, 0.0); - L += light_specular * (diffuse_and_specular_bsdf + clearcoat_bsdf); + L += diffuse_and_specular_bsdf + clearcoat_bsdf; } result = vec4(L, 1.0); diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 6f8aa32da86..f628c5f14d9 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -341,7 +341,7 @@ static void rna_Sequence_use_translation_set(PointerRNA *ptr, int value) } } else { - seq->flag ^= SEQ_USE_TRANSFORM; + seq->flag &= ~SEQ_USE_TRANSFORM; } } @@ -355,7 +355,7 @@ static void rna_Sequence_use_crop_set(PointerRNA *ptr, int value) } } else { - seq->flag ^= SEQ_USE_CROP; + seq->flag &= ~SEQ_USE_CROP; } } |