Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-02-09 13:24:01 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-02-09 13:34:54 +0300
commit4bcc62a257e99b93f71fd20a89885ee88f0b251e (patch)
tree435e433e494beb784369fa126b03a1ab8fe8ad8d
parent89bef5adb26fd0fde16ae223e83c4a1a1b6e5ca3 (diff)
EEVEE: Fix light culling light count and padd culling tile buffer
-rw-r--r--source/blender/blenlib/intern/math_base_inline.c8
-rw-r--r--source/blender/draw/engines/eevee/eevee_light.cc3
2 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c
index cfcc54b1136..9884e31f5a7 100644
--- a/source/blender/blenlib/intern/math_base_inline.c
+++ b/source/blender/blenlib/intern/math_base_inline.c
@@ -388,6 +388,14 @@ MINLINE uint divide_ceil_u(uint a, uint b)
return (a + b - 1) / b;
}
+/**
+ * Return the next multiple of `b` after `a`.
+ */
+MINLINE uint ceil_multiple_u(uint a, uint b)
+{
+ return ((a + b - 1) / b) * b;
+}
+
MINLINE int mod_i(int i, int n)
{
return (i % n + n) % n;
diff --git a/source/blender/draw/engines/eevee/eevee_light.cc b/source/blender/draw/engines/eevee/eevee_light.cc
index 178c42130a9..806488edea2 100644
--- a/source/blender/draw/engines/eevee/eevee_light.cc
+++ b/source/blender/draw/engines/eevee/eevee_light.cc
@@ -435,6 +435,7 @@ void LightModule::set_view(const DRWView *view, const int2 extent, bool enable_s
culling_data.enable_specular = enable_specular;
culling_data.items_count = no_lights ? 0 : light_refs_.size();
+ culling_data.items_no_cull_count = no_lights ? 0 : culling_data.items_no_cull_count;
culling_data.visible_count = 0;
culling_data.push_update();
@@ -445,7 +446,7 @@ void LightModule::set_view(const DRWView *view, const int2 extent, bool enable_s
uint word_count = tiles_extent.x * tiles_extent.y * tiles_extent.z * culling_data.tile_word_len;
/* TODO(fclem) Only resize once per redraw. */
- culling_tile_buf.resize(word_count);
+ culling_tile_buf.resize(ceil_multiple_u(word_count, 4u));
culling_tile_dispatch_size_.x = divide_ceil_u(word_count, 1024);
culling_tile_dispatch_size_.y = 1;