Merge branch 'blender-v3.0-release'

This commit is contained in:
Sergey Sharybin 2021-11-02 15:42:09 +01:00
commit c01b3c534b
2 changed files with 16 additions and 1 deletions

View File

@ -1588,9 +1588,20 @@ void GeometryManager::device_update_displacement_images(Device *device,
set<int> bump_images;
foreach (Geometry *geom, scene->geometry) {
if (geom->is_modified()) {
/* Geometry-level check for hair shadow transparency.
* This matches the logic in the `Hair::update_shadow_transparency()`, avoiding access to
* possible non-loaded images. */
bool need_shadow_transparency = false;
if (geom->geometry_type == Geometry::HAIR) {
Hair *hair = static_cast<Hair *>(geom);
need_shadow_transparency = hair->need_shadow_transparency();
}
foreach (Node *node, geom->get_used_shaders()) {
Shader *shader = static_cast<Shader *>(node);
if (!shader->has_displacement || shader->get_displacement_method() == DISPLACE_BUMP) {
const bool is_true_displacement = (shader->has_displacement &&
shader->get_displacement_method() != DISPLACE_BUMP);
if (!is_true_displacement && !need_shadow_transparency) {
continue;
}
foreach (ShaderNode *node, shader->graph->nodes) {

View File

@ -610,6 +610,10 @@ constexpr bool operator==(StringRef a, StringRef b)
if (a.size() != b.size()) {
return false;
}
if (a.data() == b.data()) {
/* This also avoids passing null to the call below, which would results in an ASAN warning. */
return true;
}
return STREQLEN(a.data(), b.data(), (size_t)a.size());
}