IDXGISwapChain::GetBuffer method

Accesses one of the swap-chain's back buffers.

Syntax


HRESULT GetBuffer(
  [in]       UINT Buffer,
  [in]       REFIID riid,
  [in, out]  void **ppSurface
);

Parameters

Buffer [in]

Type: UINT

A zero-based buffer index.

If the swap chain's swap effect is DXGI_SWAP_EFFECT_DISCARD, this method can only access the first buffer; for this situation, set the index to zero.

If the swap chain's swap effect is either DXGI_SWAP_EFFECT_SEQUENTIAL or DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, only the swap chain's zero-index buffer can be read from and written to. The swap chain's buffers with indexes greater than zero can only be read from; so if you call the IDXGIResource::GetUsage method for such buffers, they have the DXGI_USAGE_READ_ONLY flag set.

riid [in]

Type: REFIID

The type of interface used to manipulate the buffer.

ppSurface [in, out]

Type: void**

A pointer to a back-buffer interface.

Return value

Type: HRESULT

Returns one of the following DXGI_ERROR.

Remarks

Windows Phone 8: This API is supported.

Examples



ID3D10Texture2D * p_RT;

... // Get the surface from the swap chain

pSwapChain->GetBuffer(0, __uuidof(p_RT), reinterpret_cast<void**>(&p_RT));


Requirements

Header

DXGI.h

Library

DXGI.lib

See also

IDXGISwapChain

 

 

Community Additions

ADD
Show:
© 2014 Microsoft