diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-05-10 19:23:32 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-05-14 03:40:43 +0300 |
commit | fce795415ade673dfbe4b176113c09a925150c71 (patch) | |
tree | 51f8a0cd9be5b2e108d4ad83812771f234467ad7 /intern/cycles/render/geometry.h | |
parent | 37570a73170e6cddc32ed0523b626bf0857cf068 (diff) |
Fix T87929: Cycles, missing update when visibility is modified
This issue originates from a missing BVH packing for visibility data
when it is modified.
To fix this, this adds update flags to the managers to carry the
modified visibility information from the Objects' modified flag to the
GeometryManager.
Another set of flags is added to determine which data need to be packed:
geometry, vertices, or visibility. Those flags are then used when
packing the primivites.
Reviewed By: brecht
Maniphest Tasks: T87929
Differential Revision: https://developer.blender.org/D11219
Diffstat (limited to 'intern/cycles/render/geometry.h')
-rw-r--r-- | intern/cycles/render/geometry.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/intern/cycles/render/geometry.h b/intern/cycles/render/geometry.h index abdd851a089..4fd867d9894 100644 --- a/intern/cycles/render/geometry.h +++ b/intern/cycles/render/geometry.h @@ -43,6 +43,24 @@ class Shader; class Volume; struct PackedBVH; +/* Flags used to determine which geometry data need to be packed. */ +enum PackFlags : uint32_t { + PACK_NONE = 0u, + + /* Pack the geometry information (e.g. triangle or curve keys indices). */ + PACK_GEOMETRY = (1u << 0), + + /* Pack the vertice, for Meshes and Volumes' bouding meshes. */ + PACK_VERTICES = (1u << 1), + + /* Pack the visibility flags for each triangle or curve. */ + PACK_VISIBILITY = (1u << 2), + + PACK_ALL = (PACK_GEOMETRY | PACK_VERTICES | PACK_VISIBILITY), +}; + +PackFlags operator |= (PackFlags &pack_flags, uint32_t value); + /* Geometry * * Base class for geometric types like Mesh and Hair. */ @@ -126,7 +144,7 @@ class Geometry : public Node { int n, int total); - virtual void pack_primitives(PackedBVH *pack, int object, uint visibility, bool pack_all) = 0; + virtual void pack_primitives(PackedBVH *pack, int object, uint visibility, PackFlags pack_flags) = 0; /* Check whether the geometry should have own BVH built separately. Briefly, * own BVH is needed for geometry, if: @@ -191,6 +209,8 @@ class GeometryManager { TRANSFORM_MODIFIED = (1 << 10), + VISIBILITY_MODIFIED = (1 << 11), + /* tag everything in the manager for an update */ UPDATE_ALL = ~0u, |