Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Accesses one of the swap-chain's back buffers.
Syntax
HRESULT GetBuffer(
UINT Buffer,
[in] REFIID riid,
[out] void **ppSurface
);
Parameters
Buffer
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, 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.
If the swap chain's swap effect is DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL, the relationship between indices and buffers is consistent. The result is identical if you get the swap chain's zero-index buffer after each time IDXGISwapChain::Present is called. A correct frame index should be used to retrieve the current backbuffer.
[in] riid
Type: REFIID
The type of interface used to manipulate the buffer.
[out] ppSurface
Type: void**
A pointer to a back-buffer interface.
Return value
Type: HRESULT
Returns one of the following DXGI_ERROR.
Requirements
Requirement | Value |
---|---|
Target Platform | Windows |
Header | dxgi.h |
Library | DXGI.lib |