Exporter (0) Imprimer
Développer tout
EN
Ce contenu n’est pas disponible dans votre langue. Voici la version anglaise.
Ce sujet n'a pas encore été évalué - Évaluez ce sujet

ID3D11Device1::OpenSharedResource1 method

Gives a device access to a shared resource that is referenced by a handle and that was created on a different device. You must have previously created the resource as shared and specified that it uses NT handles (that is, you set the D3D11_RESOURCE_MISC_SHARED_NTHANDLE flag).

Syntax


HRESULT OpenSharedResource1(
  [in]   HANDLE hResource,
  [in]   REFIID returnedInterface,
  [out]  void **ppResource
);

Parameters

hResource [in]

A handle to the resource to open. For more info about this parameter, see Remarks.

returnedInterface [in]

The globally unique identifier (GUID) for the resource interface. For more info about this parameter, see Remarks.

ppResource [out]

A pointer to a variable that receives a pointer to the interface for the shared resource object to access.

Return value

This method returns one of the Direct3D 11 return codes. This method also returns E_ACCESSDENIED if the permissions to access the resource aren't valid.

Platform Update for Windows 7:  On Windows 7 or Windows Server 2008 R2 with the Platform Update for Windows 7 installed, OpenSharedResource1 fails with E_NOTIMPL because NTHANDLES are used. For more info about the Platform Update for Windows 7, see Platform Update for Windows 7.

Remarks

The behavior of OpenSharedResource1 is similar to the behavior of the ID3D11Device::OpenSharedResource method; each call to OpenSharedResource1 to access a resource creates a new resource object. In other words, if you call OpenSharedResource1 twice and pass the same resource handle to hResource, you receive two resource objects with different IUnknown pointers.

Hh404592.wedge(en-us,VS.85).gifTo share a resource between two devices

  1. Create the resource as shared and specify that it uses NT handles, by setting the D3D11_RESOURCE_MISC_SHARED_NTHANDLE flag.
  2. Obtain the REFIID, or GUID, of the interface to the resource by using the __uuidof() macro. For example, __uuidof(ID3D11Texture2D) retrieves the GUID of the interface to a 2D texture.
  3. Query the resource for the IDXGIResource1 interface.
  4. Call the IDXGIResource1::CreateSharedHandle method to obtain the unique handle to the resource.

Windows Phone 8: This API is supported.

Examples

HANDLE handle = GetSharedHandleFromOtherProcess();
ID3D11Device1* pDevice;
ID3D11Texture2D* pTexture2D;

pDevice->OpenSharedResource1(
          handle, 
          __uuidof(ID3D11Texture2D), 
         (void**)&pTexture2D);

Requirements

Minimum supported client

Windows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2012 and Platform Update for Windows Server 2008 R2 [desktop apps | Windows Store apps]

Header

D3D11_1.h

Library

D3D11.lib

See also

ID3D11Device1

 

 

Cela vous a-t-il été utile ?
(1500 caractères restants)
Merci pour vos suggestions.

Ajouts de la communauté

AJOUTER
Microsoft réalise une enquête en ligne pour recueillir votre opinion sur le site Web de MSDN. Si vous choisissez d’y participer, cette enquête en ligne vous sera présentée lorsque vous quitterez le site Web de MSDN.

Si vous souhaitez y participer,
Afficher:
© 2014 Microsoft. Tous droits réservés.