Performance markers for Microsoft's PIX profiler
Copy zpix
to a subdirectory of your project and add the following to your build.zig.zon
.dependencies:
.zpix = .{ .path = "libs/zpix" },
Then in your build.zig
add:
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{ ... });
const zpix = b.dependency("zpix", .{
.enable = true,
.path = @as([]const u8, ...folder containing WinPixGpuCapturer.dll, typically directory under C:\Program Files\\Microsoft PIX),
});
exe.root_module.addImport("zpix", zpix.module("root"));
}
Load GPU capture library before making any D3D12 calls:
const zpix = @import("zpix");
pub fn main() !void {
const pix_library = try zpix.loadGpuCapturerLibrary();
defer pix_library.deinit();
...
}
Then using the PIX UI:
- Under Select Target Process --> Attach
- Select process
- Select Attach
- Under GPU Capture, click on camera icon
For programmic capture use beginCapture
/endCapture
.
If process has multiple windows, target one for GPU capture using setTargetWindow
.