[Bf-blender-cvs] [e523d475a7b] cycles-x: Fix Cycles X true displacement with no faces

Sergey Sharybin noreply at git.blender.org
Mon Aug 2 09:55:50 CEST 2021


Commit: e523d475a7b88a55c629361038efc0eaab4cdd7d
Author: Sergey Sharybin
Date:   Fri Jul 30 17:54:44 2021 +0200
Branches: cycles-x
https://developer.blender.org/rBe523d475a7b88a55c629361038efc0eaab4cdd7d

Fix Cycles X true displacement with no faces

Do an explicit check for the number of triangles in the input mesh.

This allows to skip some computation, and avoids a tricky decision
about whether shading of 0 points is a success or a failure.

Test file: F10247756

Differential Revision: https://developer.blender.org/D12088

===================================================================

M	intern/cycles/render/mesh_displace.cpp

===================================================================

diff --git a/intern/cycles/render/mesh_displace.cpp b/intern/cycles/render/mesh_displace.cpp
index 5b0131a4b04..c00c4c24211 100644
--- a/intern/cycles/render/mesh_displace.cpp
+++ b/intern/cycles/render/mesh_displace.cpp
@@ -167,6 +167,13 @@ bool GeometryManager::displace(
     return false;
   }
 
+  const size_t num_verts = mesh->verts.size();
+  const size_t num_triangles = mesh->num_triangles();
+
+  if (num_triangles == 0) {
+    return false;
+  }
+
   string msg = string_printf("Computing Displacement %s", mesh->name.c_str());
   progress.set_status("Updating Mesh", msg);
 
@@ -184,9 +191,6 @@ bool GeometryManager::displace(
   device->const_copy_to("__data", &dscene->data, sizeof(dscene->data));
 
   /* Evaluate shader on device. */
-  const size_t num_verts = mesh->verts.size();
-  const size_t num_triangles = mesh->num_triangles();
-
   ShaderEval shader_eval(device, progress);
   if (!shader_eval.eval(SHADER_EVAL_DISPLACE,
                         num_verts,



More information about the Bf-blender-cvs mailing list