ResultExtensions.cs 416 B

1234567891011121314151617
  1. using System;
  2. using Silk.NET.Vulkan;
  3. namespace Ryujinx.Ava.Ui.Vulkan
  4. {
  5. public static class ResultExtensions
  6. {
  7. public static void ThrowOnError(this Result result)
  8. {
  9. // Only negative result codes are errors.
  10. if ((int)result < (int)Result.Success)
  11. {
  12. throw new Exception($"Unexpected API error \"{result}\".");
  13. }
  14. }
  15. }
  16. }