Vendor.cs 1.5 KB

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