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
-
D3D11_RESOURCE_MISC_NONE
No miscellaneous flags are set.
-
D3D11_RESOURCE_MISC_TEXTURECUBE
The resource is a 6-sided texture (a texture cube).
-
D3D11_RESOURCE_MISC_SHARED
The resource is shared across multiple devices.
-
D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX
The resource is shared and uses a keyed mutex for synchronization.
-
D3D11_RESOURCE_MISC_GDI_COMPATIBLE
The resource is compatible with GDI.
-
D3D11_RESOURCE_MISC_RESTRICTED_CONTENT
The resource content is restricted. This flag is used for protected content.
-
D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE
The resource is a shared resource and its access is restricted.
-
D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE_MAKE_NO_VBV_COLOR_TIMING
This flag is used in conjunction with
D3D11_RESOURCE_MISC_RESTRICT_SHARED_RESOURCE
to prevent the Video Playback Buffer (VPB) from using color timing information, which can affect performance or compatibility in certain scenarios. -
D3D11_RESOURCE_MISC_SHARED_READ_ONLY_OPTIONAL
The resource is shared and can be read-only. The "optional" indicates that the read-only nature is not strictly enforced by the driver if not explicitly required by the application.
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
}
}