Skip to main content
Microsoft
PIX
PIX
  • Home
  • DevBlogs
    • App Center
    • Azure DevOps
    • Notification Hubs
    • Visual Studio
    • Visual Studio Code
    • Visual Studio for Mac
    • Azure Artifacts
    • Azure Boards
    • Azure Pipelines
    • Azure Repos
    • Azure Test Plans
    • DevOps
    • C++
    • Java
    • Java Blog in Chinese
    • JavaScript
    • PowerShell
    • Python
    • Q#
    • Scripting
    • TypeScript
    • Visual Basic
    • Visual C#
    • Visual F#
    • .NET
    • ASP.NET
    • NuGet
    • Xamarin
    • Apps for Windows
    • Azure Government
    • Azure SDKs
    • Bing Dev Center
    • Command Line
    • Developer Support
    • DirectX Developer Blog
    • IoT Developer
    • Math In Office
    • Microsoft Edge Dev
    • Microsoft Azure
    • Office 365 Development
    • Old New Thing
    • PAX Graph
    • PAX Media
    • PAX Windows
    • Perf and Diagnostics
    • PIX on Windows
    • Startup Developers
    • Surface Duo
    • Sustainable Software
    • Windows Search Platform
    • Azure Cosmos DB
    • Azure Data Studio
    • Azure SQL
    • Azure Synapse Analytics
    • OData
    • Revolutions R
    • SQL Server Data Tools

    Programmatic Capture

    PIX allows an application to initiate GPU captures programmatically using the IDXGraphicsAnalysis interface.

    Note that programmatic timing captures and the PIXBeginCapture/PIXEndCapture APIs, are not currently supported.

     

    Preparing Your App to Use Programmatic Capture

    Programmatic capture is controlled through the IDXGraphicsAnalysis interface. This interface can be found in the DXProgrammableCapture.h header, included with the Windows 10 SDK.

        #include <DXProgrammableCapture.h>

    or:

        interface DECLSPEC_UUID("9f251514-9d4d-4902-9d60-18988ab7d4b5") DECLSPEC_NOVTABLE 
        IDXGraphicsAnalysis : public IUnknown 
        { 
            STDMETHOD_(void, BeginCapture)() PURE; 
            STDMETHOD_(void, EndCapture)() PURE; 
        };

    IDXGraphicsAnalysis can be retrieved using DXGIGetDebugInterface1. Retrieval of IDXGraphicsAnalysis will only succeed if PIX is attached to the application for GPU capture, otherwise DXGIGetDebugInterface1 will return E_NOINTERFACE.

        ComPtr<IDXGraphicsAnalysis> ga;
        HRESULT hr = DXGIGetDebugInterface1(0, IID_PPV_ARGS(&ga));
    
        // hr will be E_NOINTERFACE if not attached for GPU capture
    
    

     

    Using Programmatic Capture

    Once an application is setup to use programmatic capture, launch the application for GPU capture from PIX. The application can then call BeginCapture and EndCapture on IDXGraphicsAnalysis to control when a GPU capture is taken.

        ga->BeginCapture();
    
        // Perform rendering work
        // ...
    
        ga->EndCapture();
    Relevant Links
    • Download
    • Documentation
    • Known Issues
    • Videos
    • Support
    • WinPixEventRuntime
    • Roadmap
    Top Bloggers
    Steven Pratschner

    Steven Pratschner
    Program Manager

    Avatar

    Morgan Grobin
    Program Manager

    Austin Kinross

    Austin Kinross
    Developer

    Damyan Pepper

    Damyan Pepper
    Dev Lead

    Jeff Noyle

    Jeff Noyle
    Developer

    Archive
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • May 2020
  • March 2020
  • January 2020
  • December 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • December 2018
  • October 2018
  • July 2018
  • June 2018
  • March 2018
  • November 2017
  • October 2017
  • September 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • Stay informed

    Login
    Code Block
    What's new
    • Surface Duo
    • Surface Laptop Go
    • Surface Pro X
    • Surface Go 2
    • Surface Book 3
    • Microsoft 365
    • Windows 10 apps
    • HoloLens 2
    Microsoft Store
    • Account profile
    • Download Center
    • Microsoft Store support
    • Returns
    • Order tracking
    • Virtual workshops and training
    • Microsoft Store Promise
    • Financing
    Education
    • Microsoft in education
    • Office for students
    • Office 365 for schools
    • Deals for students & parents
    • Microsoft Azure in education
    Enterprise
    • Azure
    • AppSource
    • Automotive
    • Government
    • Healthcare
    • Manufacturing
    • Financial services
    • Retail
    Developer
    • Microsoft Visual Studio
    • Windows Dev Center
    • Developer Center
    • Microsoft developer program
    • Channel 9
    • Microsoft 365 Dev Center
    • Microsoft 365 Developer Program
    • Microsoft Garage
    Company
    • Careers
    • About Microsoft
    • Company news
    • Privacy at Microsoft
    • Investors
    • Diversity and inclusion
    • Accessibility
    • Security
    English (United States)
    • Sitemap
    • Contact Microsoft
    • Privacy
    • Manage cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2021