more Lock

This commit is contained in:
Marco Carvalho 2024-12-03 13:07:39 -03:00
parent 30e78f1a7f
commit 04e0472258
3 changed files with 9 additions and 8 deletions

View file

@ -25,7 +25,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
bool useBackground = _gd.BackgroundQueue.Handle != 0 && _gd.Vendor != Vendor.Amd; bool useBackground = _gd.BackgroundQueue.Handle != 0 && _gd.Vendor != Vendor.Amd;
Queue queue = useBackground ? _gd.BackgroundQueue : _gd.Queue; Queue queue = useBackground ? _gd.BackgroundQueue : _gd.Queue;
object queueLock = useBackground ? _gd.BackgroundQueueLock : _gd.QueueLock; Lock queueLock = useBackground ? _gd.BackgroundQueueLock : _gd.QueueLock;
lock (queueLock) lock (queueLock)
{ {

View file

@ -17,7 +17,7 @@ namespace Ryujinx.Graphics.Vulkan
private readonly Vk _api; private readonly Vk _api;
private readonly Device _device; private readonly Device _device;
private readonly Queue _queue; private readonly Queue _queue;
private readonly object _queueLock; private readonly Lock _queueLock;
private readonly bool _concurrentFenceWaitUnsupported; private readonly bool _concurrentFenceWaitUnsupported;
private readonly CommandPool _pool; private readonly CommandPool _pool;
private readonly Thread _owner; private readonly Thread _owner;
@ -63,7 +63,7 @@ namespace Ryujinx.Graphics.Vulkan
Vk api, Vk api,
Device device, Device device,
Queue queue, Queue queue,
object queueLock, Lock queueLock,
uint queueFamilyIndex, uint queueFamilyIndex,
bool concurrentFenceWaitUnsupported, bool concurrentFenceWaitUnsupported,
bool isLight = false) bool isLight = false)

View file

@ -11,6 +11,7 @@ using Silk.NET.Vulkan.Extensions.KHR;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Threading;
using Format = Ryujinx.Graphics.GAL.Format; using Format = Ryujinx.Graphics.GAL.Format;
using PrimitiveTopology = Ryujinx.Graphics.GAL.PrimitiveTopology; using PrimitiveTopology = Ryujinx.Graphics.GAL.PrimitiveTopology;
using SamplerCreateInfo = Ryujinx.Graphics.GAL.SamplerCreateInfo; using SamplerCreateInfo = Ryujinx.Graphics.GAL.SamplerCreateInfo;
@ -45,8 +46,8 @@ namespace Ryujinx.Graphics.Vulkan
internal uint QueueFamilyIndex { get; private set; } internal uint QueueFamilyIndex { get; private set; }
internal Queue Queue { get; private set; } internal Queue Queue { get; private set; }
internal Queue BackgroundQueue { get; private set; } internal Queue BackgroundQueue { get; private set; }
internal object BackgroundQueueLock { get; private set; } internal Lock BackgroundQueueLock { get; private set; }
internal object QueueLock { get; private set; } internal Lock QueueLock { get; private set; }
internal MemoryAllocator MemoryAllocator { get; private set; } internal MemoryAllocator MemoryAllocator { get; private set; }
internal HostMemoryAllocator HostMemoryAllocator { get; private set; } internal HostMemoryAllocator HostMemoryAllocator { get; private set; }
@ -120,7 +121,7 @@ namespace Ryujinx.Graphics.Vulkan
} }
public static VulkanRenderer Create( public static VulkanRenderer Create(
string preferredGpuId, string preferredGpuId,
Func<Instance, Vk, SurfaceKHR> getSurface, Func<Instance, Vk, SurfaceKHR> getSurface,
Func<string[]> getRequiredExtensions Func<string[]> getRequiredExtensions
) => new(Vk.GetApi(), getSurface, getRequiredExtensions, preferredGpuId); ) => new(Vk.GetApi(), getSurface, getRequiredExtensions, preferredGpuId);
@ -163,7 +164,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
Api.GetDeviceQueue(_device, queueFamilyIndex, 1, out var backgroundQueue); Api.GetDeviceQueue(_device, queueFamilyIndex, 1, out var backgroundQueue);
BackgroundQueue = backgroundQueue; BackgroundQueue = backgroundQueue;
BackgroundQueueLock = new object(); BackgroundQueueLock = new();
} }
PhysicalDeviceProperties2 properties2 = new() PhysicalDeviceProperties2 properties2 = new()
@ -496,7 +497,7 @@ namespace Ryujinx.Graphics.Vulkan
Api.GetDeviceQueue(_device, queueFamilyIndex, 0, out var queue); Api.GetDeviceQueue(_device, queueFamilyIndex, 0, out var queue);
Queue = queue; Queue = queue;
QueueLock = new object(); QueueLock = new();
LoadFeatures(maxQueueCount, queueFamilyIndex); LoadFeatures(maxQueueCount, queueFamilyIndex);