diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-12-06 21:50:05 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-12-06 21:50:05 +0300 |
commit | cccc40db51a0b73d396952be65ef351a7c68ed4f (patch) | |
tree | b21eb475141563e80fcbf77e62739eddc757776c | |
parent | d24cfa329b221cae4a6e7ecc4d0e4ea778ac5c71 (diff) |
Fix T57963: Cycles crash using AO for displacement.
Note this is not supported, there exists no geometry at this point, but
it should not crash at least.
-rw-r--r-- | intern/cycles/kernel/svm/svm_ao.h | 5 | ||||
-rw-r--r-- | intern/cycles/kernel/svm/svm_bevel.h | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/intern/cycles/kernel/svm/svm_ao.h b/intern/cycles/kernel/svm/svm_ao.h index 0337c88a543..15d074780c4 100644 --- a/intern/cycles/kernel/svm/svm_ao.h +++ b/intern/cycles/kernel/svm/svm_ao.h @@ -33,6 +33,11 @@ ccl_device_noinline float svm_ao(KernelGlobals *kg, return 1.0f; } + /* Can't raytrace from shaders like displacement, before BVH exists. */ + if (kernel_data.bvh.bvh_layout == BVH_LAYOUT_NONE) { + return 1.0f; + } + if(flags & NODE_AO_INSIDE) { N = -N; } diff --git a/intern/cycles/kernel/svm/svm_bevel.h b/intern/cycles/kernel/svm/svm_bevel.h index 79d0fb6ddbe..96d132acd73 100644 --- a/intern/cycles/kernel/svm/svm_bevel.h +++ b/intern/cycles/kernel/svm/svm_bevel.h @@ -34,6 +34,11 @@ ccl_device_noinline float3 svm_bevel( return sd->N; } + /* Can't raytrace from shaders like displacement, before BVH exists. */ + if (kernel_data.bvh.bvh_layout == BVH_LAYOUT_NONE) { + return sd->N; + } + /* Don't bevel for blurry indirect rays. */ if(state->min_ray_pdf < 8.0f) { return sd->N; |