IDXGIKeyedMutex::ReleaseSync method (dxgi.h)

Using a key, releases exclusive rendering access to a shared resource.

Syntax

HRESULT ReleaseSync(
  UINT64 Key
);

Parameters

Key

Type: UINT64

A value that indicates which device to give access to. This method succeeds when the device that currently owns the surface calls the ReleaseSync method using the same value. This value can be any UINT64 value.

Return value

Type: HRESULT

Returns S_OK if successful.

If the device attempted to release a keyed mutex that is not valid or owned by the device, ReleaseSync returns E_FAIL.

Remarks

The ReleaseSync method releases a lock to a surface that is shared between multiple devices. This method uses a key to determine which device currently has exclusive access to the surface.

When a surface is created using the D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX value of the D3D10_RESOURCE_MISC_FLAG enumeration, you must call the IDXGIKeyedMutex::AcquireSync method before rendering to the surface. You must call the ReleaseSync method when you are done rendering to a surface.

After you call the ReleaseSync method, the shared resource is unset from the rendering pipeline.

To acquire a reference to the keyed mutex object of a shared resource, call the QueryInterface method of the resource and pass in the UUID of the IDXGIKeyedMutex interface. For more information about acquiring this reference, see the following code example.

Examples

Acquiring a Keyed Mutex

The following code example demonstrates how to acquire a lock to a shared resource and how to specify a key upon release.


// pDesc has already been set up with texture description.
pDesc.MiscFlags = D3D10_RESOURCE_MISC_SHARED_KEYEDMUTEX;

// Create a shared texture resource.
pD3D10DeviceD->CreateTexture2D(pDesc, NULL, pD3D10Texture);

// Acquire a reference to the keyed mutex.
pD3D10Texture->QueryInterface(_uuidof(IDXGIKeyedMutex), pDXGIKeyedMutex);

// Acquire a lock to the resource.
pDXGIKeyedMutex->AcquireSync(0, INFINITE);

// Release the lock and specify a key.
pDXGIKeyedMutex->ReleaseSync(1);

Requirements

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

See also

DXGI Interfaces

IDXGIKeyedMutex

IDXGIKeyedMutex::AcquireSync