diff --git a/source/blender/draw/engines/eevee/shaders/eevee_lightprobe_sphere_remap_comp.glsl b/source/blender/draw/engines/eevee/shaders/eevee_lightprobe_sphere_remap_comp.glsl index 7d9eaaceaa6..e16a322b8dc 100644 --- a/source/blender/draw/engines/eevee/shaders/eevee_lightprobe_sphere_remap_comp.glsl +++ b/source/blender/draw/engines/eevee/shaders/eevee_lightprobe_sphere_remap_comp.glsl @@ -137,13 +137,15 @@ void main() /* OpenGL/Intel drivers have known issues where it isn't able to compile barriers inside for * loops. Unroll is needed as driver might decide to not unroll in shaders with more * complexity. */ - [[gpu::unroll(10)]] for (uint stride = group_size / 2; stride > 0; stride /= 2) + [[gpu::unroll]] for (uint i = 0; i < 10; i++) { barrier(); + uint stride = group_size >> (i + 1u); if (local_index < stride) { local_radiance[local_index] += local_radiance[local_index + stride]; } } + barrier(); if (gl_LocalInvocationIndex == 0u) { out_sun[work_group_index].radiance = local_radiance[0].xyz; @@ -158,9 +160,10 @@ void main() /* OpenGL/Intel drivers have known issues where it isn't able to compile barriers inside for * loops. Unroll is needed as driver might decide to not unroll in shaders with more * complexity. */ - [[gpu::unroll(10)]] for (uint stride = group_size / 2; stride > 0; stride /= 2) + [[gpu::unroll]] for (uint i = 0; i < 10; i++) { barrier(); + uint stride = group_size >> (i + 1u); if (local_index < stride) { local_direction[local_index] += local_direction[local_index + stride]; } @@ -179,13 +182,15 @@ void main() /* OpenGL/Intel drivers have known issues where it isn't able to compile barriers inside for * loops. Unroll is needed as driver might decide to not unroll in shaders with more * complexity. */ - [[gpu::unroll(10)]] for (uint stride = group_size / 2; stride > 0; stride /= 2) + [[gpu::unroll]] for (uint i = 0; i < 10; i++) { barrier(); + uint stride = group_size >> (i + 1u); if (local_index < stride) { local_radiance[local_index] += local_radiance[local_index + stride]; } } + barrier(); if (gl_LocalInvocationIndex == 0u) { /* Find the middle point of the whole thread-group. Use it as light vector.