Skip to content
Mark Janes edited this page Sep 16, 2019 · 10 revisions

Linux

  • Build a 32bit version of apitrace as described in the build instructions

  • Ensure you have no instance of steam client running.

  • Invoke the Steam client as

      DEBUGGER="apitrace trace" steam steam://rungameid/12345
    

    where 12345 should be replaced with the appropriate steam app id for the game. In most cases it can be found by doing grep game_name ~/.local/share/Steam/SteamApps/*.acf. The name of the file (e.g. appmanifest_12345.acf) contains the app id. Otherwise, use the number from the Steam Store URL of the game.

    On 64-bits distributions there might be a few messages like

      ERROR: ld.so: object '.../glxtrace.so' from LD_PRELOAD cannot be preloaded: ignored.
    

    because ld.so fails to preload the 32-bits glxtrace.so into 64-bits sh/bash processes, but these messages are harmless and can be ignored.

The Steam client uses a LD_PRELOAD shared object to overlay information on top of the games. With top of master, apitrace should no longer crash with the overlay, but it will not capture it out of the box neither:

  • To avoid the overlay completely, disable Settings > In-Game Settings > Enable Steam Community In-Game.

  • To capture the overlay rendering you must use the alternative injection mechanism of using LD_LIBRARY_PATH, as described here.

Steam also has the ability to set "Launch Options" for each title:

  • Right-click on the title and edit the properties

  • "SET LAUNCH OPTIONS..."

  • /path/to/apitrace-x32/apitrace trace -o /path/to/outfile.trace %command%"

Windows

First, it's a good idea to disable the Steam Overlay in the Steam client settings. To do so:

  • start the Steam client
  • go to Steam > Settings > In-Game
  • untick Enable the Steam Overlay while in-game

To avoid issues with Steam or the own launchers, the most reliable way to trace is to manually to copy the pertinent lib\wrappers DLL(s) on the same folder as the game main executable:

  • Copy d3d9.dll for D3D9 games
  • Copy dxgitrace.dll, dxgi.dll and d3d11.dll for D3D11 games.

Because most games spawn steam.exe client to verify user has entitlement to run the game, which then spawns back the application main executable. But if the Steam client is already running, it will just use the existing process, and apitrace DLLs will fail to inject. So in order to trace correctly, it is imperative to terminate the Steam client (ie., right-click on the Steam icon on the notification area and chose Exit), immediately before and after tracing, to ensure that apitrace DLLs get injected, and then removed.

You can try trace the executable directly, ie:

apitrace trace -a d3d9 foo.exe

but sometimes this doesn't work because the game will still swpan the steam.exe client. In those cases the only solution is to do

apitrace trace -a d3d9 C:\Program Files (x86)\Steam\Steam.exe" --applaunch APP_ID

where APP_ID is the app id of the game, which can be discovered by right-clicking on the desktop launch icon, and looking at the URL, (e.g., if the URL is steam://rungameid/65900 then the app id is 65900 )

Clone this wiki locally