Fix T78431: Update mesh_cd_layers_type_ to support 8 bytes.
Sculpt vertex colors changed the `DRW_MeshCDMask` from 4 bytes to 8 bytes, but the functions assumed it still was 4 bytes. This patch updates the functions and adds a compile time check. Reviewed By: Clément Foucault Differential Revision: https://developer.blender.org/D8215
This commit is contained in:
parent
2ba1cf4b40
commit
6cc88e330b
Notes:
blender-bot
2023-02-14 03:21:27 +01:00
Referenced by issue #78431, Atomics DRW_MeshCDMask
|
@ -60,6 +60,10 @@ typedef struct DRW_MeshCDMask {
|
|||
* modifiers could remove it. (see T68857) */
|
||||
uint32_t edit_uv : 1;
|
||||
} DRW_MeshCDMask;
|
||||
/* Keep `DRW_MeshCDMask` struct within an `uint64_t`.
|
||||
* bit-wise and atomic operations are used to compare and update the struct.
|
||||
* See `mesh_cd_layers_type_*` functions. */
|
||||
BLI_STATIC_ASSERT(sizeof(DRW_MeshCDMask) <= sizeof(uint64_t), "DRW_MeshCDMask exceeds 64 bits")
|
||||
|
||||
typedef enum eMRIterType {
|
||||
MR_ITER_LOOPTRI = 1 << 0,
|
||||
|
|
|
@ -74,22 +74,25 @@ static void mesh_batch_cache_clear(Mesh *me);
|
|||
/* Return true is all layers in _b_ are inside _a_. */
|
||||
BLI_INLINE bool mesh_cd_layers_type_overlap(DRW_MeshCDMask a, DRW_MeshCDMask b)
|
||||
{
|
||||
return (*((uint32_t *)&a) & *((uint32_t *)&b)) == *((uint32_t *)&b);
|
||||
return (*((uint64_t *)&a) & *((uint64_t *)&b)) == *((uint64_t *)&b);
|
||||
}
|
||||
|
||||
BLI_INLINE bool mesh_cd_layers_type_equal(DRW_MeshCDMask a, DRW_MeshCDMask b)
|
||||
{
|
||||
return *((uint32_t *)&a) == *((uint32_t *)&b);
|
||||
return *((uint64_t *)&a) == *((uint64_t *)&b);
|
||||
}
|
||||
|
||||
BLI_INLINE void mesh_cd_layers_type_merge(DRW_MeshCDMask *a, DRW_MeshCDMask b)
|
||||
{
|
||||
atomic_fetch_and_or_uint32((uint32_t *)a, *(uint32_t *)&b);
|
||||
uint32_t *a_p = (uint32_t *)a;
|
||||
uint32_t *b_p = (uint32_t *)&b;
|
||||
atomic_fetch_and_or_uint32(a_p, *b_p);
|
||||
atomic_fetch_and_or_uint32(a_p + 1, *(b_p + 1));
|
||||
}
|
||||
|
||||
BLI_INLINE void mesh_cd_layers_type_clear(DRW_MeshCDMask *a)
|
||||
{
|
||||
*((uint32_t *)a) = 0;
|
||||
*((uint64_t *)a) = 0;
|
||||
}
|
||||
|
||||
static void mesh_cd_calc_edit_uv_layer(const Mesh *UNUSED(me), DRW_MeshCDMask *cd_used)
|
||||
|
|
Loading…
Reference in New Issue