前言
? 本篇將介紹圖形除錯工具pix,使用該工具可以對圖形管線進行debug,貌似VS不再支持D3D12的圖形除錯,筆者的VS無法捕獲幀
環境搭建
配置用于 CPU 捕獲的 PDB
-
生成完整的 PDB

-
設定符號路徑
srvc:\symcachehttps://msdl.microsoft.com/download/symbols

using pix3.h
pix3.h包含在 WinPixEventRuntime,在這里我們使用VS加載WinPixEventRuntime,步驟如下
-
右擊解決方案,再點擊"Manage NuGet Packages"

-
點擊"Browse",搜索"WinPixEventRuntime",點擊"Install"

-
在build中定義以下前處理器符號之一:
USE_PIX, DBG, _DEBUG, PROFILE, or PROFILE_BUILD -
#inlcude"pix3.h" -
在創建 D3D 設備前,需要將 WinPixGpuCapturer.dll 的副本加載到應用程式的行程中,而"pix3.h"包含一個輔助函式
PIXLoadLatestWinPixGpuCapturerLibrary(),該函式會找到該庫并加載它,使用方式如下://find path to WinPixGpuCapturer.dll from the most-recently installed version of PIX static std::wstring GetLatestWinPixGpuCapturerPath_Cpp17() { LPWSTR programFilesPath = nullptr; SHGetKnownFolderPath(FOLDERID_ProgramFiles, KF_FLAG_DEFAULT, NULL, &programFilesPath); std::filesystem::path pixInstallationPath = programFilesPath; pixInstallationPath /= "Microsoft PIX"; std::wstring newestVersionFound; for (auto const& directory_entry : std::filesystem::directory_iterator(pixInstallationPath)) { if (directory_entry.is_directory()) { if (newestVersionFound.empty() || newestVersionFound < directory_entry.path().filename().c_str()) { newestVersionFound = directory_entry.path().filename().c_str(); } } } if (newestVersionFound.empty()) { // TODO: Error, no PIX installation found } return pixInstallationPath / newestVersionFound / L"WinPixGpuCapturer.dll"; }
GPU capture
更多細節可以參考這篇文章GPU Captures - PIX on Windows (microsoft.com)
運行了.exe檔案后即可系結該運行程式

隨后點擊該相機按鈕會生成一張幀畫面

單擊該結果圖,會跳轉到如下界面,默認情況下該界面只顯示與呈現作業相關的event

點擊左側的"Enable",將顯示GPU占用率

在pipeline中,可以查看哪些資源系結到管道、著色器代碼、輸入、輸出和當前系結的 rendertarget

查看頂點緩沖區中物件當前的值

debug shader.對于PS,點擊上圖中左下角的"RTV 0",再點擊"Debug Pixel";對于VS,需要點擊"VS"中的"Output",再右擊頂點,隨后Debug即可



reference
Download - PIX on Windows (microsoft.com)
Configuring PIX to access PDBs for CPU Captures - PIX on Windows (microsoft.com)
Programmatic Capture - PIX on Windows (microsoft.com)
WinPixEventRuntime - PIX on Windows (microsoft.com)
Taking a Capture - PIX on Windows (microsoft.com)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/549328.html
標籤:其他
上一篇:一、正則化
下一篇:反匯編訓練1
