EEVEE-Next: Fix shadow tests

Fix an issue in `find_first_valid` where Nvidia would incorrectly
increment `src` after return.
This should fix the issue where some tiles would stay corrupted
until resetting EEVEE.

Initialize tiles_data in `TestAlloc` so it doesn't fail in debug builds.

Pull Request: https://projects.blender.org/blender/blender/pulls/114550
This commit is contained in:
Miguel Pozo
2023-11-06 20:35:14 +01:00
parent 6e4adbe694
commit 0db6d8a5fc
2 changed files with 9 additions and 2 deletions

View File

@@ -24,11 +24,14 @@ const uint max_page = SHADOW_MAX_PAGE;
void find_first_valid(inout uint src, uint dst)
{
for (; src < dst; src++) {
if (pages_cached_buf[src % max_page].x != uint(-1)) {
for (uint i = src; i < dst; i++) {
if (pages_cached_buf[i % max_page].x != uint(-1)) {
src = i;
return;
}
}
src = dst;
}
void page_cached_free(uint page_index)

View File

@@ -648,6 +648,10 @@ class TestAlloc {
GPU_render_begin();
int tiles_index = 1;
for (int i : IndexRange(SHADOW_MAX_TILE)) {
tiles_data[i] = 0;
}
for (uint i : IndexRange(0, page_free_count)) {
uint2 page = {i % SHADOW_PAGE_PER_ROW, i / SHADOW_PAGE_PER_ROW};
pages_free_data[i] = page.x | (page.y << 16u);