0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-22 23:55:47 +00:00

Use draw clear on Adreno, instead of vkCmdClearAttachments (#7013)

* Use draw clear on Adreno, instead of vkCmdClearAttachments

* Fix GTX TITAN detection
This commit is contained in:
gdkchan 2024-07-10 17:52:45 -03:00 committed by GitHub
parent 1668ba913f
commit 07435ad844
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 11 deletions

View file

@ -35,7 +35,7 @@ namespace Ryujinx.Graphics.Vulkan
queue, queue,
queueLock, queueLock,
_gd.QueueFamilyIndex, _gd.QueueFamilyIndex,
_gd.IsConcurrentFenceWaitUnsupported, _gd.IsQualcommProprietary,
isLight: true); isLight: true);
} }
} }

View file

@ -1021,7 +1021,7 @@ namespace Ryujinx.Graphics.Vulkan
_newState.RasterizerDiscardEnable = discard; _newState.RasterizerDiscardEnable = discard;
SignalStateChange(); SignalStateChange();
if (!discard && Gd.Vendor == Vendor.Qualcomm) if (!discard && Gd.IsQualcommProprietary)
{ {
// On Adreno, enabling rasterizer discard somehow corrupts the viewport state. // On Adreno, enabling rasterizer discard somehow corrupts the viewport state.
// Force it to be updated on next use to work around this bug. // Force it to be updated on next use to work around this bug.

View file

@ -47,10 +47,11 @@ namespace Ryujinx.Graphics.Vulkan
return; return;
} }
if (componentMask != 0xf) if (componentMask != 0xf || Gd.IsQualcommProprietary)
{ {
// We can't use CmdClearAttachments if not writing all components, // We can't use CmdClearAttachments if not writing all components,
// because on Vulkan, the pipeline state does not affect clears. // because on Vulkan, the pipeline state does not affect clears.
// On proprietary Adreno drivers, CmdClearAttachments appears to execute out of order, so it's better to not use it at all.
var dstTexture = FramebufferParams.GetColorView(index); var dstTexture = FramebufferParams.GetColorView(index);
if (dstTexture == null) if (dstTexture == null)
{ {
@ -87,10 +88,11 @@ namespace Ryujinx.Graphics.Vulkan
return; return;
} }
if (stencilMask != 0 && stencilMask != 0xff) if ((stencilMask != 0 && stencilMask != 0xff) || Gd.IsQualcommProprietary)
{ {
// We can't use CmdClearAttachments if not clearing all (mask is all ones, 0xFF) or none (mask is 0) of the stencil bits, // We can't use CmdClearAttachments if not clearing all (mask is all ones, 0xFF) or none (mask is 0) of the stencil bits,
// because on Vulkan, the pipeline state does not affect clears. // because on Vulkan, the pipeline state does not affect clears.
// On proprietary Adreno drivers, CmdClearAttachments appears to execute out of order, so it's better to not use it at all.
var dstTexture = FramebufferParams.GetDepthStencilView(); var dstTexture = FramebufferParams.GetDepthStencilView();
if (dstTexture == null) if (dstTexture == null)
{ {

View file

@ -133,7 +133,7 @@ namespace Ryujinx.Graphics.Vulkan
Templates = BuildTemplates(usePushDescriptors); Templates = BuildTemplates(usePushDescriptors);
// Updating buffer texture bindings using template updates crashes the Adreno driver on Windows. // Updating buffer texture bindings using template updates crashes the Adreno driver on Windows.
UpdateTexturesWithoutTemplate = gd.Vendor == Vendor.Qualcomm && usesBufferTextures; UpdateTexturesWithoutTemplate = gd.IsQualcommProprietary && usesBufferTextures;
_compileTask = Task.CompletedTask; _compileTask = Task.CompletedTask;
_firstBackgroundUse = false; _firstBackgroundUse = false;

View file

@ -87,10 +87,10 @@ namespace Ryujinx.Graphics.Vulkan
internal bool IsAmdGcn { get; private set; } internal bool IsAmdGcn { get; private set; }
internal bool IsNvidiaPreTuring { get; private set; } internal bool IsNvidiaPreTuring { get; private set; }
internal bool IsIntelArc { get; private set; } internal bool IsIntelArc { get; private set; }
internal bool IsQualcommProprietary { get; private set; }
internal bool IsMoltenVk { get; private set; } internal bool IsMoltenVk { get; private set; }
internal bool IsTBDR { get; private set; } internal bool IsTBDR { get; private set; }
internal bool IsSharedMemory { get; private set; } internal bool IsSharedMemory { get; private set; }
internal bool IsConcurrentFenceWaitUnsupported { get; private set; }
public string GpuVendor { get; private set; } public string GpuVendor { get; private set; }
public string GpuDriver { get; private set; } public string GpuDriver { get; private set; }
@ -325,8 +325,6 @@ namespace Ryujinx.Graphics.Vulkan
Vendor == Vendor.Broadcom || Vendor == Vendor.Broadcom ||
Vendor == Vendor.ImgTec; Vendor == Vendor.ImgTec;
IsConcurrentFenceWaitUnsupported = Vendor == Vendor.Qualcomm;
GpuVendor = VendorUtils.GetNameFromId(properties.VendorID); GpuVendor = VendorUtils.GetNameFromId(properties.VendorID);
GpuDriver = hasDriverProperties && !OperatingSystem.IsMacOS() ? GpuDriver = hasDriverProperties && !OperatingSystem.IsMacOS() ?
VendorUtils.GetFriendlyDriverName(driverProperties.DriverID) : GpuVendor; // Fallback to vendor name if driver is unavailable or on MacOS where vendor is preferred. VendorUtils.GetFriendlyDriverName(driverProperties.DriverID) : GpuVendor; // Fallback to vendor name if driver is unavailable or on MacOS where vendor is preferred.
@ -348,7 +346,7 @@ namespace Ryujinx.Graphics.Vulkan
{ {
IsNvidiaPreTuring = gpuNumber < 2000; IsNvidiaPreTuring = gpuNumber < 2000;
} }
else if (GpuDriver.Contains("TITAN") && !GpuDriver.Contains("RTX")) else if (GpuRenderer.Contains("TITAN") && !GpuRenderer.Contains("RTX"))
{ {
IsNvidiaPreTuring = true; IsNvidiaPreTuring = true;
} }
@ -358,6 +356,8 @@ namespace Ryujinx.Graphics.Vulkan
IsIntelArc = GpuRenderer.StartsWith("Intel(R) Arc(TM)"); IsIntelArc = GpuRenderer.StartsWith("Intel(R) Arc(TM)");
} }
IsQualcommProprietary = hasDriverProperties && driverProperties.DriverID == DriverId.QualcommProprietary;
ulong minResourceAlignment = Math.Max( ulong minResourceAlignment = Math.Max(
Math.Max( Math.Max(
properties.Limits.MinStorageBufferOffsetAlignment, properties.Limits.MinStorageBufferOffsetAlignment,
@ -415,7 +415,7 @@ namespace Ryujinx.Graphics.Vulkan
Api.TryGetDeviceExtension(_instance.Instance, _device, out ExtExternalMemoryHost hostMemoryApi); Api.TryGetDeviceExtension(_instance.Instance, _device, out ExtExternalMemoryHost hostMemoryApi);
HostMemoryAllocator = new HostMemoryAllocator(MemoryAllocator, Api, hostMemoryApi, _device); HostMemoryAllocator = new HostMemoryAllocator(MemoryAllocator, Api, hostMemoryApi, _device);
CommandBufferPool = new CommandBufferPool(Api, _device, Queue, QueueLock, queueFamilyIndex, IsConcurrentFenceWaitUnsupported); CommandBufferPool = new CommandBufferPool(Api, _device, Queue, QueueLock, queueFamilyIndex, IsQualcommProprietary);
PipelineLayoutCache = new PipelineLayoutCache(); PipelineLayoutCache = new PipelineLayoutCache();
@ -692,7 +692,7 @@ namespace Ryujinx.Graphics.Vulkan
GpuVendor, GpuVendor,
memoryType: memoryType, memoryType: memoryType,
hasFrontFacingBug: IsIntelWindows, hasFrontFacingBug: IsIntelWindows,
hasVectorIndexingBug: Vendor == Vendor.Qualcomm, hasVectorIndexingBug: IsQualcommProprietary,
needsFragmentOutputSpecialization: IsMoltenVk, needsFragmentOutputSpecialization: IsMoltenVk,
reduceShaderPrecision: IsMoltenVk, reduceShaderPrecision: IsMoltenVk,
supportsAstcCompression: features2.Features.TextureCompressionAstcLdr && supportsAstcFormats, supportsAstcCompression: features2.Features.TextureCompressionAstcLdr && supportsAstcFormats,