Direct3D 11 API Documentation

D3D11_RESOURCE_MISC_FLAG Enumeration

The D3D11_RESOURCE_MISC_FLAG enumeration defines miscellaneous flags for resource creation.

Syntax

typedef enum D3D11_RESOURCE_MISC_FLAG {
  D3D11_RESOURCE_MISC_NONE            = 0,
  D3D11_RESOURCE_MISC_TEXTURECUBE     = 0x00000001,
  D3D11_RESOURCE_MISC_SHARED          = 0x00000002,
  D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX = 0x00000004,
  D3D11_RESOURCE_MISC_GDI_COMPATIBLE  = 0x00000008,
  D3D11_RESOURCE_MISC_RESTRICTED_CONTENT = 0x00000010,
  D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE = 0x00000020,
  D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_MAKE_NO_VBV_COLOR_TIMING = 0x00000040,
  D3D11_RESOURCE_MISC_SHARED_READ_ONLY_OPTIONAL = 0x00000080
} D3D11_RESOURCE_MISC_FLAG;

Members

Remarks

These flags are used in the MiscFlags member of the D3D11_TEXTURE1D_DESC, D3D11_TEXTURE2D_DESC, and D3D11_TEXTURE3D_DESC structures to specify additional properties of a texture resource during its creation.

Example Usage

Creating a texture cube:

D3D11_TEXTURE2D_DESC desc;
// ... fill other members of desc ...
desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;

ID3D11Texture2D* pTextureCube;
HRESULT hr = pDevice->CreateTexture2D(&desc, nullptr, &pTextureCube);
if (SUCCEEDED(hr)) {
    // Texture cube created successfully
}

Sharing a resource with a keyed mutex:

D3D11_TEXTURE2D_DESC desc;
// ... fill other members of desc ...
desc.MiscFlags = D3D11_RESOURCE_MISC_SHARED | D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX;

ID3D11Texture2D* pSharedTexture;
HANDLE sharedHandle; // Receive the shared handle
IDXGIResource* pDxgiResource;
HRESULT hr = pDevice->CreateTexture2D(&desc, nullptr, &pSharedTexture);
if (SUCCEEDED(hr)) {
    hr = pSharedTexture->QueryInterface(__uuidof(IDXGIResource), (void**)&pDxgiResource);
    if (SUCCEEDED(hr)) {
        hr = pDxgiResource->GetSharedHandle(&sharedHandle);
        // Now use sharedHandle to open the resource on another device
    }
}