Vendor.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System.Text.RegularExpressions;
  2. namespace Ryujinx.Graphics.Vulkan
  3. {
  4. enum Vendor
  5. {
  6. Amd,
  7. Intel,
  8. Nvidia,
  9. Qualcomm,
  10. Unknown
  11. }
  12. static class VendorUtils
  13. {
  14. public static Regex AmdGcnRegex = new Regex(@"Radeon (((HD|R(5|7|9|X)) )?((M?[2-6]\d{2}(\D|$))|([7-8]\d{3}(\D|$))|Fury|Nano))|(Pro Duo)");
  15. public static Vendor FromId(uint id)
  16. {
  17. return id switch
  18. {
  19. 0x1002 => Vendor.Amd,
  20. 0x10DE => Vendor.Nvidia,
  21. 0x8086 => Vendor.Intel,
  22. 0x5143 => Vendor.Qualcomm,
  23. _ => Vendor.Unknown
  24. };
  25. }
  26. public static string GetNameFromId(uint id)
  27. {
  28. return id switch
  29. {
  30. 0x1002 => "AMD",
  31. 0x1010 => "ImgTec",
  32. 0x10DE => "NVIDIA",
  33. 0x13B5 => "ARM",
  34. 0x1AE0 => "Google",
  35. 0x5143 => "Qualcomm",
  36. 0x8086 => "Intel",
  37. 0x10001 => "Vivante",
  38. 0x10002 => "VeriSilicon",
  39. 0x10003 => "Kazan",
  40. 0x10004 => "Codeplay Software Ltd.",
  41. 0x10005 => "Mesa",
  42. 0x10006 => "PoCL",
  43. _ => $"0x{id:X}"
  44. };
  45. }
  46. }
  47. }