IDXGIDevice2::OfferResources method (dxgi1_2.h)

Allows the operating system to free the video memory of resources by discarding their content.

Syntax

HRESULT OfferResources(
  [in] UINT                         NumResources,
  [in] IDXGIResource                * const *ppResources,
  [in] DXGI_OFFER_RESOURCE_PRIORITY Priority
);

Parameters

[in] NumResources

The number of resources in the ppResources argument array.

[in] ppResources

An array of pointers to IDXGIResource interfaces for the resources to offer.

[in] Priority

A DXGI_OFFER_RESOURCE_PRIORITY-typed value that indicates how valuable data is.

Return value

OfferResources returns:

  • S_OK if resources were successfully offered
  • E_INVALIDARG if a resource in the array or the priority is invalid

Remarks

The priority value that the Priority parameter specifies describes how valuable the caller considers the content to be. The operating system uses the priority value to discard resources in order of priority. The operating system discards a resource that is offered with low priority before it discards a resource that is offered with a higher priority.

If you call OfferResources to offer a resource while the resource is bound to the pipeline, the resource is unbound. You cannot call OfferResources on a resource that is mapped. After you offer a resource, the resource cannot be mapped or bound to the pipeline until you call the IDXGIDevice2::ReclaimResource method to reclaim the resource. You cannot call OfferResources to offer immutable resources.

To offer shared resources, call OfferResources on only one of the sharing devices. To ensure exclusive access to the resources, you must use an IDXGIKeyedMutex object and then call OfferResources only while you hold the mutex. In fact, you can't offer shared resources unless you use IDXGIKeyedMutex because offering shared resources without using IDXGIKeyedMutex isn't supported.

Note  The user mode display driver might not immediately offer the resources that you specified in a call to OfferResources. The driver can postpone offering them until the next call to IDXGISwapChain::Present, IDXGISwapChain1::Present1, or ID3D11DeviceContext::Flush.
 
Platform Update for Windows 7:  The runtime validates that OfferResources is used correctly on non-shared resources but doesn't perform the intended functionality. For more info about the Platform Update for Windows 7, see Platform Update for Windows 7.

Requirements

Requirement Value
Minimum supported client Windows 8 and Platform Update for Windows 7 [desktop apps | UWP apps]
Minimum supported server Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | UWP apps]
Target Platform Windows
Header dxgi1_2.h
Library Dxgi.lib

See also

IDXGIDevice2

IDXGIDevice2::ReclaimResource