GpuSpoof
static class · namespace z3n7 · source Browser/GpuSpoof.cs
public static class GpuSpoof
Picks a plausible WebGL vendor/renderer pair of the same GPU architecture as the machine's card, from the public PCI ID list.
Methods
BuildGpuJson
public static string BuildGpuJson(string pciIdsUrl = "https://pci-ids.ucw.cz/v2.2/pci.ids")
Downloads the PCI ID list and groups the GPU models of NVIDIA, AMD and Intel by vendor and architecture (only GeForce/Quadro/Tesla/RTX, Radeon/Navi/Vega/Polaris and HD Graphics/UHD/Iris/Xe/Arc entries).
| Parameter | Description |
|---|---|
pciIdsUrl |
URL of pci.ids. |
Returns: JSON [{ Vendor, Archs: [{ Arch, Models: [{ DeviceId, Name, Chip }] }] }].
DetectCurrentArch
public static string DetectCurrentArch(string gpuJson, string cardName = null)
Architecture of the card in gpuJson: the first model of the card's vendor whose name contains the card name or is contained in it.
| Parameter | Description |
|---|---|
gpuJson |
JSON from BuildGpuJson. |
cardName |
Card name; default is the current card (GetCurrentCardName). |
Returns: Architecture name, or an empty string.
EnsureGpuJson
public static string EnsureGpuJson(string path)
Reads the GPU JSON from path; when the file does not exist, builds it with BuildGpuJson and saves it (one builder at a time).
| Parameter | Description |
|---|---|
path |
Cache file. |
GetCurrentCardName
public static string GetCurrentCardName()
Full name of the machine's video card from WMI (the second card when there are several); empty on error.
GetCurrentVendor
public static string GetCurrentVendor()
Vendor of the machine's video card from WMI Win32_VideoController; with several cards the second one is used.
Returns: NVIDIA, AMD, Intel, the first word of another name, or an empty string.
LoadGpuJson
public static string LoadGpuJson(string path)
Reads the GPU JSON from a file.
RandomAngleString
public static string[] RandomAngleString(string gpuJson, string cardName = null)
Random model of the same vendor and architecture as the card, formatted as Chrome's ANGLE strings.
| Parameter | Description |
|---|---|
gpuJson |
JSON from BuildGpuJson. |
cardName |
Card name; default is the current card (GetCurrentCardName). |
Returns: ["Google Inc. (NVIDIA)", "ANGLE (NVIDIA, NVIDIA {model} (0x0000XXXX) Direct3D11 vs_5_0 ps_5_0, D3D11)"]; two empty strings when the architecture is unknown.
SaveGpuJson
public static void SaveGpuJson(string json, string path)
Writes the GPU JSON to a file (UTF-8).