Merge pull request #46892 from lawnjelly/ewok_scissor_boost

Batching - fix off by one error in light scissoring
This commit is contained in:
Rémi Verschelde 2021-03-11 21:11:06 +01:00 committed by GitHub
commit 8e1c92a365
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1162,10 +1162,17 @@ PREAMBLE(bool)::_light_scissor_begin(const Rect2 &p_item_rect, const Transform2D
int rh = get_storage()->frame.current_rt->height;
// using the exact size was leading to off by one errors,
// possibly due to pixel snap. For this reason we will boost
// the scissor area by 1 pixel, this will take care of any rounding
// issues, and shouldn't significantly negatively impact performance.
int y = rh - (cliprect.position.y + cliprect.size.y);
y += 1; // off by 1 boost before flipping
if (get_storage()->frame.current_rt->flags[RasterizerStorage::RENDER_TARGET_VFLIP])
y = cliprect.position.y;
get_this()->gl_enable_scissor(cliprect.position.x, y, cliprect.size.width, cliprect.size.height);
get_this()->gl_enable_scissor(cliprect.position.x - 1, y, cliprect.size.width + 2, cliprect.size.height + 2);
return true;
}