summaryrefslogtreecommitdiffstats
path: root/drivers/gles3/rasterizer_gles3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3/rasterizer_gles3.cpp')
-rw-r--r--drivers/gles3/rasterizer_gles3.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/gles3/rasterizer_gles3.cpp b/drivers/gles3/rasterizer_gles3.cpp
index 14ef0f40cf..da2320c23d 100644
--- a/drivers/gles3/rasterizer_gles3.cpp
+++ b/drivers/gles3/rasterizer_gles3.cpp
@@ -194,6 +194,11 @@ typedef void(GLAPIENTRY *DebugMessageCallbackARB)(DEBUGPROCARB callback, const v
void RasterizerGLES3::initialize() {
Engine::get_singleton()->print_header(vformat("OpenGL API %s - Compatibility - Using Device: %s - %s", RS::get_singleton()->get_video_adapter_api_version(), RS::get_singleton()->get_video_adapter_vendor(), RS::get_singleton()->get_video_adapter_name()));
+
+ // FLIP XY Bug: Are more devices affected?
+ // Confirmed so far: all Adreno 3xx
+ // ok on some tested Adreno devices: 4xx, 5xx and 6xx
+ flip_xy_bugfix = GLES3::Config::get_singleton()->adreno_3xx_compatibility;
}
void RasterizerGLES3::finalize() {
@@ -398,8 +403,18 @@ void RasterizerGLES3::_blit_render_target_to_screen(RID p_render_target, Display
}
Vector2i screen_rect_end = p_screen_rect.get_end();
+
+ // Adreno (TM) 3xx devices have a bug that create wrong Landscape rotation of 180 degree
+ // Reversing both the X and Y axis is equivalent to rotating 180 degrees
+ bool flip_x = false;
+ if (flip_xy_bugfix && screen_rect_end.x > screen_rect_end.y) {
+ flip_y = !flip_y;
+ flip_x = !flip_x;
+ }
+
glBlitFramebuffer(0, 0, rt->size.x, rt->size.y,
- p_screen_rect.position.x, flip_y ? screen_rect_end.y : p_screen_rect.position.y, screen_rect_end.x, flip_y ? p_screen_rect.position.y : screen_rect_end.y,
+ flip_x ? screen_rect_end.x : p_screen_rect.position.x, flip_y ? screen_rect_end.y : p_screen_rect.position.y,
+ flip_x ? p_screen_rect.position.x : screen_rect_end.x, flip_y ? p_screen_rect.position.y : screen_rect_end.y,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
if (read_fbo != 0) {