IDXGISurface::Map method (dxgi.h)

Get a pointer to the data contained in the surface, and deny GPU access to the surface.

Syntax

HRESULT Map(
  [out] DXGI_MAPPED_RECT *pLockedRect,
        UINT             MapFlags
);

Parameters

[out] pLockedRect

Type: DXGI_MAPPED_RECT*

A pointer to the surface data (see DXGI_MAPPED_RECT).

MapFlags

Type: UINT

CPU read-write flags. These flags can be combined with a logical OR.

  • DXGI_MAP_READ - Allow CPU read access.
  • DXGI_MAP_WRITE - Allow CPU write access.
  • DXGI_MAP_DISCARD - Discard the previous contents of a resource when it is mapped.

Return value

Type: HRESULT

Returns S_OK if successful; otherwise, returns one of the error codes that are described in the DXGI_ERROR topic.

Remarks

Use IDXGISurface::Map to access a surface from the CPU. To release a mapped surface (and allow GPU access) call IDXGISurface::Unmap.

Requirements

Requirement Value
Target Platform Windows
Header dxgi.h
Library DXGI.lib

See also

IDXGISurface