Vendor.cs 1.6 KB

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