Skip to content

Commit 7cc0e63

Browse files
committed
Merge pull request #106924 from clayjohn/GL-blit-viewport
Correctly place viewport and use viewport relative rect for the final blit in Compatibility renderer
2 parents a872e1b + 8b2dda8 commit 7cc0e63

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/gles3/rasterizer_gles3.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,9 +431,9 @@ void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, Display
431431
Vector2 p2 = Vector2(flip_x ? p_screen_rect.position.x : screen_rect_end.x, flip_y ? p_screen_rect.position.y : screen_rect_end.y);
432432
Vector2 size = p2 - p1;
433433

434-
Rect2 screenrect = Rect2(p1 / p_screen_rect.size, (size) / p_screen_rect.size);
434+
Rect2 screenrect = Rect2(Vector2(flip_x ? 1.0 : 0.0, flip_y ? 1.0 : 0.0), Vector2(flip_x ? -1.0 : 1.0, flip_y ? -1.0 : 1.0));
435435

436-
glViewport(0, 0, Math::abs(size.x), Math::abs(size.y));
436+
glViewport(int(MIN(p1.x, p2.x)), int(MIN(p1.y, p2.y)), Math::abs(size.x), Math::abs(size.y));
437437

438438
glActiveTexture(GL_TEXTURE0);
439439
glBindTexture(GL_TEXTURE_2D, rt->color);

0 commit comments

Comments
 (0)