EEVEE: Fix Lights On High-res Monitors

When using EEVEE on high resolution monitors the light buffers might not
get initialized as there are range checks that pass in the first try.

- number of tiles needed is larger than the max_tile_count_threshold
- total_word_count is smaller than max_word_count_threshold as it is
  never set (still initialized to zero.

Solution is to not exit on the first try. In a later stage we might want
to use something that doesn't require any looping.

Fixes: #117128
Pull Request: https://projects.blender.org/blender/blender/pulls/117164
This commit is contained in:
Jeroen Bakker
2024-01-16 13:29:25 +01:00
parent c4aef91652
commit 8954099042

View File

@@ -354,6 +354,7 @@ void LightModule::end_sync()
/* Default to 32 as this is likely to be the maximum
* tile size used by hardware or compute shading. */
uint tile_size = 16;
bool tile_size_valid = false;
do {
tile_size *= 2;
tiles_extent = math::divide_ceil(render_extent, int2(tile_size));
@@ -362,8 +363,9 @@ void LightModule::end_sync()
continue;
}
total_word_count_ = tile_count * word_per_tile;
tile_size_valid = true;
} while (total_word_count_ > max_word_count_threshold);
} while (total_word_count_ > max_word_count_threshold || !tile_size_valid);
/* Keep aligned with storage buffer requirements. */
total_word_count_ = ceil_to_multiple_u(total_word_count_, 32);