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:
parent
ef8d981267
commit
b9a2f108fc
12 changed files with 42 additions and 53 deletions
|
|
@ -360,13 +360,6 @@ public:
|
|||
|
||||
virtual void screen_set_orientation(ScreenOrientation p_orientation, int p_screen = SCREEN_OF_MAIN_WINDOW);
|
||||
virtual ScreenOrientation screen_get_orientation(int p_screen = SCREEN_OF_MAIN_WINDOW) const;
|
||||
// Note: The "internal" current orientation is not necessarily the current orientation and will often be 0 for most platforms.
|
||||
//
|
||||
// Some Android GPUs come with a HW-based rotator which means the screen gets rotated for free to
|
||||
// whatever orientation the device is currently facing. But many Android GPUs emulate it via SW instead,
|
||||
// which costs performance and power. This value is an optimization that tells Godot's compositor how to
|
||||
// rotate the render texture before presenting to screen so that Android's compositor doesn't have to.
|
||||
virtual int screen_get_internal_current_rotation(int p_screen = SCREEN_OF_MAIN_WINDOW) const { return 0; }
|
||||
|
||||
virtual void screen_set_keep_on(bool p_enable); //disable screensaver
|
||||
virtual bool screen_is_kept_on() const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue