You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Fix splash screen upside down on Android
Fixes an issue introduced in #96439 (see https://github.com/godotengine/godot/pull/96439#issuecomment-2447288702) Godot was relying on Java's activity.getWindowManager().getDefaultDisplay().getRotation(); to apply pre-rotation but this is wrong. First, getRotation() may temporarily return a different value from the correct one; which is what was causing the splash screen to be upside down. It would return -90 instead of 90 for the first rendered frame. But unfortunately, the splash screen is just one frame rendered for a very long time, so the error lingered for a long time for everyone to see. Second, to determine what rotation to use, we should be looking at what Vulkan told us, which is the value we pass to VkSurfaceTransformFlagBitsKHR::preTransform. This commit removes the now-unnecessary screen_get_internal_current_rotation() function (which was introduced by #96439) and now saves the preTransform value in the swapchain.
This commit is contained in:
@@ -67,7 +67,7 @@ void RendererCompositorRD::blit_render_targets_to_screen(DisplayServer::WindowID
|
||||
RD::get_singleton()->draw_list_bind_uniform_set(draw_list, render_target_descriptors[rd_texture], 0);
|
||||
|
||||
// We need to invert the phone rotation.
|
||||
int screen_rotation_degrees = -DisplayServer::get_singleton()->screen_get_internal_current_rotation();
|
||||
const int screen_rotation_degrees = -RD::get_singleton()->screen_get_pre_rotation_degrees(p_screen);
|
||||
float screen_rotation = Math::deg_to_rad((float)screen_rotation_degrees);
|
||||
|
||||
blit.push_constant.rotation_cos = Math::cos(screen_rotation);
|
||||
@@ -238,7 +238,7 @@ void RendererCompositorRD::set_boot_image(const Ref<Image> &p_image, const Color
|
||||
RD::get_singleton()->draw_list_bind_index_array(draw_list, blit.array);
|
||||
RD::get_singleton()->draw_list_bind_uniform_set(draw_list, uset, 0);
|
||||
|
||||
int screen_rotation_degrees = DisplayServer::get_singleton()->screen_get_internal_current_rotation();
|
||||
const int screen_rotation_degrees = -RD::get_singleton()->screen_get_pre_rotation_degrees(DisplayServer::MAIN_WINDOW_ID);
|
||||
float screen_rotation = Math::deg_to_rad((float)screen_rotation_degrees);
|
||||
blit.push_constant.rotation_cos = Math::cos(screen_rotation);
|
||||
blit.push_constant.rotation_sin = Math::sin(screen_rotation);
|
||||
|
||||
Reference in New Issue
Block a user