This repository makes GPU profilers usable for inspecting WebGPU workloads running on Chrome for Windows. It does this through two complementary mechanisms: a legacy shim d3d12.dll that was placed next to Chrome but is now deprecated, and a Detours-based hook DLL injected at launch time by a dedicated launcher executable. If you would like to know more about why this thing exists and how it solves the problem at hand, please read my blog post Shimming d3d12.dll for fun and profit.
⚠ Before anything else, please remember that this is a hacky solution and that you should not browse the open web with these tools attached. They should only be used for a GPU profiling session.
The repository builds four artifacts:
| Artifact | Description |
|---|---|
d3d12.dll |
Legacy shim DLL. Placed next to chrome.exe, it intercepts D3D12 calls before Chrome can load the real d3d12.dll. |
d3d12_webgpu_hook.dll |
Hook DLL that uses Microsoft Detours to patch D3D12 entry points in-process at runtime. This avoids touching Chrome's install directory. |
webgpu_profiling_launcher.exe |
Launcher that creates Chrome suspended, injects d3d12_webgpu_hook.dll via CreateRemoteThread + LoadLibrary, then resumes the process. |
webgpu_injector.exe |
Standalone injector that attaches d3d12_webgpu_hook.dll to an already-running process by PID or process name. Use this when your profiler (e.g. Nsight) needs to be the one launching Chrome. |
The launcher approach is now the default one as Chrome has hardened its DLL loading policies and prevents loading our custom d3d12.dll by default.
A comprehensive explanation on how to use these tools is provided in the following article on my blog : GPU profiling for WebGPU workloads on Windows with Chrome.
- Build the project (see Building) or download the artifacts from the releases page.
- On AMD, download
WinPixEventRuntime.dllfrom the release section of that repository and place it in the<Chrome Dir>\<Version Number>folder. - Run the launcher, passing the path to
chrome.exeand any extra Chrome flags. Ex with recommended flags:webgpu_profiling_launcher.exe [path\to\chrome.exe] --no-sandbox --disable-gpu-sandbox --disable-gpu-watchdog --disable-direct-composition --do-not-de-elevate --enable-dawn-features=emit_hlsl_debug_symbols,disable_symbol_renaming - The launcher will start Chrome with the hook already active. Use your favourite GPU profiler as usual.
Some GPU profilers such as NVIDIA Nsight need to launch the target process themselves in order to instrument it. In that case, use webgpu_injector.exe to attach the hook DLL after Chrome is already running.
- Build the project or download the artifacts from the releases page.
- On AMD, place
WinPixEventRuntime.dllin the<Chrome Dir>\<Version Number>folder (see Option A step 2). - Launch Chrome through your profiler as usual, passing the recommended flags:
--no-sandbox --disable-gpu-sandbox --disable-gpu-watchdog --disable-direct-composition --do-not-de-elevate --enable-dawn-features=emit_hlsl_debug_symbols,disable_symbol_renaming - Once Chrome is running, run the injector, targeting all Chrome processes by name:
Windows will prompt for elevation automatically (UAC). This injects the hook into every running
webgpu_injector.exe chrome.exechrome.exeprocess. In the browser process the hook patchesCreateProcessWso that any GPU child process Chrome spawns afterwards also receives the DLL automatically. If the GPU process is already running, it is patched directly as well. - Reload the tab with the WebGPU workload.
- Use your profiler as usual.
- Build or download
d3d12.dllfrom this repository.- Place the DLL into the
\Google\Chrome\Applicationfolder.
- Place the DLL into the
- On AMD, download
WinPixEventRuntime.dllfrom the release section of that repository.- Place it into the
\Google\Chrome\Application\<Version Number>folder.
- Place it into the
- When launching Chrome, use the following command line arguments:
--no-sandbox --disable-gpu-sandbox --disable-gpu-watchdog --disable-direct-composition --do-not-de-elevate --enable-dawn-features=emit_hlsl_debug_symbols,disable_symbol_renaming
- Use your favorite GPU profiler as usual.
Prerequisites: Visual Studio 2019 or later with the Desktop development with C++ workload, and CMake 3.14+.
Microsoft Detours is fetched and built automatically by CMake — no manual setup is required.
git clone https://github.com/frguthmann/d3d12_webgpu_shim.git
cd d3d12_webgpu_shim
cmake -S . -B build
cmake --build build --config RelWithDebInfo
The four artifacts are placed in build\RelWithDebInfo\. Alternatively, open the generated Visual Studio solution (build\d3d12_webgpu_shim.sln) and build from the IDE.
Then follow the How to use instructions.
I would like to thank Marco Castorina and Ray Dey without whom this hack probably wouldn't exist :).