Fix EEVEE-Next: Shadow: Missing shadow on first frame

This was caused by the free unused data pass in the
init phase that would reset the clip data of the first
tilemap.

Uploading and checking for an invalid index fixes the
issue.
This commit is contained in:
Clément Foucault
2023-08-09 14:54:02 +02:00
parent 6923f7a153
commit 4d74b91d5c
2 changed files with 6 additions and 3 deletions

View File

@@ -197,7 +197,7 @@ void ShadowTileMapPool::end_sync(ShadowModule &module)
* of the setup steps to release the pages. */
ShadowTileMapData tilemap_data = {};
tilemap_data.tiles_index = index;
tilemap_data.clip_data_index = 0;
tilemap_data.clip_data_index = -1;
tilemap_data.grid_shift = int2(SHADOW_TILEMAP_RES);
tilemap_data.projection_type = SHADOW_PROJECTION_CUBEFACE;

View File

@@ -36,8 +36,11 @@ void main()
/* Reset shift to not tag for update more than once per sync cycle. */
tilemaps_buf[tilemap_index].grid_shift = ivec2(0);
if (tilemap.projection_type != SHADOW_PROJECTION_CUBEFACE) {
int clip_index = tilemap.clip_data_index;
int clip_index = tilemap.clip_data_index;
if (clip_index == -1) {
/* Noop. This is the case for unused tilemaps that are getting pushed to the free heap. */
}
else if (tilemap.projection_type != SHADOW_PROJECTION_CUBEFACE) {
ShadowTileMapClip clip_data = tilemaps_clip_buf[clip_index];
float clip_near_new = orderedIntBitsToFloat(clip_data.clip_near);
float clip_far_new = orderedIntBitsToFloat(clip_data.clip_far);