mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 21:11:53 +01:00
Don't block on surface creation in GetTransformHint
We want to avoid blocking on surface creation unless necessary, this commit doesn't wait on the creation of the surface as it default initializes the value which'll generally be `Identity` or the transformation of the previous surface if it was lost. Co-authored-by: Billy Laws <blaws05@gmail.com>
This commit is contained in:
parent
35133381b6
commit
0992fde028
@ -377,8 +377,8 @@ namespace skyline::gpu {
|
||||
u64 PresentationEngine::Present(const std::shared_ptr<TextureView> &texture, i64 timestamp, i64 swapInterval, AndroidRect crop, NativeWindowScalingMode scalingMode, NativeWindowTransform transform, skyline::service::hosbinder::AndroidFence fence, const std::function<void()> &presentCallback) {
|
||||
if (!vkSurface.has_value()) {
|
||||
// We want this function to generally (not necessarily always) block when a surface is not present to implicitly pause the game
|
||||
std::unique_lock lock(mutex);
|
||||
surfaceCondition.wait(lock, [this]() { return vkSurface.has_value(); });
|
||||
std::unique_lock lock{mutex};
|
||||
surfaceCondition.wait(lock, [this] { return vkSurface.has_value(); });
|
||||
}
|
||||
|
||||
presentQueue.Push(PresentableFrame{
|
||||
@ -397,8 +397,7 @@ namespace skyline::gpu {
|
||||
}
|
||||
|
||||
NativeWindowTransform PresentationEngine::GetTransformHint() {
|
||||
std::unique_lock lock(mutex);
|
||||
surfaceCondition.wait(lock, [this]() { return vkSurface.has_value(); });
|
||||
std::unique_lock lock{mutex};
|
||||
return GetAndroidTransform(vkSurfaceCapabilities.currentTransform);
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ namespace skyline::gpu {
|
||||
i64 windowLastTimestamp{}; //!< The last timestamp submitted to the window, 0 or CLOCK_MONOTONIC value
|
||||
|
||||
std::optional<vk::raii::SurfaceKHR> vkSurface; //!< The Vulkan Surface object that is backed by ANativeWindow
|
||||
vk::SurfaceCapabilitiesKHR vkSurfaceCapabilities; //!< The capabilities of the current Vulkan Surface
|
||||
vk::SurfaceCapabilitiesKHR vkSurfaceCapabilities{}; //!< The capabilities of the current Vulkan Surface
|
||||
|
||||
std::optional<vk::raii::SwapchainKHR> vkSwapchain; //!< The Vulkan swapchain and the properties associated with it
|
||||
vk::raii::Fence acquireFence; //!< A fence for acquiring an image from the swapchain
|
||||
|
Loading…
Reference in New Issue
Block a user