mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-01-19 20:08:27 +00:00
2989c163a8
* editorconfig: Add default charset * Change file encoding from UTF-8-BOM to UTF-8
38 lines
849 B
C#
38 lines
849 B
C#
using Silk.NET.Vulkan;
|
|
using System;
|
|
using System.Runtime.Serialization;
|
|
|
|
namespace Ryujinx.Graphics.Vulkan
|
|
{
|
|
static class ResultExtensions
|
|
{
|
|
public static void ThrowOnError(this Result result)
|
|
{
|
|
// Only negative result codes are errors.
|
|
if ((int)result < (int)Result.Success)
|
|
{
|
|
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)
|
|
{
|
|
}
|
|
}
|
|
}
|