some optimizations. apply current transform to native window instead of defaulting to Identity

This commit is contained in:
Emmanuel Hansen 2023-08-08 16:06:35 +00:00
parent c732a9fbb6
commit 7a2fadb499
12 changed files with 473 additions and 35 deletions

View file

@ -72,6 +72,8 @@ namespace Ryujinx.Graphics.Vulkan
public IWindow Window => _window;
public SurfaceTransformFlagsKHR CurrentTransform => _window.CurrentTransform;
private readonly Func<Instance, Vk, SurfaceKHR> _getSurface;
private readonly Func<string[]> _getRequiredExtensions;
private readonly string _preferredGpuId;

View file

@ -132,6 +132,8 @@ namespace Ryujinx.Graphics.Vulkan
var oldSwapchain = _swapchain;
CurrentTransform = capabilities.CurrentTransform;
var swapchainCreateInfo = new SwapchainCreateInfoKHR
{
SType = StructureType.SwapchainCreateInfoKhr,
@ -143,7 +145,7 @@ namespace Ryujinx.Graphics.Vulkan
ImageUsage = ImageUsageFlags.ColorAttachmentBit | ImageUsageFlags.TransferDstBit | ImageUsageFlags.StorageBit,
ImageSharingMode = SharingMode.Exclusive,
ImageArrayLayers = 1,
PreTransform = Ryujinx.Common.SystemInfo.SystemInfo.IsAndroid() ? SurfaceTransformFlagsKHR.IdentityBitKhr : capabilities.CurrentTransform,
PreTransform = capabilities.CurrentTransform,
CompositeAlpha = ChooseCompositeAlpha(capabilities.SupportedCompositeAlpha),
PresentMode = ChooseSwapPresentMode(presentModes, _vsyncEnabled),
Clipped = true,

View file

@ -1,4 +1,5 @@
using Ryujinx.Graphics.GAL;
using Silk.NET.Vulkan;
using System;
namespace Ryujinx.Graphics.Vulkan
@ -7,6 +8,8 @@ namespace Ryujinx.Graphics.Vulkan
{
public bool ScreenCaptureRequested { get; set; }
public SurfaceTransformFlagsKHR CurrentTransform { get; set; }
public abstract void Dispose();
public abstract void Present(ITexture texture, ImageCrop crop, Action swapBuffersCallback);
public abstract void SetSize(int width, int height);