Commit: e72dc667c4d3ef0b4a4c306dd6b12cae9d37287b
Author: Clément Foucault
Date:   Tue Mar 19 14:25:32 2019 +0100
Branches: master
https://developer.blender.org/rBe72dc667c4d3ef0b4a4c306dd6b12cae9d37287b

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.

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

M       source/blender/draw/intern/draw_cache_impl_particles.c
M       source/blender/draw/modes/shaders/common_hair_lib.glsl

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

diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c 
b/source/blender/draw/intern/draw_cache_impl_particles.c
index 6790a8aa0cc..2c940f9bab8 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -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) {
diff --git a/source/blender/draw/modes/shaders/common_hair_lib.glsl 
b/source/blender/draw/modes/shaders/common_hair_lib.glsl
index da86f7a7086..9cda44c8f42 100644
--- a/source/blender/draw/modes/shaders/common_hair_lib.glsl
+++ b/source/blender/draw/modes/shaders/common_hair_lib.glsl
@@ -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
 }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to