This project has moved and is read-only. For the latest updates, please go here.
Captures a Direct3D 11 render target and returns an image.

This function is intended for use with tools or editor programs. For runtime/engine use, we strongly recommend using ScreenGrab instead of DirectXTex.

HRESULT CaptureTexture( _In_ ID3D11Device* pDevice,
    _In_ ID3D11DeviceContext* pContext,
    _In_ ID3D11Resource* pSource,
    _Out_ ScratchImage& result );


ScratchImage image;
HRESULT hr = CaptureTexture( device, context, pResource, image );
if ( SUCCEEDED(hr) )
    hr = SaveToDDSFile( image.GetImages(), image.GetImageCount(), image.GetMetadata(), 
        DDS_FLAGS_NONE, filename );
    if ( FAILED(hr) )


This function can support capturing 1D, 1D array, 2D, 2D array, cubemap, cubemap array, and 3D textures in the full range of DXGI formats.

MSAA textures are resolved before being captured.

Last edited Jun 22, 2015 at 6:43 AM by walbourn, version 7