From 297ce0a2009cf54149218841f5cc115ce792261a Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Tue, 16 Jan 2024 12:46:19 +0100 Subject: [PATCH 1/2] EEVEE: Fix Lights On HDPI 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. --- source/blender/draw/engines/eevee_next/eevee_light.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/draw/engines/eevee_next/eevee_light.cc b/source/blender/draw/engines/eevee_next/eevee_light.cc index 0beb489270d..135a71c2b49 100644 --- a/source/blender/draw/engines/eevee_next/eevee_light.cc +++ b/source/blender/draw/engines/eevee_next/eevee_light.cc @@ -358,6 +358,7 @@ void LightModule::end_sync() tile_size *= 2; tiles_extent = math::divide_ceil(render_extent, int2(tile_size)); uint tile_count = tiles_extent.x * tiles_extent.y; + printf("%s(tile_size=%d,tile_count=%d)\n", __func__, tile_size, tile_count); if (tile_count > max_tile_count_threshold) { continue; } @@ -375,6 +376,7 @@ void LightModule::end_sync() culling_data_buf_.local_lights_len = local_lights_len_; culling_data_buf_.sun_lights_len = sun_lights_len_; } + printf("%s(%d)\n", __func__, total_word_count_); culling_tile_buf_.resize(total_word_count_); culling_pass_sync(); -- 2.30.2 From 792b767bb02c68ba681581128498867934e54475 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Tue, 16 Jan 2024 13:27:54 +0100 Subject: [PATCH 2/2] Ensure that one loop is always done. --- source/blender/draw/engines/eevee_next/eevee_light.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/blender/draw/engines/eevee_next/eevee_light.cc b/source/blender/draw/engines/eevee_next/eevee_light.cc index 135a71c2b49..ed22ab6deab 100644 --- a/source/blender/draw/engines/eevee_next/eevee_light.cc +++ b/source/blender/draw/engines/eevee_next/eevee_light.cc @@ -354,17 +354,18 @@ 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)); uint tile_count = tiles_extent.x * tiles_extent.y; - printf("%s(tile_size=%d,tile_count=%d)\n", __func__, tile_size, tile_count); if (tile_count > max_tile_count_threshold) { 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); @@ -376,7 +377,6 @@ void LightModule::end_sync() culling_data_buf_.local_lights_len = local_lights_len_; culling_data_buf_.sun_lights_len = sun_lights_len_; } - printf("%s(%d)\n", __func__, total_word_count_); culling_tile_buf_.resize(total_word_count_); culling_pass_sync(); -- 2.30.2