EEVEE-Next: Fix incorrect shift in shadowing
Grid offset of a tile can be negative. Shifting of negative numbers is implementation dependent. This PR changes it to a multiplication. Pull Request: https://projects.blender.org/blender/blender/pulls/121910
This commit is contained in:
@@ -447,7 +447,7 @@ void ShadowDirectional::clipmap_tilemaps_distribution(Light &light, const Camera
|
||||
* offsets to a separate int. */
|
||||
int2 lvl_offset_next = tilemaps_[lod + 1]->grid_offset;
|
||||
int2 lvl_offset = tilemaps_[lod]->grid_offset;
|
||||
int2 lvl_delta = lvl_offset - (lvl_offset_next << 1);
|
||||
int2 lvl_delta = lvl_offset - (lvl_offset_next * 2);
|
||||
BLI_assert(math::abs(lvl_delta.x) <= 1 && math::abs(lvl_delta.y) <= 1);
|
||||
pos_offset |= math::max(lvl_delta, int2(0)) << lod;
|
||||
neg_offset |= math::max(-lvl_delta, int2(0)) << lod;
|
||||
|
||||
@@ -172,7 +172,7 @@ void clipmap_sync(inout LightData light)
|
||||
* offsets to a separate int. */
|
||||
int2 lvl_offset_next = tilemaps_buf[light.tilemap_index + lod + 1].grid_offset;
|
||||
int2 lvl_offset = tilemaps_buf[light.tilemap_index + lod].grid_offset;
|
||||
int2 lvl_delta = lvl_offset - (lvl_offset_next << 1);
|
||||
int2 lvl_delta = lvl_offset - (lvl_offset_next * 2);
|
||||
pos_offset |= max(lvl_delta, int2(0)) << lod;
|
||||
neg_offset |= max(-lvl_delta, int2(0)) << lod;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user