Archived
1
0
forked from MeloNX/MeloNX

Add work around for Adreno batched texture + sampler descriptor updates bug

(cherry picked from commit 93abc5ac47fedc413a3437c65de9fecf0555afa6)
This commit is contained in:
Gabriel A 2023-07-05 21:17:59 -03:00 committed by Emmanuel Hansen
parent 32064ccba5
commit 88c45e1e86
2 changed files with 39 additions and 3 deletions

View File

@ -0,0 +1,34 @@
namespace Ryujinx.Graphics.Gpu.Memory
{
/// <summary>
/// Virtual memory range used for buffers.
/// </summary>
readonly struct VirtualBufferBounds
{
/// <summary>
/// Base virtual address.
/// </summary>
public ulong GpuVa { get; }
/// <summary>
/// Binding size.
/// </summary>
public ulong Size { get; }
/// <summary>
/// Creates a new virtual buffer region.
/// </summary>
/// <param name="gpuVa">Base virtual address</param>
/// <param name="size">Binding size</param>
public VirtualBufferBounds(ulong gpuVa, ulong size)
{
GpuVa = gpuVa;
Size = size;
}
public bool Equals(ulong gpuVa, ulong size)
{
return GpuVa == gpuVa && Size == size;
}
}
}

View File

@ -1,4 +1,4 @@
using Ryujinx.Common.Logging;
using Ryujinx.Common.Logging;
using Ryujinx.Graphics.GAL;
using Silk.NET.Vulkan;
using System;
@ -130,9 +130,10 @@ namespace Ryujinx.Graphics.Vulkan
UsePushDescriptors = usePushDescriptors;
Stages = stages;
bool hasBatchedTextureSamplerBug = false;//gd.Vendor == Vendor.Qualcomm;
ClearSegments = BuildClearSegments(sets);
BindingSegments = BuildBindingSegments(resourceLayout.SetUsages, out bool usesBufferTextures);
BindingSegments = BuildBindingSegments(resourceLayout.SetUsages, hasBatchedTextureSamplerBug, out bool usesBufferTextures);
Templates = BuildTemplates(usePushDescriptors);
(IncoherentBufferWriteStages, IncoherentTextureWriteStages) = BuildIncoherentStages(resourceLayout.SetUsages);
@ -289,7 +290,7 @@ namespace Ryujinx.Graphics.Vulkan
return segments;
}
private static ResourceBindingSegment[][] BuildBindingSegments(ReadOnlyCollection<ResourceUsageCollection> setUsages, out bool usesBufferTextures)
private static ResourceBindingSegment[][] BuildBindingSegments(ReadOnlyCollection<ResourceUsageCollection> setUsages, bool hasBatchedTextureSamplerBug, out bool usesBufferTextures)
{
usesBufferTextures = false;
@ -313,6 +314,7 @@ namespace Ryujinx.Graphics.Vulkan
if (currentUsage.Binding + currentCount != usage.Binding ||
currentUsage.Type != usage.Type ||
(currentUsage.Type == ResourceType.TextureAndSampler && hasBatchedTextureSamplerBug) ||
currentUsage.Stages != usage.Stages ||
currentUsage.ArrayLength > 1 ||
usage.ArrayLength > 1)