From 0ec3e573cf52b7790b82f3ad9185d5b97f18355b Mon Sep 17 00:00:00 2001 From: elom0n <74347790+elom0n@users.noreply.github.com> Date: Thu, 21 Jul 2022 21:59:29 +0200 Subject: [PATCH] fix trail bug --- projects/fire_works/shaders/trail.geom | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/fire_works/shaders/trail.geom b/projects/fire_works/shaders/trail.geom index 39ab595a..3db1cd8c 100644 --- a/projects/fire_works/shaders/trail.geom +++ b/projects/fire_works/shaders/trail.geom @@ -43,11 +43,16 @@ void main() { const uint indexOffset = (gl_InvocationID * (INSTANCE_LEN - 1)); const uint instanceIndex = startIndex + indexOffset; - - uint count = INSTANCE_LEN; + + uint count = min(INSTANCE_LEN, useCount); if (indexOffset + INSTANCE_LEN > useCount) { - count = indexOffset - useCount; + if(indexOffset >= useCount){ + count = indexOffset - useCount; + }else{ + count = 0; + return; + } } if (count <= 1) { -- GitLab