Avalonia - Use embedded window for avalonia (#3674)

* wip

* use embedded window

* fix race condition on opengl Windows

* fix glx issues on prime nvidia

* fix mouse support win32

* clean up

* addressed review

* addressed review

* fix warnings

* fix sotware keyboard dialog

* Update Ryujinx.Ava/Ui/Applet/SwkbdAppletDialog.axaml.cs

Co-authored-by: gdkchan <gab.dark.100@gmail.com>

* remove double semi

Co-authored-by: gdkchan <gab.dark.100@gmail.com>
This commit is contained in:
Emmanuel Hansen 2022-09-19 18:05:26 +00:00 committed by GitHub
parent b9f1ff3c77
commit 6f0395538b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
58 changed files with 868 additions and 3531 deletions

View file

@ -20,7 +20,6 @@ namespace Ryujinx.Graphics.Vulkan
private SurfaceKHR _surface;
private PhysicalDevice _physicalDevice;
private Device _device;
private uint _queueFamilyIndex;
private WindowBase _window;
internal FormatCapabilities FormatCapabilities { get; private set; }
@ -37,7 +36,6 @@ namespace Ryujinx.Graphics.Vulkan
internal ExtDebugReport DebugReportApi { get; private set; }
internal uint QueueFamilyIndex { get; private set; }
public bool IsOffScreen { get; }
internal Queue Queue { get; private set; }
internal Queue BackgroundQueue { get; private set; }
internal object BackgroundQueueLock { get; private set; }
@ -94,22 +92,6 @@ namespace Ryujinx.Graphics.Vulkan
Samplers = new HashSet<SamplerHolder>();
}
public VulkanRenderer(Instance instance, Device device, PhysicalDevice physicalDevice, Queue queue, uint queueFamilyIndex, object lockObject)
{
_instance = instance;
_physicalDevice = physicalDevice;
_device = device;
_queueFamilyIndex = queueFamilyIndex;
Queue = queue;
QueueLock = lockObject;
IsOffScreen = true;
Shaders = new HashSet<ShaderCollection>();
Textures = new HashSet<ITexture>();
Samplers = new HashSet<SamplerHolder>();
}
private unsafe void LoadFeatures(string[] supportedExtensions, uint maxQueueCount, uint queueFamilyIndex)
{
FormatCapabilities = new FormatCapabilities(Api, _physicalDevice);
@ -286,34 +268,6 @@ namespace Ryujinx.Graphics.Vulkan
_window = new Window(this, _surface, _physicalDevice, _device);
}
private unsafe void SetupOffScreenContext(GraphicsDebugLevel logLevel)
{
var api = Vk.GetApi();
Api = api;
VulkanInitialization.CreateDebugCallbacks(api, logLevel, _instance, out var debugReport, out _debugReportCallback);
DebugReportApi = debugReport;
var supportedExtensions = VulkanInitialization.GetSupportedExtensions(api, _physicalDevice);
uint propertiesCount;
api.GetPhysicalDeviceQueueFamilyProperties(_physicalDevice, &propertiesCount, null);
QueueFamilyProperties[] queueFamilyProperties = new QueueFamilyProperties[propertiesCount];
fixed (QueueFamilyProperties* pProperties = queueFamilyProperties)
{
api.GetPhysicalDeviceQueueFamilyProperties(_physicalDevice, &propertiesCount, pProperties);
}
LoadFeatures(supportedExtensions, queueFamilyProperties[0].QueueCount, _queueFamilyIndex);
_window = new ImageWindow(this, _physicalDevice, _device);
}
public BufferHandle CreateBuffer(int size)
{
return BufferManager.CreateWithHandle(this, size, false);
@ -519,14 +473,7 @@ namespace Ryujinx.Graphics.Vulkan
public void Initialize(GraphicsDebugLevel logLevel)
{
if (IsOffScreen)
{
SetupOffScreenContext(logLevel);
}
else
{
SetupContext(logLevel);
}
SetupContext(logLevel);
PrintGpuInformation();
}
@ -638,15 +585,12 @@ namespace Ryujinx.Graphics.Vulkan
sampler.Dispose();
}
if (!IsOffScreen)
{
SurfaceApi.DestroySurface(_instance, _surface, null);
SurfaceApi.DestroySurface(_instance, _surface, null);
Api.DestroyDevice(_device, null);
Api.DestroyDevice(_device, null);
// Last step destroy the instance
Api.DestroyInstance(_instance, null);
}
// Last step destroy the instance
Api.DestroyInstance(_instance, null);
}
}
}