From 2b6df550bb10164b6e10d62d54ad0125857cdf49 Mon Sep 17 00:00:00 2001 From: TheJackiMonster <thejackimonster@gmail.com> Date: Thu, 21 Jul 2022 22:03:01 +0200 Subject: [PATCH] Fixed issue with invalid invocations Signed-off-by: TheJackiMonster <thejackimonster@gmail.com> --- projects/fire_works/shaders/generation.comp | 2 +- projects/fire_works/shaders/trail.geom | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/fire_works/shaders/generation.comp b/projects/fire_works/shaders/generation.comp index 445c8f49..864a9e44 100644 --- a/projects/fire_works/shaders/generation.comp +++ b/projects/fire_works/shaders/generation.comp @@ -148,7 +148,7 @@ void main() { { const uint tid = atomicAdd(trailIndex, 1) % trails.length(); - const uint trailLen = 64 + int(randomData[(tid + id) % randomData.length()] * 32); + const uint trailLen = 96 + int(randomData[(tid + id) % randomData.length()] * 32); const uint startIndex = atomicAdd(pointIndex, trailLen) % points.length(); diff --git a/projects/fire_works/shaders/trail.geom b/projects/fire_works/shaders/trail.geom index 39ab595a..14299724 100644 --- a/projects/fire_works/shaders/trail.geom +++ b/projects/fire_works/shaders/trail.geom @@ -6,7 +6,7 @@ layout(points) in; layout (triangle_strip, max_vertices = (INSTANCE_LEN * 2)) out; -layout(invocations = 32) in; +layout(invocations = 8) in; #include "physics.inc" #include "point.inc" @@ -44,9 +44,9 @@ 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) { + if ((indexOffset >= useCount) && (indexOffset + INSTANCE_LEN > useCount)) { count = indexOffset - useCount; } -- GitLab