From fb27042e01b0fa110184673d436ec96ec8cf20c7 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 20 May 2023 13:15:07 -0300 Subject: Limit compute storage buffer size (#5028) --- src/Ryujinx.Graphics.Vulkan/BufferManager.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/Ryujinx.Graphics.Vulkan/BufferManager.cs') diff --git a/src/Ryujinx.Graphics.Vulkan/BufferManager.cs b/src/Ryujinx.Graphics.Vulkan/BufferManager.cs index 27678ed5..e046bf89 100644 --- a/src/Ryujinx.Graphics.Vulkan/BufferManager.cs +++ b/src/Ryujinx.Graphics.Vulkan/BufferManager.cs @@ -1,4 +1,5 @@ -using Ryujinx.Graphics.GAL; +using Ryujinx.Common.Logging; +using Ryujinx.Graphics.GAL; using Silk.NET.Vulkan; using System; using System.Runtime.CompilerServices; @@ -95,16 +96,27 @@ namespace Ryujinx.Graphics.Vulkan return Unsafe.As(ref handle64); } - public BufferHandle CreateWithHandle(VulkanRenderer gd, int size, BufferAllocationType baseType = BufferAllocationType.HostMapped, BufferHandle storageHint = default) + public BufferHandle CreateWithHandle( + VulkanRenderer gd, + int size, + BufferAllocationType baseType = BufferAllocationType.HostMapped, + BufferHandle storageHint = default) { return CreateWithHandle(gd, size, out _, baseType, storageHint); } - public BufferHandle CreateWithHandle(VulkanRenderer gd, int size, out BufferHolder holder, BufferAllocationType baseType = BufferAllocationType.HostMapped, BufferHandle storageHint = default) + public BufferHandle CreateWithHandle( + VulkanRenderer gd, + int size, + out BufferHolder holder, + BufferAllocationType baseType = BufferAllocationType.HostMapped, + BufferHandle storageHint = default) { holder = Create(gd, size, baseType: baseType, storageHint: storageHint); if (holder == null) { + Logger.Error?.Print(LogClass.Gpu, $"Failed to create buffer with size 0x{size:X} and type \"{baseType}\"."); + return BufferHandle.Null; } -- cgit v1.2.3