module external.directx.d3dukmdt;
/*-------------------------------------------------------------------------------------
 *
 * Copyright (c) Microsoft Corporation
 *
 *-------------------------------------------------------------------------------------*/
// Longhorn Display Driver Model (LDDM) user/kernel mode shared data type definitions Header translation from d3dukmdt.h
// Latest update: Windows 10, version 1809
import std.bitmanip : bitfields;
import external.directx.win32;

enum DXGKDDI_INTERFACE_VERSION_VISTA = 0x1052;
enum DXGKDDI_INTERFACE_VERSION_VISTA_SP1 = 0x1053;
enum DXGKDDI_INTERFACE_VERSION_WIN7 = 0x2005;
enum DXGKDDI_INTERFACE_VERSION_WIN8 = 0x300E;
enum DXGKDDI_INTERFACE_VERSION_WDDM1_3 = 0x4002;
enum DXGKDDI_INTERFACE_VERSION_WDDM1_3_PATH_INDEPENDENT_ROTATION = 0x4003;
enum DXGKDDI_INTERFACE_VERSION_WDDM2_0 = 0x5023;
enum DXGKDDI_INTERFACE_VERSION_WDDM2_1 = 0x6003;
enum DXGKDDI_INTERFACE_VERSION_WDDM2_1_5 = 0x6010;
enum DXGKDDI_INTERFACE_VERSION_WDDM2_2 = 0x700A;
enum DXGKDDI_INTERFACE_VERSION_WDDM2_3 = 0x8001;
enum DXGKDDI_INTERFACE_VERSION_WDDM2_4 = 0x9006;
enum DXGKDDI_INTERFACE_VERSION_WDDM2_5 = 0xA00B;

bool IS_OFFICIAL_DDI_INTERFACE_VERSION(uint ver)
{
    return ((ver == DXGKDDI_INTERFACE_VERSION_VISTA) || (ver == DXGKDDI_INTERFACE_VERSION_VISTA_SP1) || (ver == DXGKDDI_INTERFACE_VERSION_WIN7) || (ver == DXGKDDI_INTERFACE_VERSION_WIN8) || (ver == DXGKDDI_INTERFACE_VERSION_WDDM1_3) || (ver == DXGKDDI_INTERFACE_VERSION_WDDM1_3_PATH_INDEPENDENT_ROTATION) || (ver == DXGKDDI_INTERFACE_VERSION_WDDM2_0) || (ver == DXGKDDI_INTERFACE_VERSION_WDDM2_1)
            || (ver == DXGKDDI_INTERFACE_VERSION_WDDM2_1_5) || (ver == DXGKDDI_INTERFACE_VERSION_WDDM2_2) || (ver == DXGKDDI_INTERFACE_VERSION_WDDM2_3) || (ver == DXGKDDI_INTERFACE_VERSION_WDDM2_4) || (ver == DXGKDDI_INTERFACE_VERSION_WDDM2_5));
}

alias DXGKDDI_INTERFACE_VERSION = DXGKDDI_INTERFACE_VERSION_WDDM2_5;
enum D3D_UMD_INTERFACE_VERSION_VISTA = 0x000C;
enum D3D_UMD_INTERFACE_VERSION_WIN7 = 0x2003;
enum D3D_UMD_INTERFACE_VERSION_WIN8_M3 = 0x3001;
enum D3D_UMD_INTERFACE_VERSION_WIN8_CP = 0x3002;
enum D3D_UMD_INTERFACE_VERSION_WIN8_RC = 0x3003;
enum D3D_UMD_INTERFACE_VERSION_WIN8 = 0x3004;
enum D3D_UMD_INTERFACE_VERSION_WDDM1_3 = 0x4002;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_0_M1 = 0x5000;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_0_M1_3 = 0x5001;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_0_M2_2 = 0x5002;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_0 = 0x5002;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_1_1 = 0x6000;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_1_2 = 0x6001;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_1_3 = 0x6002;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_1_4 = 0x6003;
alias D3D_UMD_INTERFACE_VERSION_WDDM2_1 = D3D_UMD_INTERFACE_VERSION_WDDM2_1_4;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_2_1 = 0x7000;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_2_2 = 0x7001;
alias D3D_UMD_INTERFACE_VERSION_WDDM2_2 = D3D_UMD_INTERFACE_VERSION_WDDM2_2_2;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_3_1 = 0x8000;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_3_2 = 0x8001;
alias D3D_UMD_INTERFACE_VERSION_WDDM2_3 = D3D_UMD_INTERFACE_VERSION_WDDM2_3_2;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_4_1 = 0x9000;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_4_2 = 0x9001;
alias D3D_UMD_INTERFACE_VERSION_WDDM2_4 = D3D_UMD_INTERFACE_VERSION_WDDM2_4_2;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_5_1 = 0xA000;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_5_2 = 0xA001;
enum D3D_UMD_INTERFACE_VERSION_WDDM2_5_3 = 0xA002;

alias D3D_UMD_INTERFACE_VERSION_WDDM2_5 = D3D_UMD_INTERFACE_VERSION_WDDM2_5_3;
alias D3D_UMD_INTERFACE_VERSION = D3D_UMD_INTERFACE_VERSION_WDDM2_5;
alias D3DGPU_VIRTUAL_ADDRESS = ulong;
alias D3DGPU_SIZE_T = ulong;

enum D3DGPU_UNIQUE_DRIVER_PROTECTION = 0x8000000000000000UL;
enum DXGK_MAX_PAGE_TABLE_LEVEL_COUNT = 6;
enum DXGK_MIN_PAGE_TABLE_LEVEL_COUNT = 2;
enum FILE_DEVICE_UNKNOWN = 0x00000022;
enum METHOD_BUFFERED = 0;
enum IOCTL_GPUP_DRIVER_ESCAPE = CTL_CODE(FILE_DEVICE_UNKNOWN, (8 + 0x910), METHOD_BUFFERED, FILE_READ_DATA);

struct GPUP_DRIVER_ESCAPE_INPUT
{
    LUID vfLUID;
}

alias DXGKVGPU_ESCAPE_TYPE = uint;
enum : DXGKVGPU_ESCAPE_TYPE
{
    DXGKVGPU_ESCAPE_TYPE_READ_PCI_CONFIG = 0,
    DXGKVGPU_ESCAPE_TYPE_WRITE_PCI_CONFIG = 1,
    DXGKVGPU_ESCAPE_TYPE_INITIALIZE = 2,
    DXGKVGPU_ESCAPE_TYPE_RELEASE = 3,
    DXGKVGPU_ESCAPE_TYPE_GET_VGPU_TYPE = 4,
    DXGKVGPU_ESCAPE_TYPE_POWERTRANSITIONCOMPLETE = 5,
}
struct DXGKVGPU_ESCAPE_HEAD
{
    GPUP_DRIVER_ESCAPE_INPUT Luid;
    DXGKVGPU_ESCAPE_TYPE Type;
}

struct DXGKVGPU_ESCAPE_READ_PCI_CONFIG
{
    DXGKVGPU_ESCAPE_HEAD Header;
    uint Offset;
    uint Size;
}

struct DXGKVGPU_ESCAPE_WRITE_PCI_CONFIG
{
    DXGKVGPU_ESCAPE_HEAD Header;
    uint Offset;
    uint Size;
}

struct DXGKVGPU_ESCAPE_READ_VGPU_TYPE
{
    DXGKVGPU_ESCAPE_HEAD Header;
}

struct DXGKVGPU_ESCAPE_POWERTRANSITIONCOMPLETE
{
    DXGKVGPU_ESCAPE_HEAD Header;
    uint PowerState;
}

struct DXGKVGPU_ESCAPE_INITIALIZE
{
    DXGKVGPU_ESCAPE_HEAD Header;
    GUID VmGuid;
}

struct DXGKVGPU_ESCAPE_RELEASE
{
    DXGKVGPU_ESCAPE_HEAD Header;
}

alias DXGK_PTE_PAGE_SIZE = uint;
enum : DXGK_PTE_PAGE_SIZE
{
    DXGK_PTE_PAGE_TABLE_PAGE_4KB = 0,
    DXGK_PTE_PAGE_TABLE_PAGE_64KB = 1,
}

struct DXGK_PTE
{
    union
    {
        struct
        {
            mixin(bitfields!(ulong, "Valid", 1, 
                             ulong, "Zero", 1, 
                             ulong, "CacheCoherent", 1, 
                             ulong, "ReadOnly", 1, 
                             ulong, "NoExecute", 1, 
                             ulong, "Segment", 5, 
                             ulong, "LargePage", 1, 
                             ulong, "PhysicalAdapterIndex", 6, 
                             ulong, "PageTablePageSize", 2, 
                             ulong, "SystemReserved0", 1, 
                             ulong, "Reserved", 44));
        }

        ulong Flags;
    }

    union
    {
        ulong PageAddress;
        ulong PageTableAddress;
    }
}

enum D3DGPU_NULL = 0;
enum D3DDDI_MAX_WRITTEN_PRIMARIES = 16;
enum D3DDDI_MAX_MPO_PRESENT_DIRTY_RECTS = 0xFFF;
struct D3DGPU_PHYSICAL_ADDRESS
{
    uint SegmentId;
    ulong SegmentOffset;
}

alias D3DDDI_VIDEO_PRESENT_SOURCE_ID = uint;
alias D3DDDI_VIDEO_PRESENT_TARGET_ID = uint;
alias D3DKMT_HANDLE = uint;
struct D3DDDI_RATIONAL
{
    uint Numerator;
    uint Denominator;
}

struct D3DDDI_ALLOCATIONINFO
{
    D3DKMT_HANDLE hAllocation;
    const VOID* pSystemMem;
    VOID* pPrivateDriverData;
    uint PrivateDriverDataSize;
    D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
    union Flags
    {
        struct
        {
            mixin(bitfields!(uint, "Primary", 1, uint, "Stereo", 1, uint, "Reserved", 30));
        }

        uint Value;
    }
}

struct D3DDDI_ALLOCATIONINFO2
{
    D3DKMT_HANDLE hAllocation;
    union
    {
        HANDLE hSection;
        const VOID* pSystemMem;
    }

    VOID* pPrivateDriverData;
    uint PrivateDriverDataSize;
    D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
    union Flags
    {
        struct
        {
            mixin(bitfields!(uint, "Primary", 1, uint, "Stereo", 1, uint, "OverridePriority", 1, uint, "Reserved", 29));
        }

        uint Value;
    }

    D3DGPU_VIRTUAL_ADDRESS GpuVirtualAddress;
    union
    {
        uint Priority;
        ULONG_PTR Unused;
    }

    ULONG_PTR[5] Reserved;
}

struct D3DDDI_OPENALLOCATIONINFO
{
    D3DKMT_HANDLE hAllocation;
    const VOID* pPrivateDriverData;
    uint PrivateDriverDataSize;
}

struct D3DDDI_OPENALLOCATIONINFO2
{
    D3DKMT_HANDLE hAllocation;
    const VOID* pPrivateDriverData;
    uint PrivateDriverDataSize;
    D3DGPU_VIRTUAL_ADDRESS GpuVirtualAddress;
    ULONG_PTR[6] Reserved;
}

alias D3DDDI_OFFER_PRIORITY = uint;
enum : D3DDDI_OFFER_PRIORITY
{
    D3DDDI_OFFER_PRIORITY_NONE = 0,
    D3DDDI_OFFER_PRIORITY_LOW = 1,
    D3DDDI_OFFER_PRIORITY_NORMAL,
    D3DDDI_OFFER_PRIORITY_HIGH,
    D3DDDI_OFFER_PRIORITY_AUTO,
}

struct D3DDDI_ALLOCATIONLIST
{
    D3DKMT_HANDLE hAllocation;
    union
    {
        struct
        {
            mixin(bitfields!(uint, "WriteOperation", 1, uint, "DoNotRetireInstance", 1, uint, "OfferPriority", 3, uint, "Reserved", 27));
        }

        uint Value;
    }
}

struct D3DDDI_PATCHLOCATIONLIST
{
    uint AllocationIndex;
    union
    {
        struct
        {
            mixin(bitfields!(uint, "SlotId", 24, uint, "Reserved", 8));
        }

        uint Value;
    }

    uint DriverId;
    uint AllocationOffset;
    uint PatchOffset;
    uint SplitOffset;
}

struct D3DDDICB_LOCKFLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "ReadOnly", 1, 
                             uint, "WriteOnly", 1, 
                             uint, "DonotWait", 1, 
                             uint, "IgnoreSync", 1, 
                             uint, "LockEntire", 1, 
                             uint, "DonotEvict", 1, 
                             uint, "AcquireAperture", 1, 
                             uint, "Discard", 1, 
                             uint, "NoExistingReference", 1, 
                             uint, "UseAlternateVA", 1, 
                             uint, "IgnoreReadSync", 1, 
                             uint, "Reserved", 21));
        }

        uint Value;
    }
}

struct D3DDDICB_LOCK2FLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "Reserved", 32));
        }

        uint Value;
    }
}

struct D3DDDICB_DESTROYALLOCATION2FLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "AssumeNotInUse", 1, uint, "SynchronousDestroy", 1, uint, "Reserved", 29, uint, "SystemUseOnly", 1));
        }

        uint Value;
    }
}

struct D3DDDI_ESCAPEFLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "HardwareAccess", 1, 
                             uint, "DeviceStatusQuery", 1, 
                             uint, "ChangeFrameLatency", 1, 
                             uint, "NoAdapterSynchronization", 1, 
                             uint, "Reserved", 1, 
                             uint, "VirtualMachineData", 1, 
                             uint, "DriverKnownEscape", 1, 
                             uint, "DriverCommonEscape", 1, 
                             uint, "Reserved2", 24));
        }

        uint Value;
    }
}

alias D3DDDI_DRIVERESCAPETYPE = uint;
enum : D3DDDI_DRIVERESCAPETYPE
{
    D3DDDI_DRIVERESCAPETYPE_TRANSLATEALLOCATIONHANDLE = 0,
    D3DDDI_DRIVERESCAPETYPE_TRANSLATERESOURCEHANDLE = 1,
    D3DDDI_DRIVERESCAPETYPE_MAX,
}
struct D3DDDI_DRIVERESCAPE_TRANSLATEALLOCATIONEHANDLE
{
    D3DDDI_DRIVERESCAPETYPE EscapeType;
    D3DKMT_HANDLE hAllocation;
}

struct D3DDDI_DRIVERESCAPE_TRANSLATERESOURCEHANDLE
{
    D3DDDI_DRIVERESCAPETYPE EscapeType;
    D3DKMT_HANDLE hResource;
}

struct D3DDDI_CREATECONTEXTFLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "NullRendering", 1, uint, "InitialData", 1, uint, "DisableGpuTimeout", 1, uint, "SynchronizationOnly", 1, uint, "HwQueueSupported", 1, uint, "Reserved", 27));
        }

        uint Value;
    }
}

struct D3DDDI_CREATEHWCONTEXTFLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "Reserved", 32));
        }

        uint Value;
    }
}

struct D3DDDI_CREATEHWQUEUEFLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "DisableGpuTimeout", 1, uint, "Reserved", 31));
        }

        uint Value;
    }
}

struct D3DDDI_SEGMENTPREFERENCE
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "SegmentId0", 5, 
                             uint, "Direction0", 1, 
                             uint, "SegmentId1", 5, 
                             uint, "Direction1", 1, 
                             uint, "SegmentId2", 5, 
                             uint, "Direction2", 1, 
                             uint, "SegmentId3", 5, 
                             uint, "Direction3", 1, 
                             uint, "SegmentId4", 5, 
                             uint, "Direction4", 1, 
                             uint, "Reserved", 2));
        }

        uint Value;
    }
}

DWORD MAKEFOURCC(byte ch0, byte ch1, byte ch2, byte ch3)
{
    return (cast(DWORD)(ch0) | (cast(DWORD)(ch1) << 8) | (cast(DWORD)(ch2) << 16) | (cast(DWORD)(ch3) << 24));
}

alias D3DDDIFORMAT = uint;
enum : D3DDDIFORMAT
{
    D3DDDIFMT_UNKNOWN = 0,
    D3DDDIFMT_R8G8B8 = 20,
    D3DDDIFMT_A8R8G8B8 = 21,
    D3DDDIFMT_X8R8G8B8 = 22,
    D3DDDIFMT_R5G6B5 = 23,
    D3DDDIFMT_X1R5G5B5 = 24,
    D3DDDIFMT_A1R5G5B5 = 25,
    D3DDDIFMT_A4R4G4B4 = 26,
    D3DDDIFMT_R3G3B2 = 27,
    D3DDDIFMT_A8 = 28,
    D3DDDIFMT_A8R3G3B2 = 29,
    D3DDDIFMT_X4R4G4B4 = 30,
    D3DDDIFMT_A2B10G10R10 = 31,
    D3DDDIFMT_A8B8G8R8 = 32,
    D3DDDIFMT_X8B8G8R8 = 33,
    D3DDDIFMT_G16R16 = 34,
    D3DDDIFMT_A2R10G10B10 = 35,
    D3DDDIFMT_A16B16G16R16 = 36,
    D3DDDIFMT_A8P8 = 40,
    D3DDDIFMT_P8 = 41,
    D3DDDIFMT_L8 = 50,
    D3DDDIFMT_A8L8 = 51,
    D3DDDIFMT_A4L4 = 52,
    D3DDDIFMT_V8U8 = 60,
    D3DDDIFMT_L6V5U5 = 61,
    D3DDDIFMT_X8L8V8U8 = 62,
    D3DDDIFMT_Q8W8V8U8 = 63,
    D3DDDIFMT_V16U16 = 64,
    D3DDDIFMT_W11V11U10 = 65,
    D3DDDIFMT_A2W10V10U10 = 67,
    D3DDDIFMT_UYVY = MAKEFOURCC('U', 'Y', 'V', 'Y'),
    D3DDDIFMT_R8G8_B8G8 = MAKEFOURCC('R', 'G', 'B', 'G'),
    D3DDDIFMT_YUY2 = MAKEFOURCC('Y', 'U', 'Y', '2'),
    D3DDDIFMT_G8R8_G8B8 = MAKEFOURCC('G', 'R', 'G', 'B'),
    D3DDDIFMT_DXT1 = MAKEFOURCC('D', 'X', 'T', '1'),
    D3DDDIFMT_DXT2 = MAKEFOURCC('D', 'X', 'T', '2'),
    D3DDDIFMT_DXT3 = MAKEFOURCC('D', 'X', 'T', '3'),
    D3DDDIFMT_DXT4 = MAKEFOURCC('D', 'X', 'T', '4'),
    D3DDDIFMT_DXT5 = MAKEFOURCC('D', 'X', 'T', '5'),
    D3DDDIFMT_D16_LOCKABLE = 70,
    D3DDDIFMT_D32 = 71,
    D3DDDIFMT_D15S1 = 73,
    D3DDDIFMT_D24S8 = 75,
    D3DDDIFMT_D24X8 = 77,
    D3DDDIFMT_D24X4S4 = 79,
    D3DDDIFMT_D16 = 80,
    D3DDDIFMT_D32F_LOCKABLE = 82,
    D3DDDIFMT_D24FS8 = 83,
    D3DDDIFMT_D32_LOCKABLE = 84,
    D3DDDIFMT_S8_LOCKABLE = 85,
    D3DDDIFMT_S1D15 = 72,
    D3DDDIFMT_S8D24 = 74,
    D3DDDIFMT_X8D24 = 76,
    D3DDDIFMT_X4S4D24 = 78,
    D3DDDIFMT_L16 = 81,
    D3DDDIFMT_G8R8 = 91,
    D3DDDIFMT_R8 = 92,
    D3DDDIFMT_VERTEXDATA = 100,
    D3DDDIFMT_INDEX16 = 101,
    D3DDDIFMT_INDEX32 = 102,
    D3DDDIFMT_Q16W16V16U16 = 110,
    D3DDDIFMT_MULTI2_ARGB8 = MAKEFOURCC('M', 'E', 'T', '1'),
    D3DDDIFMT_R16F = 111,
    D3DDDIFMT_G16R16F = 112,
    D3DDDIFMT_A16B16G16R16F = 113,
    D3DDDIFMT_R32F = 114,
    D3DDDIFMT_G32R32F = 115,
    D3DDDIFMT_A32B32G32R32F = 116,
    D3DDDIFMT_CxV8U8 = 117,
    D3DDDIFMT_A1 = 118,
    D3DDDIFMT_A2B10G10R10_XR_BIAS = 119,
    D3DDDIFMT_DXVACOMPBUFFER_BASE = 150,
    D3DDDIFMT_PICTUREPARAMSDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE + 0,
    D3DDDIFMT_MACROBLOCKDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE + 1,
    D3DDDIFMT_RESIDUALDIFFERENCEDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE + 2,
    D3DDDIFMT_DEBLOCKINGDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE + 3,
    D3DDDIFMT_INVERSEQUANTIZATIONDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE + 4,
    D3DDDIFMT_SLICECONTROLDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE + 5,
    D3DDDIFMT_BITSTREAMDATA = D3DDDIFMT_DXVACOMPBUFFER_BASE + 6,
    D3DDDIFMT_MOTIONVECTORBUFFER = D3DDDIFMT_DXVACOMPBUFFER_BASE + 7,
    D3DDDIFMT_FILMGRAINBUFFER = D3DDDIFMT_DXVACOMPBUFFER_BASE + 8,
    D3DDDIFMT_DXVA_RESERVED9 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 9,
    D3DDDIFMT_DXVA_RESERVED10 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 10,
    D3DDDIFMT_DXVA_RESERVED11 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 11,
    D3DDDIFMT_DXVA_RESERVED12 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 12,
    D3DDDIFMT_DXVA_RESERVED13 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 13,
    D3DDDIFMT_DXVA_RESERVED14 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 14,
    D3DDDIFMT_DXVA_RESERVED15 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 15,
    D3DDDIFMT_DXVA_RESERVED16 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 16,
    D3DDDIFMT_DXVA_RESERVED17 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 17,
    D3DDDIFMT_DXVA_RESERVED18 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 18,
    D3DDDIFMT_DXVA_RESERVED19 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 19,
    D3DDDIFMT_DXVA_RESERVED20 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 20,
    D3DDDIFMT_DXVA_RESERVED21 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 21,
    D3DDDIFMT_DXVA_RESERVED22 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 22,
    D3DDDIFMT_DXVA_RESERVED23 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 23,
    D3DDDIFMT_DXVA_RESERVED24 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 24,
    D3DDDIFMT_DXVA_RESERVED25 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 25,
    D3DDDIFMT_DXVA_RESERVED26 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 26,
    D3DDDIFMT_DXVA_RESERVED27 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 27,
    D3DDDIFMT_DXVA_RESERVED28 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 28,
    D3DDDIFMT_DXVA_RESERVED29 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 29,
    D3DDDIFMT_DXVA_RESERVED30 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 30,
    D3DDDIFMT_DXVA_RESERVED31 = D3DDDIFMT_DXVACOMPBUFFER_BASE + 31,
    D3DDDIFMT_DXVACOMPBUFFER_MAX = D3DDDIFMT_DXVA_RESERVED31,
    D3DDDIFMT_BINARYBUFFER = 199,
    D3DDDIFMT_FORCE_UINT = 0x7fffffff
}

alias D3DDDI_COLOR_SPACE_TYPE = uint;
enum : D3DDDI_COLOR_SPACE_TYPE
{
    D3DDDI_COLOR_SPACE_RGB_FULL_G22_NONE_P709 = 0,
    D3DDDI_COLOR_SPACE_RGB_FULL_G10_NONE_P709 = 1,
    D3DDDI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P709 = 2,
    D3DDDI_COLOR_SPACE_RGB_STUDIO_G22_NONE_P2020 = 3,
    D3DDDI_COLOR_SPACE_RESERVED = 4,
    D3DDDI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 = 5,
    D3DDDI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 = 6,
    D3DDDI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P601 = 7,
    D3DDDI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P709 = 8,
    D3DDDI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P709 = 9,
    D3DDDI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P2020 = 10,
    D3DDDI_COLOR_SPACE_YCBCR_FULL_G22_LEFT_P2020 = 11,
    D3DDDI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020 = 12,
    D3DDDI_COLOR_SPACE_YCBCR_STUDIO_G2084_LEFT_P2020 = 13,
    D3DDDI_COLOR_SPACE_RGB_STUDIO_G2084_NONE_P2020 = 14,
    D3DDDI_COLOR_SPACE_YCBCR_STUDIO_G22_TOPLEFT_P2020 = 15,
    D3DDDI_COLOR_SPACE_YCBCR_STUDIO_G2084_TOPLEFT_P2020 = 16,
    D3DDDI_COLOR_SPACE_RGB_FULL_G22_NONE_P2020 = 17,
    D3DDDI_COLOR_SPACE_YCBCR_STUDIO_GHLG_TOPLEFT_P2020 = 18,
    D3DDDI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020 = 19,
    D3DDDI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P709 = 20,
    D3DDDI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P2020 = 21,
    D3DDDI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P709 = 22,
    D3DDDI_COLOR_SPACE_YCBCR_STUDIO_G24_LEFT_P2020 = 23,
    D3DDDI_COLOR_SPACE_YCBCR_STUDIO_G24_TOPLEFT_P2020 = 24,
    D3DDDI_COLOR_SPACE_CUSTOM = 0xFFFFFFFF
}

alias D3DDDI_OUTPUT_WIRE_COLOR_SPACE_TYPE = uint;
enum : D3DDDI_OUTPUT_WIRE_COLOR_SPACE_TYPE
{
    D3DDDI_OUTPUT_WIRE_COLOR_SPACE_G22_P709 = 0,
    D3DDDI_OUTPUT_WIRE_COLOR_SPACE_RESERVED = 4,
    D3DDDI_OUTPUT_WIRE_COLOR_SPACE_G2084_P2020 = 12,
    D3DDDI_OUTPUT_WIRE_COLOR_SPACE_G22_P709_WCG = 30,
    D3DDDI_OUTPUT_WIRE_COLOR_SPACE_G22_P2020 = 31,
    D3DDDI_OUTPUT_WIRE_COLOR_SPACE_G2084_P2020_HDR10PLUS = 32,
    D3DDDI_OUTPUT_WIRE_COLOR_SPACE_G2084_P2020_DVLL = 33,
}

struct D3DDDIRECT
{
    long left;
    long top;
    long right;
    long bottom;
}

struct D3DDDI_KERNELOVERLAYINFO
{
    D3DKMT_HANDLE hAllocation;
    D3DDDIRECT DstRect;
    D3DDDIRECT SrcRect;
    VOID* pPrivateDriverData;
    uint PrivateDriverDataSize;
}

alias D3DDDI_GAMMARAMP_TYPE = uint;
enum : D3DDDI_GAMMARAMP_TYPE
{
    D3DDDI_GAMMARAMP_UNINITIALIZED = 0,
    D3DDDI_GAMMARAMP_DEFAULT = 1,
    D3DDDI_GAMMARAMP_RGB256x3x16 = 2,
    D3DDDI_GAMMARAMP_DXGI_1 = 3,
    D3DDDI_GAMMARAMP_MATRIX_3x4 = 4,
}
struct D3DDDI_GAMMA_RAMP_RGB256x3x16
{
    USHORT[256] Red;
    USHORT[256] Green;
    USHORT[256] Blue;
}

struct D3DDDI_DXGI_RGB
{
    float Red;
    float Green;
    float Blue;
}

struct D3DDDI_GAMMA_RAMP_DXGI_1
{
    D3DDDI_DXGI_RGB Scale;
    D3DDDI_DXGI_RGB Offset;
    D3DDDI_DXGI_RGB[1025] GammaCurve;
}

struct D3DKMDT_3X4_COLORSPACE_TRANSFORM
{
    float[3][4] ColorMatrix3x4;
    float ScalarMultiplier;
    D3DDDI_DXGI_RGB[4096] LookupTable1D;
}

alias D3DDDI_HDR_METADATA_TYPE = uint;
enum : D3DDDI_HDR_METADATA_TYPE
{
    D3DDDI_HDR_METADATA_TYPE_NONE = 0,
    D3DDDI_HDR_METADATA_TYPE_HDR10 = 1,
    D3DDDI_HDR_METADATA_TYPE_HDR10PLUS = 2,
}

struct D3DDDI_HDR_METADATA_HDR10
{
    ushort[2] RedPrimary;
    ushort[2] GreenPrimary;
    ushort[2] BluePrimary;
    ushort[2] WhitePoint;
    uint MaxMasteringLuminance;
    uint MinMasteringLuminance;
    ushort MaxContentLightLevel;
    ushort MaxFrameAverageLightLevel;
}

struct D3DDDI_HDR_METADATA_HDR10PLUS
{
    byte[72] Data;
}

enum D3DDDI_ID_UNINITIALIZED = cast(uint)(~0);
enum D3DDDI_ID_NOTAPPLICABLE = cast(uint)(0);
enum D3DDDI_ID_ANY = cast(uint)(~1);
enum D3DDDI_ID_ALL = cast(uint)(~2);
enum D3DKMDT_MAX_VIDPN_SOURCES_BITCOUNT = 4;
enum D3DKMDT_MAX_VIDPN_SOURCES = (1 << D3DKMDT_MAX_VIDPN_SOURCES_BITCOUNT);

struct D3DDDI_MULTISAMPLINGMETHOD
{
    uint NumSamples;
    uint NumQualityLevels;
}

alias D3DDDI_VIDEO_SIGNAL_SCANLINE_ORDERING = uint;
enum : D3DDDI_VIDEO_SIGNAL_SCANLINE_ORDERING
{
    D3DDDI_VSSLO_UNINITIALIZED = 0,
    D3DDDI_VSSLO_PROGRESSIVE = 1,
    D3DDDI_VSSLO_INTERLACED_UPPERFIELDFIRST = 2,
    D3DDDI_VSSLO_INTERLACED_LOWERFIELDFIRST = 3,
    D3DDDI_VSSLO_OTHER = 255
}

alias D3DDDI_FLIPINTERVAL_TYPE = uint;
enum : D3DDDI_FLIPINTERVAL_TYPE
{
    D3DDDI_FLIPINTERVAL_IMMEDIATE = 0,
    D3DDDI_FLIPINTERVAL_ONE = 1,
    D3DDDI_FLIPINTERVAL_TWO = 2,
    D3DDDI_FLIPINTERVAL_THREE = 3,
    D3DDDI_FLIPINTERVAL_FOUR = 4,
    D3DDDI_FLIPINTERVAL_IMMEDIATE_ALLOW_TEARING = 5,
}

alias D3DDDI_POOL = uint;
enum : D3DDDI_POOL
{
    D3DDDIPOOL_SYSTEMMEM = 1,
    D3DDDIPOOL_VIDEOMEMORY = 2,
    D3DDDIPOOL_LOCALVIDMEM = 3,
    D3DDDIPOOL_NONLOCALVIDMEM = 4,
    D3DDDIPOOL_STAGINGMEM = 5,
}

alias D3DDDIMULTISAMPLE_TYPE = uint;
enum : D3DDDIMULTISAMPLE_TYPE
{
    D3DDDIMULTISAMPLE_NONE = 0,
    D3DDDIMULTISAMPLE_NONMASKABLE = 1,
    D3DDDIMULTISAMPLE_2_SAMPLES = 2,
    D3DDDIMULTISAMPLE_3_SAMPLES = 3,
    D3DDDIMULTISAMPLE_4_SAMPLES = 4,
    D3DDDIMULTISAMPLE_5_SAMPLES = 5,
    D3DDDIMULTISAMPLE_6_SAMPLES = 6,
    D3DDDIMULTISAMPLE_7_SAMPLES = 7,
    D3DDDIMULTISAMPLE_8_SAMPLES = 8,
    D3DDDIMULTISAMPLE_9_SAMPLES = 9,
    D3DDDIMULTISAMPLE_10_SAMPLES = 10,
    D3DDDIMULTISAMPLE_11_SAMPLES = 11,
    D3DDDIMULTISAMPLE_12_SAMPLES = 12,
    D3DDDIMULTISAMPLE_13_SAMPLES = 13,
    D3DDDIMULTISAMPLE_14_SAMPLES = 14,
    D3DDDIMULTISAMPLE_15_SAMPLES = 15,
    D3DDDIMULTISAMPLE_16_SAMPLES = 16,
    D3DDDIMULTISAMPLE_FORCE_UINT = 0x7fffffff
}
struct D3DDDI_RESOURCEFLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "RenderTarget", 1, 
                             uint, "ZBuffer", 1, 
                             uint, "Dynamic", 1, 
                             uint, "HintStatic", 1, 
                             uint, "AutogenMipmap", 1, 
                             uint, "DMap", 1, 
                             uint, "WriteOnly", 1, 
                             uint, "NotLockable", 1, 
                             uint, "Points", 1, 
                             uint, "RtPatches", 1, 
                             uint, "NPatches", 1, 
                             uint, "SharedResource", 1, 
                             uint, "DiscardRenderTarget", 1, 
                             uint, "Video", 1, 
                             uint, "CaptureBuffer", 1, 
                             uint, "Primary", 1, 
                             uint, "Texture", 1, 
                             uint, "CubeMap", 1, 
                             uint, "Volume", 1, 
                             uint, "VertexBuffer", 1, 
                             uint, "IndexBuffer", 1, 
                             uint, "DecodeRenderTarget", 1, 
                             uint, "DecodeCompressedBuffer", 1, 
                             uint, "VideoProcessRenderTarget", 1, 
                             uint, "CpuOptimized", 1, 
                             uint, "MightDrawFromLocked", 1, 
                             uint, "Overlay", 1, 
                             uint, "MatchGdiPrimary", 1, 
                             uint, "InterlacedRefresh", 1, 
                             uint, "TextApi", 1, 
                             uint, "RestrictedContent", 1, 
                             uint, "RestrictSharedAccess", 1));
        }

        uint Value;
    }
}

struct D3DDDI_SURFACEINFO
{
    uint Width;
    uint Height;
    uint Depth;
    const VOID* pSysMem;
    uint SysMemPitch;
    uint SysMemSlicePitch;
}

alias D3DDDI_ROTATION = uint;
enum : D3DDDI_ROTATION
{
    D3DDDI_ROTATION_IDENTITY = 1,
    D3DDDI_ROTATION_90 = 2,
    D3DDDI_ROTATION_180 = 3,
    D3DDDI_ROTATION_270 = 4
}

alias D3DDDI_SCANLINEORDERING = uint;
enum : D3DDDI_SCANLINEORDERING
{
    D3DDDI_SCANLINEORDERING_UNKNOWN = 0,
    D3DDDI_SCANLINEORDERING_PROGRESSIVE = 1,
    D3DDDI_SCANLINEORDERING_INTERLACED = 2,
}

struct D3DDDIARG_CREATERESOURCE
{
    D3DDDIFORMAT Format;
    D3DDDI_POOL Pool;
    D3DDDIMULTISAMPLE_TYPE MultisampleType;
    uint MultisampleQuality;
    const D3DDDI_SURFACEINFO* pSurfList;
    uint SurfCount;
    uint MipLevels;
    uint Fvf;
    D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
    D3DDDI_RATIONAL RefreshRate;
    HANDLE hResource;
    D3DDDI_RESOURCEFLAGS Flags;
    D3DDDI_ROTATION Rotation;
}

struct D3DDDI_RESOURCEFLAGS2
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "VideoEncoder", 1, uint, "UserMemory", 1, uint, "CrossAdapter", 1, uint, "IsDisplayable", 1, uint, "Reserved", 28));
        }

        uint Value;
    }
}

struct D3DDDIARG_CREATERESOURCE2
{
    D3DDDIFORMAT Format;
    D3DDDI_POOL Pool;
    D3DDDIMULTISAMPLE_TYPE MultisampleType;
    uint MultisampleQuality;
    const D3DDDI_SURFACEINFO* pSurfList;
    uint SurfCount;
    uint MipLevels;
    uint Fvf;
    D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId;
    D3DDDI_RATIONAL RefreshRate;
    HANDLE hResource;
    D3DDDI_RESOURCEFLAGS Flags;
    D3DDDI_ROTATION Rotation;
    D3DDDI_RESOURCEFLAGS2 Flags2;
}

struct D3DDDICB_SIGNALFLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "SignalAtSubmission", 1, uint, "EnqueueCpuEvent", 1, uint, "AllowFenceRewind", 1, uint, "Reserved", 28, uint, "DXGK_SIGNAL_FLAG_INTERNAL0", 1));
        }

        uint Value;
    }
}

enum D3DDDI_MAX_OBJECT_WAITED_ON = 32;
enum D3DDDI_MAX_OBJECT_SIGNALED = 32;

alias D3DDDI_SYNCHRONIZATIONOBJECT_TYPE = uint;
enum : D3DDDI_SYNCHRONIZATIONOBJECT_TYPE
{
    D3DDDI_SYNCHRONIZATION_MUTEX = 1,
    D3DDDI_SEMAPHORE = 2,
    D3DDDI_FENCE = 3,
    D3DDDI_CPU_NOTIFICATION = 4,
    D3DDDI_MONITORED_FENCE = 5,
    D3DDDI_PERIODIC_MONITORED_FENCE = 6,
    D3DDDI_SYNCHRONIZATION_TYPE_LIMIT
}

enum D3DDDI_SYNC_OBJECT_WAIT = 0x1;
enum D3DDDI_SYNC_OBJECT_SIGNAL = 0x2;
enum D3DDDI_SYNC_OBJECT_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | D3DDDI_SYNC_OBJECT_WAIT | D3DDDI_SYNC_OBJECT_SIGNAL);

union DXGK_MIRACAST_CHUNK_ID
{
    union
    {
        struct
        {
            mixin(bitfields!(ulong, "FrameNumber", 40, ulong, "PartNumber", 24));
        }

        ulong Value;
    }
}

alias DXGK_MIRACAST_CHUNK_TYPE = uint;
enum : DXGK_MIRACAST_CHUNK_TYPE
{
    DXGK_MIRACAST_CHUNK_TYPE_UNKNOWN = 0,
    DXGK_MIRACAST_CHUNK_TYPE_COLOR_CONVERT_COMPLETE = 1,
    DXGK_MIRACAST_CHUNK_TYPE_ENCODE_COMPLETE = 2,
    DXGK_MIRACAST_CHUNK_TYPE_FRAME_START = 3,
    DXGK_MIRACAST_CHUNK_TYPE_FRAME_DROPPED = 4,
    DXGK_MIRACAST_CHUNK_TYPE_ENCODE_DRIVER_DEFINED_1 = 0x80000000,
    DXGK_MIRACAST_CHUNK_TYPE_ENCODE_DRIVER_DEFINED_2 = 0x80000001,
}

struct DXGK_MIRACAST_CHUNK_INFO
{
    DXGK_MIRACAST_CHUNK_TYPE ChunkType;
    DXGK_MIRACAST_CHUNK_ID ChunkId;
    uint ProcessingTime;
    uint EncodeRate;
}

alias D3DDDI_PAGINGQUEUE_PRIORITY = uint;
enum : D3DDDI_PAGINGQUEUE_PRIORITY
{
    D3DDDI_PAGINGQUEUE_PRIORITY_BELOW_NORMAL = -1,
    D3DDDI_PAGINGQUEUE_PRIORITY_NORMAL = 0,
    D3DDDI_PAGINGQUEUE_PRIORITY_ABOVE_NORMAL = 1,
}

struct D3DDDI_MAKERESIDENT_FLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "CantTrimFurther", 1, uint, "MustSucceed", 1, uint, "Reserved", 30));
        }

        uint Value;
    }
}

struct D3DDDI_MAKERESIDENT
{
    D3DKMT_HANDLE hPagingQueue;
    uint NumAllocations;
    const D3DKMT_HANDLE* AllocationList;
    const uint* PriorityList;
    D3DDDI_MAKERESIDENT_FLAGS Flags;
    ulong PagingFenceValue;
    ulong NumBytesToTrim;
}

struct D3DDDI_EVICT_FLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "EvictOnlyIfNecessary", 1, uint, "NotWrittenTo", 1, uint, "Reserved", 30));
        }

        uint Value;
    }
}

struct D3DDDI_TRIMRESIDENCYSET_FLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "PeriodicTrim", 1, uint, "RestartPeriodicTrim", 1, uint, "TrimToBudget", 1, uint, "Reserved", 29));
        }

        uint Value;
    }
}

struct D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE
{
    union
    {
        struct
        {
            mixin(bitfields!(ulong, "Write", 1, ulong, "Execute", 1, ulong, "Zero", 1, ulong, "NoAccess", 1, ulong, "SystemUseOnly", 1, ulong, "Reserved", 59));
        }

        ulong Value;
    }
}

alias D3DDDI_UPDATEGPUVIRTUALADDRESS_OPERATION_TYPE = uint;
enum : D3DDDI_UPDATEGPUVIRTUALADDRESS_OPERATION_TYPE
{
    D3DDDI_UPDATEGPUVIRTUALADDRESS_MAP = 0,
    D3DDDI_UPDATEGPUVIRTUALADDRESS_UNMAP = 1,
    D3DDDI_UPDATEGPUVIRTUALADDRESS_COPY = 2,
    D3DDDI_UPDATEGPUVIRTUALADDRESS_MAP_PROTECT = 3,
}

struct D3DDDI_UPDATEGPUVIRTUALADDRESS_OPERATION
{
    D3DDDI_UPDATEGPUVIRTUALADDRESS_OPERATION_TYPE OperationType;
    union
    {
        struct Map
        {
            D3DGPU_VIRTUAL_ADDRESS BaseAddress;
            D3DGPU_SIZE_T SizeInBytes;
            D3DKMT_HANDLE hAllocation;
            D3DGPU_SIZE_T AllocationOffsetInBytes;
            D3DGPU_SIZE_T AllocationSizeInBytes;
        }

        struct MapProtect
        {
            D3DGPU_VIRTUAL_ADDRESS BaseAddress;
            D3DGPU_SIZE_T SizeInBytes;
            D3DKMT_HANDLE hAllocation;
            D3DGPU_SIZE_T AllocationOffsetInBytes;
            D3DGPU_SIZE_T AllocationSizeInBytes;
            D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE Protection;
            ulong DriverProtection;
        }

        struct Unmap
        {
            D3DGPU_VIRTUAL_ADDRESS BaseAddress;
            D3DGPU_SIZE_T SizeInBytes;
            D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE Protection;
        }

        struct Copy
        {
            D3DGPU_VIRTUAL_ADDRESS SourceAddress;
            D3DGPU_SIZE_T SizeInBytes;
            D3DGPU_VIRTUAL_ADDRESS DestAddress;
        }
    }
}

alias D3DDDIGPUVIRTUALADDRESS_RESERVATION_TYPE = uint;
enum : D3DDDIGPUVIRTUALADDRESS_RESERVATION_TYPE
{
    D3DDDIGPUVIRTUALADDRESS_RESERVE_NO_ACCESS = 0,
    D3DDDIGPUVIRTUALADDRESS_RESERVE_ZERO = 1,
    D3DDDIGPUVIRTUALADDRESS_RESERVE_NO_COMMIT = 2
}

struct D3DDDI_MAPGPUVIRTUALADDRESS
{
    D3DKMT_HANDLE hPagingQueue;
    D3DGPU_VIRTUAL_ADDRESS BaseAddress;
    D3DGPU_VIRTUAL_ADDRESS MinimumAddress;
    D3DGPU_VIRTUAL_ADDRESS MaximumAddress;
    D3DKMT_HANDLE hAllocation;
    D3DGPU_SIZE_T OffsetInPages;
    D3DGPU_SIZE_T SizeInPages;
    D3DDDIGPUVIRTUALADDRESS_PROTECTION_TYPE Protection;
    ulong DriverProtection;
    uint Reserved0;
    ulong Reserved1;
    D3DGPU_VIRTUAL_ADDRESS VirtualAddress;
    ulong PagingFenceValue;
}

struct D3DDDI_RESERVEGPUVIRTUALADDRESS
{
    union
    {
        D3DKMT_HANDLE hPagingQueue;
        D3DKMT_HANDLE hAdapter;
    }

    D3DGPU_VIRTUAL_ADDRESS BaseAddress;
    D3DGPU_VIRTUAL_ADDRESS MinimumAddress;
    D3DGPU_VIRTUAL_ADDRESS MaximumAddress;
    D3DGPU_SIZE_T Size;

    union
    {
        D3DDDIGPUVIRTUALADDRESS_RESERVATION_TYPE ReservationType;
        uint Reserved0;
    }

    union
    {
        ulong DriverProtection;
        ulong Reserved1;
    }

    D3DGPU_VIRTUAL_ADDRESS VirtualAddress;
    union
    {
        ulong PagingFenceValue;
        ulong Reserved2;
    }
}

struct D3DDDI_GETRESOURCEPRESENTPRIVATEDRIVERDATA
{
    D3DKMT_HANDLE hResource;
    uint PrivateDriverDataSize;
    PVOID pPrivateDriverData;
}

struct D3DDDI_DESTROYPAGINGQUEUE
{
    D3DKMT_HANDLE hPagingQueue;
}

struct D3DDDI_UPDATEALLOCPROPERTY_FLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "AccessedPhysically", 1, uint, "Reserved", 31));
        }

        uint Value;
    }
}

struct D3DDDI_UPDATEALLOCPROPERTY
{
    D3DKMT_HANDLE hPagingQueue;
    D3DKMT_HANDLE hAllocation;
    uint SupportedSegmentSet;
    D3DDDI_SEGMENTPREFERENCE PreferredSegment;
    D3DDDI_UPDATEALLOCPROPERTY_FLAGS Flags;
    ulong PagingFenceValue;
    union
    {
        struct
        {
            mixin(bitfields!(uint, "SetAccessedPhysically", 1, uint, "SetSupportedSegmentSet", 1, uint, "SetPreferredSegment", 1, uint, "Reserved", 29));
        }

        uint PropertyMaskValue;
    }
}

struct D3DDDI_OFFER_FLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "AllowDecommit", 1, uint, "Reserved", 31));
        }

        uint Value;
    }
}

alias D3DDDI_RECLAIM_RESULT = uint;
enum : D3DDDI_RECLAIM_RESULT
{
    D3DDDI_RECLAIM_RESULT_OK = 0,
    D3DDDI_RECLAIM_RESULT_DISCARDED = 1,
    D3DDDI_RECLAIM_RESULT_NOT_COMMITTED = 2,
}

struct D3DDDI_SYNCHRONIZATIONOBJECTINFO
{
    D3DDDI_SYNCHRONIZATIONOBJECT_TYPE Type;
    union
    {
        struct SynchronizationMutex
        {
            bool InitialState;
        }

        struct Semaphore
        {
            uint MaxCount;
            uint InitialCount;
        }

        struct Reserved
        {
            uint[16] Reserved;
        }
    }
}

alias D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS_RESERVED0 = D3DDDI_MAPGPUVIRTUALADDRESS.Reserved0;
struct D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "Shared", 1, 
                             uint, "NtSecuritySharing", 1, 
                             uint, "CrossAdapter", 1, 
                             uint, "TopOfPipeline", 1, 
                             uint, "NoSignal", 1, 
                             uint, "NoWait", 1, 
                             uint, "NoSignalMaxValueOnTdr", 1, 
                             uint, "NoGPUAccess", 1, 
                             uint, "Reserved", 23, 
                             uint, "D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS_RESERVED0", 1));
        }

        uint Value;
    }
}

struct D3DDDI_SYNCHRONIZATIONOBJECTINFO2
{
    D3DDDI_SYNCHRONIZATIONOBJECT_TYPE Type;
    D3DDDI_SYNCHRONIZATIONOBJECT_FLAGS Flags;
    union
    {
        struct SynchronizationMutex
        {
            bool InitialState;
        }

        struct Semaphore
        {
            uint MaxCount;
            uint InitialCount;
        }

        struct Fence
        {
            ulong FenceValue;
        }

        struct CPUNotification
        {
            HANDLE Event;
        }

        struct MonitoredFence
        {
            ulong InitialFenceValue;
            VOID* FenceValueCPUVirtualAddress;
            D3DGPU_VIRTUAL_ADDRESS FenceValueGPUVirtualAddress;
            uint EngineAffinity;
        }

        struct PeriodicMonitoredFence
        {
            D3DKMT_HANDLE hAdapter;
            D3DDDI_VIDEO_PRESENT_TARGET_ID VidPnTargetId;
            ulong Time;
            VOID* FenceValueCPUVirtualAddress;
            D3DGPU_VIRTUAL_ADDRESS FenceValueGPUVirtualAddress;
            uint EngineAffinity;
        }

        struct Reserved
        {
            ulong[8] Reserved;
        }
    }

    D3DKMT_HANDLE SharedHandle;
}

struct D3DDDI_WAITFORSYNCHRONIZATIONOBJECTFROMCPU_FLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "WaitAny", 1, uint, "Reserved", 31));
        }

        uint Value;
    }
}

struct D3DDDI_QUERYREGISTRY_FLAGS
{
    union
    {
        struct
        {
            mixin(bitfields!(uint, "TranslatePath", 1, uint, "MutableValue", 1, uint, "Reserved", 30));
        }

        uint Value;
    }
}

alias D3DDDI_QUERYREGISTRY_TYPE = uint;
enum : D3DDDI_QUERYREGISTRY_TYPE
{
    D3DDDI_QUERYREGISTRY_SERVICEKEY = 0,
    D3DDDI_QUERYREGISTRY_ADAPTERKEY = 1,
    D3DDDI_QUERYREGISTRY_DRIVERSTOREPATH = 2,
    D3DDDI_QUERYREGISTRY_DRIVERIMAGEPATH = 3,
    D3DDDI_QUERYREGISTRY_MAX,
}

alias D3DDDI_QUERYREGISTRY_STATUS = uint;
enum : D3DDDI_QUERYREGISTRY_STATUS
{
    D3DDDI_QUERYREGISTRY_STATUS_SUCCESS = 0,
    D3DDDI_QUERYREGISTRY_STATUS_BUFFER_OVERFLOW = 1,
    D3DDDI_QUERYREGISTRY_STATUS_FAIL = 2,
    D3DDDI_QUERYREGISTRY_STATUS_MAX,
}

struct D3DDDI_QUERYREGISTRY_INFO
{
    D3DDDI_QUERYREGISTRY_TYPE QueryType;
    D3DDDI_QUERYREGISTRY_FLAGS QueryFlags;
    WCHAR[MAX_PATH] ValueName;
    ULONG ValueType;
    ULONG PhysicalAdapterIndex;
    ULONG OutputValueSize;
    D3DDDI_QUERYREGISTRY_STATUS Status;
    union
    {
        DWORD OutputDword;
        ulong OutputQword;
        WCHAR[1] OutputString;
        byte[1] OutputBinary;
    }
}

enum D3DDDI_MAX_BROADCAST_CONTEXT = 64;
enum D3DDDI_ALLOCATIONPRIORITY_MINIMUM = 0x28000000;
enum D3DDDI_ALLOCATIONPRIORITY_LOW = 0x50000000;
enum D3DDDI_ALLOCATIONPRIORITY_NORMAL = 0x78000000;
enum D3DDDI_ALLOCATIONPRIORITY_HIGH = 0xa0000000;
enum D3DDDI_ALLOCATIONPRIORITY_MAXIMUM = 0xc8000000;
enum D3DKMT_CROSS_ADAPTER_RESOURCE_PITCH_ALIGNMENT = 128;
enum D3DKMT_CROSS_ADAPTER_RESOURCE_HEIGHT_ALIGNMENT = 4;
