Vendor.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 partial class VendorUtils
  13. {
  14. [GeneratedRegex("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 partial Regex AmdGcnRegex();
  16. public static Vendor FromId(uint id)
  17. {
  18. return id switch
  19. {
  20. 0x1002 => Vendor.Amd,
  21. 0x10DE => Vendor.Nvidia,
  22. 0x8086 => Vendor.Intel,
  23. 0x5143 => Vendor.Qualcomm,
  24. _ => Vendor.Unknown
  25. };
  26. }
  27. public static string GetNameFromId(uint id)
  28. {
  29. return id switch
  30. {
  31. 0x1002 => "AMD",
  32. 0x1010 => "ImgTec",
  33. 0x10DE => "NVIDIA",
  34. 0x13B5 => "ARM",
  35. 0x1AE0 => "Google",
  36. 0x5143 => "Qualcomm",
  37. 0x8086 => "Intel",
  38. 0x10001 => "Vivante",
  39. 0x10002 => "VeriSilicon",
  40. 0x10003 => "Kazan",
  41. 0x10004 => "Codeplay Software Ltd.",
  42. 0x10005 => "Mesa",
  43. 0x10006 => "PoCL",
  44. _ => $"0x{id:X}"
  45. };
  46. }
  47. }
  48. }