// d3dkmthk.h
typedef struct _D3DKMT_CREATEALLOCATIONFLAGS {
UINT CreateResource : 1;
UINT CreateShared : 1;
UINT NonSecure : 1;
UINT CreateProtected : 1;
UINT RestrictSharedAccess : 1;
UINT ExistingSysMem : 1;
UINT NtSecuritySharing : 1;
UINT ReadOnly : 1;
UINT CreateWriteCombined : 1;
UINT CreateCached : 1;
UINT SwapChainBackBuffer : 1;
UINT CrossAdapter : 1;
UINT OpenCrossAdapter : 1;
UINT PartialSharedCreation : 1;
UINT Zeroed : 1;
UINT WriteWatch : 1;
UINT StandardAllocation : 1;
UINT ExistingSection : 1;
UINT AllowNotZeroed : 1;
UINT PhysicallyContiguous : 1;
UINT NoKmdAccess : 1;
UINT SharedDisplayable : 1;
UINT NoImplicitSynchronization : 1;
#if ...
UINT Reserved : 9;
#elif
UINT Reserved : 10;
#elif
UINT Reserved : 11;
#elif
UINT Reserved : 13;
#elif
UINT Reserved : 14;
#elif
UINT Reserved : 16;
#elif
UINT Reserved : 21;
#else
UINT Reserved : 26;
#endif
} D3DKMT_CREATEALLOCATIONFLAGS;
View the official Windows Driver Kit DDI referenceNo description available.
D3DKMT_CREATEALLOCATIONFLAGS is a structure of bit fields that specify how to create an allocation in a call to the D3DKMTCreateAllocation function.
CreateResourceSpecifies whether to create a device-specific resource. If you set CreateShared, you must also set CreateResource.
CreateSharedSpecifies whether to create a resource shared across all devices. If you set CreateShared, you must also set CreateResource. For more information on using CreateShared, see the Remarks section.
NonSecureSpecifies whether to create an allocation that can be opened by any process. If NonSecure is set, secure and non-secure processes can open the allocation.
CreateProtectedThis member is reserved and should be set to zero. Supported starting with Windows 7.
RestrictSharedAccessSpecifies whether to create a resource shared across all devices but with some restrictions. Supported starting with Windows 7.
ExistingSysMemThis member is reserved and should be set to zero. Supported starting with Windows 7. ExistingSysMem's limitations follow:
ExistingSystemMem and ExistingSection can't both be set for the same allocation. ExistingSysMem is set, StandardAllocation must also be set.
ExistingSysMem must be correctly aligned. The existing system memory buffer that the D3D runtime gives to the kernel must be page-aligned and a multiple of page size, otherwise the kernel fails the call to D3DKMTCreateAllocation.
When the kernel creates a D3DKMDT_STANDARDALLOCATION_GDISURFACE type of standard allocation:
D3DKMDT_GDISURFACEDATA::Width = Size of ExistingSysMem buffer
D3DKMDT_GDISURFACEDATA::Height = 1
D3DKMDT_GDISURFACEDATA::Format = D3DDDIFMT_UNKNOWN
D3DKMDT_GDISURFACEDATA::Type = D3DKMDT_GDISURFACE_TEXTURE_CROSSADAPTER
Protect against ExistingSysMem pointer pointing to a DXGALLOCATION which is MemRotated
The kernel must protect against the scenario where user mode locks an existing DXGALLOCATION and uses the resulting CPU pointer to create an ExistingSysMem standard allocation. This case is invalid if the DXGALLOCATION VAD is MEM_ROTATE, i.e. if the allocation could be in VRAM. The kernel takes the following steps in the create standard allocation with ExistingSysMem call:
NtSecuritySharingSpecifies whether the allocation is shared with an NT handle, meaning that it doesn't have a global D3DKMT_HANDLE kernel-mode handle to the resource.
If NtSecuritySharing is set to 1 (TRUE):
For more information on using NtSecuritySharing, see the Remarks section. Supported starting with Windows 8.
ReadOnlySpecifies whether the allocation can only be read from. Supported starting with Windows 8.
CreateWriteCombinedThis member is reserved and should be set to zero. Supported starting with Windows 8.
CreateCachedThis member is reserved and should be set to zero. Supported starting with Windows 8.
SwapChainBackBufferThis member is reserved and should be set to zero. Supported starting with Windows 8.
CrossAdapterIf set, indicates that the resource is a shared cross-adapter resource.
OpenCrossAdapterIf set, indicates that the resource is created by opening a cross adapter resource. Can't be used when allocation is created from the user mode. Supported starting with Windows 8.1 (WDDM 1.3).
PartialSharedCreationSpecifies whether the allocation is created as a partial shared allocation. Supported starting with Windows 8.1 (WDDM 1.3).
Zeroed[out] Set when the allocation was fulfilled with zeroed pages. Supported starting with Windows 8 (WDDM 1.3).
WriteWatch[in] Indicates whether to create the allocation with write-watch enabled. Supported starting with Windows 8.1 (WDDM 1.3).
StandardAllocation[in] When set, instructs Dxgkrnl to create a standard allocation using pStandardAllocation instead of pPrivateDriverData. Either ExistingSysMem or ExistingSection (but not both) must also be set if StandardAllocation is set. Additionally, when creating a StandardAllocation, the CreateShared and CrossAdapter flags must also be set. Supported starting with Windows 10 version 1709 (WDDM 2.3).
ExistingSection[in] When set, instructs Dxgkrnl to use the section handle (hSection) instead of the system memory pointer (pSystemMem). ExistingSystemMem and ExistingSection can't both be set for the same allocation. If ExistingSection is set, StandardAllocation must also be set. Supported starting with Windows 10 version 1709 (WDDM 2.3).
AllowNotZeroed[in] Indicates that the allocation can be created without zeroing the pages. Supported starting with Windows 10, version 1903 (WDDM 2.6).
PhysicallyContiguous[in] Indicates that the allocation must be physically contiguous. Supported starting with Windows 10, version 2004 (WDDM 2.7).
NoKmdAccess[in] Indicates that the KMD isn't notified about the allocation. Supported starting with Windows 10, version 2004 (WDDM 2.7).
SharedDisplayableIndicates that the allocation is a shared, displayable resource. Supported starting with Windows 11 (WDDM 3.0).
ReservedSupported starting with Windows 8.
This member is reserved and should be set to zero.
Objects to be shared by using the D3DKMTShareObjects function must first be created with the NtSecuritySharing flag value set. This flag value is available in the D3DKMT_CREATEALLOCATIONFLAGS, D3DKMT_CREATEKEYEDMUTEX2_FLAGS, and D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS structures.
Drivers should follow these guidelines on D3DKMT_CREATEALLOCATIONFLAGS sharing flags: