Development:gfxreconstruct

From FEX-Emu Wiki
Revision as of 01:14, 17 July 2022 by Sonicadvance1 (talk | contribs)
Jump to navigation Jump to search

gfxreconstruct

gfxreconstruct is a Vulkan layer that is useful for capturing a frame in a robust way.

This is usually useful for capturing frames that is more portable than renderdoc.

https://github.com/LunarG/gfxreconstruct

Setting up gfxreconstruct

First thing you must do is build gfxreconstruct from source. Either for your host or guest rootfs, depending on if you're using thunks or not.

If building for the x86 rootfs then make sure to install it in to the rootfs after building. This can be done by just copying the install files over afterwards.

Set up environment variables

  • VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_gfxreconstruct
  • GFXRECON_CAPTURE_TRIGGER=F12
  • GFXRECON_CAPTURE_FILE=/tmp/gfxrecon_capture.gfxr
  • GFXRECON_CAPTURE_TRIGGER_FRAMES=1
  • GFXRECON_MEMORY_TRACKING_MODE=unassisted
    • Only necessary if the game crashes otherwise. Proton games are quite crash happy without this.
    • Causes capture to be /very/ slow.

Once you have the environment variables set up you can then launch a vulkan game. There will be some additional output in the terminal to know when the layer is capturing. You can then press F12 in the application and you'll get a capture in tmp after a few seconds. Be careful as gfxreconstruct will overwrite the capture on each press, so you will want to move each capture file.

Capturing Thunks + Pressure-Vessel/Proton

Not yet supported

Replay

gfxrecon-replay can be used to replay the capture which is quite useful.

Capturing Proton games

  • pressure-vessel automatically pulls in vulkan layers from the rootfs
  • If you have a new enough rootfs then both a 32-bit and 64-bit gfxreconstruct library is installed for capturing both bitness
    • As of 2022-07-15, RootFS isn't pushed. Waiting on new Mesa release.

Steam launch arguments as follows will enable gfxreconstruct for Vulkan/DXVK/VKD3D games

 VK_INSTANCE_LAYERS=VK_LAYER_LUNARG_gfxreconstruct GFXRECON_CAPTURE_TRIGGER=F12 GFXRECON_CAPTURE_FILE=/tmp/gfxrecon_capture.gfxr GFXRECON_CAPTURE_TRIGGER_FRAMES=1 GFXRECON_MEMORY_TRACKING_MODE=unassisted %command%