// d3dkmthk.h
NTSTATUS D3DKMTCreateNativeFence(
D3DKMT_CREATENATIVEFENCE *unnamedParam1
);
View the official Windows Driver Kit DDI referenceNo description available.
The D3D runtime calls D3DKMTCreateNativeFence to create a native GPU fence object on a particular device.
unnamedParam1[in/out] Pointer to a D3DKMT_CREATENATIVEFENCE structure that describes the fence object to create.
D3DKMTCreateNativeFence returns STATUS_SUCCESS on successful creation. Otherwise it returns an NTSTATUS error code such as STATUS_INVALID_PARAMETER.
The specified D3DDDI_NATIVEFENCE_TYPE dictates the type of native fence that the OS creates. These fences differ in functionality, performance characteristics, and storage requirements for CurrentValue and MonitoredValue. The following table shows these differences, where CVal stands for CurrentValue and MVal stands for MonitoredValue.
| Type | CurrentValue | MonitoredValue | Supports Cross-process Sharing on CPU | Supports Cross-Adapter Sharing | UM CPUVA CVal | KM CPUVA CVal | GPU VA CVal | CMPVA CVal | UM MVal | KM MVal | GPU VA MVal | CMPVA MVal | Use Case |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| D3DDDI_NATIVEFENCE_TYPE_DEFAULT | Sysmem | Sysmem | Yes | Yes | ReadOnly | Read/Write | Read/Write | Read/Write | N/A | Write | ReadOnly (or Read/Write) | Read/Write | Application fences with reduced CPU interrupts. GPU waiter is unblocked without waking up CPU |
| D3DDDI_NATIVEFENCE_TYPE_DEFAULT (OPTIMIZED) | Sysmem | VRAM | Yes | Yes | ReadOnly | Read/Write | Read/Write | Read/Write | N/A | Write | ReadOnly (or Read/Write) | Read/Write | Same as Type 0 but with reduced PCI bus traffic as MVal reads are local to the GPU. The GPU signal command completes faster because of this reduced latency (throughput++). |
| D3DDDI_NATIVEFENCE_TYPE_INTRA_GPU | VRAM | VRAM | Yes | No | N/A | N/A | Read/Write | Read/Write | N/A | N/A | ReadOnly (or Read/Write) | Read/Write | Command buffer level (not application visible) synchronization within the same GPU. Read/Write to fence value (CVal) is local, so signal/unblock operations are fast. |
D3DDDI_NATIVEFENCE_TYPE_DEFAULT
D3DDDI_NATIVEFENCE_TYPE_DEFAULT (Optimized)
D3DDDI_NATIVEFENCE_TYPE_INTRA_GPU
For more information about native GPU fences, see Native GPU fence objects.
D3DKMTOpenNativeFenceFromNTHandle
D3DKMTDestroySynchronizationObject