Fix T61475 Particle edit does not render children if path step > 7

Gives 2 more bits to the segment count. Also subtract 1 because segment
count cannot be negative.
This commit is contained in:
Clément Foucault 2019-03-19 14:25:32 +01:00
parent 58e27cca97
commit e72dc667c4
Notes: blender-bot 2023-02-14 09:02:40 +01:00
Referenced by commit af3f4f29e4, DRW: Fix hair count being limited by recent refactor
Referenced by issue #61475, Particle edit does not render children (Cycles) even though Display/Children is being checked
2 changed files with 7 additions and 3 deletions

View File

@ -793,8 +793,12 @@ static int particle_batch_cache_fill_strands_data(
continue;
}
/* XXX: We might need something more robust.
* Adjust shader code accordingly. (see unpack_strand_data() ) */
BLI_assert((path->segments - 1) <= 0x3FF);
uint *seg_data = (uint *)GPU_vertbuf_raw_step(data_step);
*seg_data = (curr_point & 0xFFFFFF) | (path->segments << 24);
*seg_data = (curr_point & 0x3FFFFF) | ((path->segments - 1) << 22);
curr_point += path->segments + 1;
if (psmd != NULL) {

View File

@ -46,8 +46,8 @@ void unpack_strand_data(uint data, out int strand_offset, out int strand_segment
// strand_offset = (data & 0x1FFFFFFFu);
// strand_segments = 1u << (data >> 29u); /* We only need 3 bits to store subdivision level. */
#else
strand_offset = int(data & 0x00FFFFFFu);
strand_segments = int(data >> 24u);
strand_offset = int(data & 0x003FFFFFu);
strand_segments = int(data >> 22u) + 1;
#endif
}