Skip to content

Instantly share code, notes, and snippets.

@Popov72
Last active February 14, 2024 04:36
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Popov72/41f71cbf8d55f2cb8cae93f439eee347 to your computer and use it in GitHub Desktop.
Save Popov72/41f71cbf8d55f2cb8cae93f439eee347 to your computer and use it in GitHub Desktop.
Using PIX with Chrome

In PIX, Select Target Process => Launch Win32 and set the following 2 entries according to where Canary / Chrome is installed:

  • Path to executable: "C:\Users\alexis\AppData\Local\Google\Chrome SxS\Application\chrome.exe"
  • Working directory: "C:\Users\alexis\AppData\Local\Google\Chrome SxS\Application"
  • Command line arguments: --disable-gpu-sandbox --disable-direct-composition
    • You can add those arguments if you want to be able to see the disassembled shader code: --enable-dawn-features=emit_hlsl_debug_symbols,disable_symbol_renaming
  • Launch Suspended unchecked, Launch for GPU capture and Force D3D11On12 checked

Then click on "Launch".

Important: you should close all your Canary / Chrome windows/processes before clicking on the "Launch" button!

To Capture a frame (GPU Capture frame):

  • Choose Present-to-Present
  • Click on the Capture icon
    • You probably need to set Capture frame count to 2 (I had to), otherwise the capture won't contain your commands, only those of Canary / Chrome
  • If you do other captures you can get an "An error occurred during capture" popup: just close it, the capture does work (at least it works for me).

If you want the debug markers to work inside PIX, you need to perform those steps: https://dawn.googlesource.com/dawn/+/refs/heads/main/docs/debug_markers.md

Notes:

  • I could not locate the libdawn_native.dll file: I have simply copied the WinPixEventRuntime.dll file into "C:\Users\alexis\AppData\Local\Google\Chrome SxS\Application<version>" and it did work
  • If you update Canary / Chrome, this file will be removed, you will have to copy it again
@Aaron-Bird
Copy link

How to show and debug shader source code?
I jump to the Debug interface through the debug pixel button.like this:
屏幕截图 2024-02-09 180658

I saw the source option in some tutorials, but I can't find it.like this:
屏幕截图 2024-02-09 182023

Command line parameters:

--disable-gpu-sandbox --disable-direct-composition --no-sandbox --disable-gpu-watchdog --gpu-startup-dialog --disable-features=RendererCodeIntegrity --enable-dawn-features=emit_hlsl_debug_symbols,disable_symbol_renaming http://127.0.0.1:8000/

Thanks for your help.

@Popov72
Copy link
Author

Popov72 commented Feb 9, 2024

It does work for me with these parameters in latest Canary: --disable-gpu-sandbox --disable-direct-composition --enable-dawn-features=emit_hlsl_debug_symbols,disable_symbol_renaming,dump_shaders

image

This article may help you: https://toji.dev/webgpu-profiling/pix

@Aaron-Bird
Copy link

PIX outputs the following error in the shader option of the pipeline.
2024-02-09 203559

Do I need to create a PDB with a shader file according to this tutorial?
https://devblogs.microsoft.com/pix/using-automatic-shader-pdb-resolution-in-pix/

@Popov72
Copy link
Author

Popov72 commented Feb 10, 2024

I'm not a PIX expert, unfortunately. However, I don't understand why it wouldn't work for you if it works for me. I see that you don't have dump_shaders in the list of parameters: have you tried using exactly the same parameters as me?

@Aaron-Bird
Copy link

I tested many parameters (including dump_shaders), but it still doesn't work.
Thank you again for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment