安装适用于 HoloLens 2 的 PIX

PIX 是 Windows 上用于 DirectX 12 应用程序的性能优化和调试工具,但也可通过 Direct3D 11 on 12 用于 DirectX 11。

先决条件

  1. 在电脑上安装的最新版本的 PIX
  2. 用于 IPoverUSB 的最新 Windows SDK,能够通过 USB 将 HoloLens 2 连接到电脑。
  3. 应用程序的 ARM64 版本。 PIX 仅支持 ARM64。
  4. HoloLens2 需要通过 USB 电缆连接到电脑。

注意

某些配置(例如使用 Windows 预览体验成员版本)可能会导致 HoloLens 2 上的 PIX 中断。 如果发生这种情况,请刷新设备来擦除所有数据,并按照下面的说明重新操作。

安装

  1. 启用开发人员模式和设备门户
  • 从“混合现实主页”打开“设置”

Screenshot of the HoloLens menu with settings button highlighted

  • 选择“更新和安全”:

Screenshot of settings window open on HoloLens with update and security button highlighted

  • 选择“面向开发人员”

Screenshot of security and updates window open with for developers button highlighted

  • 启用“使用开发人员功能”和“启用设备门户”

Screenshot of for developers window open in settings with enable device portal button highlighted

Screenshot of for developers window open in settings with use develop features toggle highlighted

  • 在设备仍处于连接状态、唤醒状态且用户处于登录状态时,启动 Visual Studio。

重要

请确保设备不处于待机模式或睡眠状态。 如果执行此步骤时遇到问题,请参阅 Windows 设备门户说明

准备部署

  1. 在 Visual Studio 中,将平台设置为“ARM64”,“设备”设置为“设备”

Screenshot of visual studios solution with platform and device settings highlighted

  1. 当 Visual Studio 提示输入设备的 PIN 时

Screenshot of visual studio pop-up asking for PIN

  • 从 Shell 选择“设置”
  • 选择“更新和安全”
  • 选择“面向开发人员”,并在“设备发现”下按“配对”

Screenshot of for developers window open in settings with device discovery highlighted

Screenshot of paid device pop-up with registration code highlighted

  • 在 Visual Studio 中输入生成的 PIN 号
  1. Visual Studio 会将应用部署到连接的 HoloLens 2,这可能需要几分钟的时间,具体取决于应用。

启动 PIX

首先,使用设备门户验证应用未在 HoloLens 2 上运行。 然后,启动 PIX,连接到你的设备,然后选择“主页”

Screenshot of PIX application home screen

  • 从左侧菜单中选择“连接”

Screenshot of PIX application left-side menu with connect button highlighted

  1. 从“计算机”选项卡中,选择“添加”,然后输入以下凭据

    • 别名:由用户自主确定
    • 主机名或 IP 地址:127.0.0.1
  2. 选择“计算机”选项卡右下方的“连接”

Screenshot of PIX application connect window with alias, host name, IP address, and add button highlighted

注意

第一次连接总是会比较慢,因为要复制二进制文件。

  1. 当 PIX 连接到 HoloLens 2 时,请在“启动 UWP”选项卡的“选择目标进程”部分找到你的应用,然后确保“启用 GPU 捕获”已激活。

  2. 如果应用程序在 DX11 上运行,请确保已选择“强制执行 D3D11On12”。

  3. 单击“启动”:

Screenshot of PIX application with the select target process window and launch button highlighted

捕获的 GPU

  1. 在“GPU 捕获”部分单击“照片”,启动 GPU 捕获

Screenshot of the PIX application with the PC connection panel open with GPU capture highlighted

  1. 单击“GPU 捕获”面板中生成的屏幕快照,打开捕获以进行分析:

Screenshot of the PIX application with the GPU capture section open with GPU capture panel highlighted

  1. 按“开始”以开始分析

Screenshot of the PIX application the start button highlighted

重要

如果在执行 GPU 捕获后收集计时数据,需要重新启动头戴显示设备。 这是设备的一次性重启,是收集计时数据时必须执行的操作。

PIX 现在可以使用了! 有关如何使用 PIX 的说明,请参阅 PIX GPU 捕获

另请参阅