Ryujinx/src/Ryujinx.Graphics.Vulkan/VulkanException.cs
gdkchan b8d992e5a7
Allow skipping draws with broken pipeline variants on Vulkan (#5807)
* Allow skipping draws with broken pipeline variants on Vulkan

* Move IsLinked check to CreatePipeline

* Restore throw on error behaviour for background compile

* Can't remove SetAlphaTest pragmas yet

* Double new line
2024-01-26 13:58:57 -03:00

43 lines
1,006 B
C#

using Silk.NET.Vulkan;
using System;
using System.Runtime.Serialization;
namespace Ryujinx.Graphics.Vulkan
{
static class ResultExtensions
{
public static bool IsError(this Result result)
{
// Only negative result codes are errors.
return result < Result.Success;
}
public static void ThrowOnError(this Result result)
{
// Only negative result codes are errors.
if (result.IsError())
{
throw new VulkanException(result);
}
}
}
class VulkanException : Exception
{
public VulkanException()
{
}
public VulkanException(Result result) : base($"Unexpected API error \"{result}\".")
{
}
public VulkanException(string message) : base(message)
{
}
public VulkanException(string message, Exception innerException) : base(message, innerException)
{
}
}
}