Merge pull request #91545 from clayjohn/RD-shadow-atlas

Properly set size of shadow atlas quadrant when subdivision is 8 or higher.
This commit is contained in:
Rémi Verschelde 2024-05-04 11:52:45 +02:00
commit 7ebc866418
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 4 additions and 4 deletions

View File

@ -2025,7 +2025,7 @@ void LightStorage::shadow_atlas_set_size(RID p_atlas, int p_size, bool p_16_bits
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
//clear subdivisions //clear subdivisions
shadow_atlas->quadrants[i].shadows.clear(); shadow_atlas->quadrants[i].shadows.clear();
shadow_atlas->quadrants[i].shadows.resize(int64_t(1) << int64_t(shadow_atlas->quadrants[i].subdivision)); shadow_atlas->quadrants[i].shadows.resize(int64_t(shadow_atlas->quadrants[i].subdivision * shadow_atlas->quadrants[i].subdivision));
} }
//erase shadow atlas reference from lights //erase shadow atlas reference from lights

View File

@ -3451,9 +3451,9 @@ RenderingDevice::DrawListID RenderingDevice::draw_list_begin(RID p_framebuffer,
if (p_region != Rect2() && p_region != Rect2(Vector2(), viewport_size)) { // Check custom region. if (p_region != Rect2() && p_region != Rect2(Vector2(), viewport_size)) { // Check custom region.
Rect2i viewport(viewport_offset, viewport_size); Rect2i viewport(viewport_offset, viewport_size);
Rect2i regioni = p_region; Rect2i regioni = p_region;
if (!(regioni.position.x >= viewport.position.x) && (regioni.position.y >= viewport.position.y) && if (!((regioni.position.x >= viewport.position.x) && (regioni.position.y >= viewport.position.y) &&
((regioni.position.x + regioni.size.x) <= (viewport.position.x + viewport.size.x)) && ((regioni.position.x + regioni.size.x) <= (viewport.position.x + viewport.size.x)) &&
((regioni.position.y + regioni.size.y) <= (viewport.position.y + viewport.size.y))) { ((regioni.position.y + regioni.size.y) <= (viewport.position.y + viewport.size.y)))) {
ERR_FAIL_V_MSG(INVALID_ID, "When supplying a custom region, it must be contained within the framebuffer rectangle"); ERR_FAIL_V_MSG(INVALID_ID, "When supplying a custom region, it must be contained within the framebuffer rectangle");
} }