1 module directx.dxgiddi; 2 /*==========================================================================; 3 * 4 * Copyright (C) Microsoft Corporation. All Rights Reserved. 5 * 6 * Content: DXGI Basic Device Driver Interface Definitions 7 * 8 ***************************************************************************/ 9 10 version(Windows): 11 12 public import directx.dxgitype; 13 14 import std.bitmanip : bitfields; 15 16 import directx.dxgi; 17 import directx.d3dukmdt; 18 19 //-------------------------------------------------------------------------------------------------------- 20 // DXGI error codes 21 //-------------------------------------------------------------------------------------------------------- 22 enum _FACDXGI_DDI = 0x87b; 23 24 pure nothrow @safe @nogc { 25 HRESULT MAKE_DXGI_DDI_HRESULT(UINT code) { 26 return MAKE_HRESULT(1, _FACDXGI_DDI, code); 27 } 28 29 HRESULT MAKE_DXGI_DDI_STATUS(UINT code) { 30 return MAKE_HRESULT(0, _FACDXGI_DDI, code); 31 } 32 } 33 34 // DXGI DDI error codes have moved to winerror.h 35 36 //======================================================================================================== 37 // This is the standard DDI that any DXGI-enabled user-mode driver should support 38 // 39 40 //-------------------------------------------------------------------------------------------------------- 41 alias UINT_PTR DXGI_DDI_HDEVICE; 42 alias UINT_PTR DXGI_DDI_HRESOURCE; 43 44 //-------------------------------------------------------------------------------------------------------- 45 alias DWORD DXGI_DDI_RESIDENCY; 46 enum : DXGI_DDI_RESIDENCY 47 { 48 DXGI_DDI_RESIDENCY_FULLY_RESIDENT = 1, 49 DXGI_DDI_RESIDENCY_RESIDENT_IN_SHARED_MEMORY = 2, 50 DXGI_DDI_RESIDENCY_EVICTED_TO_DISK = 3, 51 } 52 53 //-------------------------------------------------------------------------------------------------------- 54 alias DWORD DXGI_DDI_FLIP_INTERVAL_TYPE; 55 enum : DXGI_DDI_FLIP_INTERVAL_TYPE 56 { 57 DXGI_DDI_FLIP_INTERVAL_IMMEDIATE = 0, 58 DXGI_DDI_FLIP_INTERVAL_ONE = 1, 59 DXGI_DDI_FLIP_INTERVAL_TWO = 2, 60 DXGI_DDI_FLIP_INTERVAL_THREE = 3, 61 DXGI_DDI_FLIP_INTERVAL_FOUR = 4, 62 } 63 64 //-------------------------------------------------------------------------------------------------------- 65 struct DXGI_DDI_PRESENT_FLAGS 66 { 67 union 68 { 69 mixin(bitfields!(UINT, "Blt", 1, 70 UINT, "Flip", 1, 71 UINT, "PreferRight", 1, 72 UINT, "TemporaryMono", 1, 73 UINT, "Reserved", 28)); 74 UINT Value; 75 } 76 } 77 78 //-------------------------------------------------------------------------------------------------------- 79 struct DXGI_DDI_ARG_PRESENT 80 { 81 DXGI_DDI_HDEVICE hDevice; //in 82 DXGI_DDI_HRESOURCE hSurfaceToPresent; //in 83 UINT SrcSubResourceIndex; // Index of surface level 84 DXGI_DDI_HRESOURCE hDstResource; // if non-zero, it's the destination of the present 85 UINT DstSubResourceIndex; // Index of surface level 86 void * pDXGIContext; // opaque: Pass this to the Present callback 87 DXGI_DDI_PRESENT_FLAGS Flags; // Presentation flags. 88 DXGI_DDI_FLIP_INTERVAL_TYPE FlipInterval; // Presentation interval (flip only) 89 } 90 91 //-------------------------------------------------------------------------------------------------------- 92 struct DXGI_DDI_ARG_ROTATE_RESOURCE_IDENTITIES 93 { 94 DXGI_DDI_HDEVICE hDevice; //in 95 const(DXGI_DDI_HRESOURCE)* pResources; //in: Array of Resources to rotate identities; 0 <= 1, 1 <= 2, etc. 96 UINT Resources; 97 } 98 99 struct DXGI_DDI_ARG_GET_GAMMA_CONTROL_CAPS 100 { 101 DXGI_DDI_HDEVICE hDevice; //in 102 DXGI_GAMMA_CONTROL_CAPABILITIES * pGammaCapabilities; //in/out 103 } 104 105 struct DXGI_DDI_ARG_SET_GAMMA_CONTROL 106 { 107 DXGI_DDI_HDEVICE hDevice; //in 108 DXGI_GAMMA_CONTROL GammaControl; //in 109 } 110 111 struct DXGI_DDI_ARG_SETDISPLAYMODE 112 { 113 DXGI_DDI_HDEVICE hDevice; //in 114 DXGI_DDI_HRESOURCE hResource; // Source surface 115 UINT SubResourceIndex; // Index of surface level 116 } 117 118 struct DXGI_DDI_ARG_SETRESOURCEPRIORITY 119 { 120 DXGI_DDI_HDEVICE hDevice; //in 121 DXGI_DDI_HRESOURCE hResource; //in 122 UINT Priority; //in 123 } 124 125 struct DXGI_DDI_ARG_QUERYRESOURCERESIDENCY 126 { 127 DXGI_DDI_HDEVICE hDevice; //in 128 const(DXGI_DDI_HRESOURCE)* pResources; //in 129 DXGI_DDI_RESIDENCY * pStatus; //out 130 SIZE_T Resources; //in 131 } 132 133 //-------------------------------------------------------------------------------------------------------- 134 // Remarks: Fractional value used to represent vertical and horizontal frequencies of a video mode 135 // (i.e. VSync and HSync). Vertical frequencies are stored in Hz. Horizontal frequencies 136 // are stored in KHz. 137 // The dynamic range of this encoding format, given 10^-7 resolution is {0..(2^32 - 1) / 10^7}, 138 // which translates to {0..428.4967296} [Hz] for vertical frequencies and {0..428.4967296} [KHz] 139 // for horizontal frequencies. This sub-microseconds precision range should be acceptable even 140 // for a pro-video application (error in one microsecond for video signal synchronization would 141 // imply a time drift with a cycle of 10^7/(60*60*24) = 115.741 days. 142 // 143 // If rational number with a finite fractional sequence, use denominator of form 10^(length of fractional sequence). 144 // If rational number without a finite fractional sequence, or a sequence exceeding the precision allowed by the 145 // dynamic range of the denominator, or an irrational number, use an appropriate ratio of integers which best 146 // represents the value. 147 // 148 struct DXGI_DDI_RATIONAL 149 { 150 UINT Numerator; 151 UINT Denominator; 152 } 153 154 //-------------------------------------------------------------------------------------------------------- 155 alias DWORD DXGI_DDI_MODE_SCANLINE_ORDER; 156 enum : DXGI_DDI_MODE_SCANLINE_ORDER 157 { 158 DXGI_DDI_MODE_SCANLINE_ORDER_UNSPECIFIED = 0, 159 DXGI_DDI_MODE_SCANLINE_ORDER_PROGRESSIVE = 1, 160 DXGI_DDI_MODE_SCANLINE_ORDER_UPPER_FIELD_FIRST = 2, 161 DXGI_DDI_MODE_SCANLINE_ORDER_LOWER_FIELD_FIRST = 3, 162 } 163 164 alias DWORD DXGI_DDI_MODE_SCALING; 165 enum : DXGI_DDI_MODE_SCALING 166 { 167 DXGI_DDI_MODE_SCALING_UNSPECIFIED = 0, 168 DXGI_DDI_MODE_SCALING_STRETCHED = 1, 169 DXGI_DDI_MODE_SCALING_CENTERED = 2, 170 } 171 172 alias DWORD DXGI_DDI_MODE_ROTATION; 173 enum : DXGI_DDI_MODE_ROTATION 174 { 175 DXGI_DDI_MODE_ROTATION_UNSPECIFIED = 0, 176 DXGI_DDI_MODE_ROTATION_IDENTITY = 1, 177 DXGI_DDI_MODE_ROTATION_ROTATE90 = 2, 178 DXGI_DDI_MODE_ROTATION_ROTATE180 = 3, 179 DXGI_DDI_MODE_ROTATION_ROTATE270 = 4, 180 } 181 182 struct DXGI_DDI_MODE_DESC 183 { 184 UINT Width; 185 UINT Height; 186 DXGI_FORMAT Format; 187 DXGI_DDI_RATIONAL RefreshRate; 188 DXGI_DDI_MODE_SCANLINE_ORDER ScanlineOrdering; 189 DXGI_DDI_MODE_ROTATION Rotation; 190 DXGI_DDI_MODE_SCALING Scaling; 191 } 192 193 // Bit indicates that UMD has the option to prevent this Resource from ever being a Primary 194 // UMD can prevent the actual flip (from optional primary to regular primary) and use a copy 195 // operation, during Present. Thus, it's possible the UMD can opt out of this Resource being 196 // actually used as a primary. 197 enum DXGI_DDI_PRIMARY_OPTIONAL = 0x1; 198 199 // Bit indicates that the Primary really represents the IDENTITY rotation, eventhough it will 200 // be used with non-IDENTITY display modes, since the application will take on the burden of 201 // honoring the output orientation by rotating, say the viewport and projection matrix. 202 enum DXGI_DDI_PRIMARY_NONPREROTATED = 0x2; 203 204 // Bit indicates that the primary is stereoscopic. 205 enum DXGI_DDI_PRIMARY_STEREO = 0x4; 206 207 // Bit indicates that this primary will be used for indirect presentation 208 enum DXGI_DDI_PRIMARY_INDIRECT = 0x8; 209 210 // Bit indicates that the driver cannot tolerate setting any subresource of the specified 211 // resource as a primary. The UMD should set this bit at resource creation time if it 212 // chooses to implement presentation from this surface via a copy operation. The DXGI 213 // runtime will not employ flip-style presentation if this bit is set 214 enum DXGI_DDI_PRIMARY_DRIVER_FLAG_NO_SCANOUT = 0x1; 215 216 struct DXGI_DDI_PRIMARY_DESC 217 { 218 UINT Flags; // [in] 219 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; // [in] 220 DXGI_DDI_MODE_DESC ModeDesc; // [in] 221 UINT DriverFlags; // [out] Filled by the driver 222 } 223 224 struct DXGI_DDI_ARG_BLT_FLAGS 225 { 226 union 227 { 228 mixin(bitfields!(UINT, "Resolve", 1, 229 UINT, "Convert", 1, 230 UINT, "Stretch", 1, 231 UINT, "Present", 1, 232 UINT, "Reserved", 28)); 233 UINT Value; 234 } 235 } 236 237 struct DXGI_DDI_ARG_BLT 238 { 239 DXGI_DDI_HDEVICE hDevice; //in 240 DXGI_DDI_HRESOURCE hDstResource; //in 241 UINT DstSubresource; //in 242 UINT DstLeft; //in 243 UINT DstTop; //in 244 UINT DstRight; //in 245 UINT DstBottom; //in 246 DXGI_DDI_HRESOURCE hSrcResource; //in 247 UINT SrcSubresource; //in 248 DXGI_DDI_ARG_BLT_FLAGS Flags; //in 249 DXGI_DDI_MODE_ROTATION Rotate; //in 250 } 251 252 struct DXGI_DDI_ARG_RESOLVESHAREDRESOURCE 253 { 254 DXGI_DDI_HDEVICE hDevice; //in 255 DXGI_DDI_HRESOURCE hResource; //in 256 } 257 258 struct DXGI_DDI_ARG_BLT1 259 { 260 DXGI_DDI_HDEVICE hDevice; //in 261 DXGI_DDI_HRESOURCE hDstResource; //in 262 UINT DstSubresource; //in 263 UINT DstLeft; //in 264 UINT DstTop; //in 265 UINT DstRight; //in 266 UINT DstBottom; //in 267 DXGI_DDI_HRESOURCE hSrcResource; //in 268 UINT SrcSubresource; //in 269 UINT SrcLeft; //in 270 UINT SrcTop; //in 271 UINT SrcRight; //in 272 UINT SrcBottom; //in 273 DXGI_DDI_ARG_BLT_FLAGS Flags; //in 274 DXGI_DDI_MODE_ROTATION Rotate; //in 275 } 276 277 struct DXGI_DDI_ARG_OFFERRESOURCES { 278 DXGI_DDI_HDEVICE hDevice; //in: device that created the resources 279 const(DXGI_DDI_HRESOURCE)* pResources; //in: array of resources to reset 280 UINT Resources; //in: number of elements in pResources 281 D3DDDI_OFFER_PRIORITY Priority; //in: priority with which to reset the resources 282 } 283 284 struct DXGI_DDI_ARG_RECLAIMRESOURCES { 285 DXGI_DDI_HDEVICE hDevice; //in: device that created the resources 286 const(DXGI_DDI_HRESOURCE)* pResources; //in: array of resources to reset 287 BOOL* pDiscarded; //out: optional array of booleans specifying whether each resource was discarded 288 UINT Resources; //in: number of elements in pResources and pDiscarded 289 } 290 291 //----------------------------------------------------------------------------------------------------------- 292 // Multi Plane Overlay DDI 293 // 294 295 enum DXGI_DDI_MAX_MULTIPLANE_OVERLAY_ALLOCATIONS = 16; 296 297 struct DXGI_DDI_MULTIPLANE_OVERLAY_CAPS 298 { 299 UINT MaxPlanes; // Total number of planes supported (including the DWM's primary) 300 UINT NumCapabilityGroups; // Number of plane types supported. 301 } 302 303 alias DWORD DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS; 304 enum : DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS 305 { 306 DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS_ROTATION_WITHOUT_INDEPENDENT_FLIP = 0x1, 307 DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS_VERTICAL_FLIP = 0x2, 308 DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS_HORIZONTAL_FLIP = 0x4, 309 DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS_DEINTERLACE = 0x8, 310 DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS_STEREO = 0x10, // D3D10 or above only. 311 DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS_RGB = 0x20, 312 DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS_YUV = 0x40, 313 DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS_BILINEAR_FILTER = 0x80, // Can do bilinear stretching 314 DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS_HIGH_FILTER = 0x100, // Can do better than bilinear stretching 315 DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS_ROTATION = 0x200, 316 } 317 318 alias DWORD DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_CAPS; 319 enum : DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_CAPS 320 { 321 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_CAPS_SEPARATE = 0x1, 322 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_CAPS_ROW_INTERLEAVED = 0x4, 323 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_CAPS_COLUMN_INTERLEAVED = 0x8, 324 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_CAPS_CHECKERBOARD = 0x10, 325 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_CAPS_FLIP_MODE = 0x20, 326 } 327 328 struct DXGI_DDI_MULTIPLANE_OVERLAY_GROUP_CAPS 329 { 330 UINT NumPlanes; 331 float MaxStretchFactor; 332 float MaxShrinkFactor; 333 UINT OverlayCaps; // DXGI_DDI_MULTIPLANE_OVERLAY_FEATURE_CAPS 334 UINT StereoCaps; // DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_CAPS 335 } 336 337 alias DWORD DXGI_DDI_MULTIPLANE_OVERLAY_FLAGS; 338 enum : DXGI_DDI_MULTIPLANE_OVERLAY_FLAGS 339 { 340 DXGI_DDI_MULTIPLANE_OVERLAY_FLAG_VERTICAL_FLIP = 0x1, 341 DXGI_DDI_MULTIPLANE_OVERLAY_FLAG_HORIZONTAL_FLIP = 0x2, 342 } 343 344 alias DWORD DXGI_DDI_MULTIPLANE_OVERLAY_BLEND; 345 enum : DXGI_DDI_MULTIPLANE_OVERLAY_BLEND 346 { 347 DXGI_DDI_MULTIPLANE_OVERLAY_BLEND_OPAQUE = 0x0, 348 DXGI_DDI_MULTIPLANE_OVERLAY_BLEND_ALPHABLEND = 0x1, 349 } 350 351 alias DWORD DXGI_DDI_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT; 352 enum : DXGI_DDI_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT 353 { 354 DXGI_DDI_MULIIPLANE_OVERLAY_VIDEO_FRAME_FORMAT_PROGRESSIVE = 0, 355 DXGI_DDI_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST = 1, 356 DXGI_DDI_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST = 2 357 } 358 359 alias DWORD DXGI_DDI_MULTIPLANE_OVERLAY_YCbCr_FLAGS; 360 enum : DXGI_DDI_MULTIPLANE_OVERLAY_YCbCr_FLAGS 361 { 362 DXGI_DDI_MULTIPLANE_OVERLAY_YCbCr_FLAG_NOMINAL_RANGE = 0x1, // 16 - 235 vs. 0 - 255 363 DXGI_DDI_MULTIPLANE_OVERLAY_YCbCr_FLAG_BT709 = 0x2, // BT.709 vs. BT.601 364 DXGI_DDI_MULTIPLANE_OVERLAY_YCbCr_FLAG_xvYCC = 0x4, // xvYCC vs. conventional YCbCr 365 } 366 367 alias DWORD DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT; 368 enum : DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT 369 { 370 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT_MONO = 0, 371 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT_HORIZONTAL = 1, 372 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT_VERTICAL = 2, 373 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT_SEPARATE = 3, 374 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT_MONO_OFFSET = 4, 375 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT_ROW_INTERLEAVED = 5, 376 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT_COLUMN_INTERLEAVED = 6, 377 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT_CHECKERBOARD = 7 378 } 379 380 alias DWORD DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE; 381 enum : DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE 382 { 383 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FLIP_NONE = 0, 384 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FLIP_FRAME0 = 1, 385 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FLIP_FRAME1 = 2, 386 } 387 388 alias DWORD DXGI_DDI_MULTIPLANE_OVERLAY_STRETCH_QUALITY; 389 enum : DXGI_DDI_MULTIPLANE_OVERLAY_STRETCH_QUALITY 390 { 391 DXGI_DDI_MULTIPLANE_OVERLAY_STRETCH_QUALITY_BILINEAR = 0x1, // Bilinear 392 DXGI_DDI_MULTIPLANE_OVERLAY_STRETCH_QUALITY_HIGH = 0x2, // Maximum 393 } 394 395 struct DXGI_DDI_MULTIPLANE_OVERLAY_ATTRIBUTES 396 { 397 UINT Flags; // DXGI_DDI_MULTIPLANE_OVERLAY_FLAGS 398 RECT SrcRect; 399 RECT DstRect; 400 //#if (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WDDM1_3) // M1 401 RECT ClipRect; 402 //#endif 403 DXGI_DDI_MODE_ROTATION Rotation; 404 DXGI_DDI_MULTIPLANE_OVERLAY_BLEND Blend; 405 //#if (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WDDM1_3) // MP 406 UINT DirtyRectCount; 407 RECT* pDirtyRects; 408 //#else 409 //UINT NumFilters; 410 //void* pFilters; 411 //#endif 412 DXGI_DDI_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT VideoFrameFormat; 413 UINT YCbCrFlags; // DXGI_DDI_MULTIPLANE_OVERLAY_YCbCr_FLAGS 414 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT StereoFormat; 415 BOOL StereoLeftViewFrame0; 416 BOOL StereoBaseViewFrame0; 417 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE StereoFlipMode; 418 //#if (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WDDM1_3) // M1 419 DXGI_DDI_MULTIPLANE_OVERLAY_STRETCH_QUALITY StretchQuality; 420 //#endif 421 } 422 423 struct DXGI_DDI_ARG_GETMULTIPLANEOVERLAYCAPS 424 { 425 DXGI_DDI_HDEVICE hDevice; 426 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 427 DXGI_DDI_MULTIPLANE_OVERLAY_CAPS MultiplaneOverlayCaps; 428 } 429 430 struct DXGI_DDI_ARG_GETMULTIPLANEOVERLAYGROUPCAPS 431 { 432 DXGI_DDI_HDEVICE hDevice; 433 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 434 UINT GroupIndex; 435 DXGI_DDI_MULTIPLANE_OVERLAY_GROUP_CAPS MultiplaneOverlayGroupCaps; 436 } 437 438 struct DXGI_DDI_CHECK_MULTIPLANE_OVERLAY_SUPPORT_PLANE_INFO 439 { 440 DXGI_DDI_HRESOURCE hResource; 441 UINT SubResourceIndex; 442 DXGI_DDI_MULTIPLANE_OVERLAY_ATTRIBUTES PlaneAttributes; 443 } 444 445 struct DXGI_DDI_ARG_CHECKMULTIPLANEOVERLAYSUPPORT 446 { 447 DXGI_DDI_HDEVICE hDevice; 448 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 449 UINT NumPlaneInfo; 450 DXGI_DDI_CHECK_MULTIPLANE_OVERLAY_SUPPORT_PLANE_INFO* pPlaneInfo; 451 BOOL Supported; // out: driver to fill TRUE/FALSE 452 } 453 454 struct DXGI_DDI_PRESENT_MULTIPLANE_OVERLAY 455 { 456 UINT LayerIndex; 457 BOOL Enabled; 458 DXGI_DDI_HRESOURCE hResource; 459 UINT SubResourceIndex; 460 DXGI_DDI_MULTIPLANE_OVERLAY_ATTRIBUTES PlaneAttributes; 461 } 462 463 struct DXGI_DDI_ARG_PRESENTMULTIPLANEOVERLAY 464 { 465 DXGI_DDI_HDEVICE hDevice; 466 void * pDXGIContext; 467 468 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 469 DXGI_DDI_PRESENT_FLAGS Flags; 470 DXGI_DDI_FLIP_INTERVAL_TYPE FlipInterval; 471 472 UINT PresentPlaneCount; 473 DXGI_DDI_PRESENT_MULTIPLANE_OVERLAY* pPresentPlanes; 474 //#if (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WDDM1_3) // M1 475 UINT Reserved; 476 //#endif 477 } 478 479 struct DXGI_DDI_ARG_CHECKPRESENTDURATIONSUPPORT 480 { 481 DXGI_DDI_HDEVICE hDevice; 482 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 483 UINT DesiredPresentDuration; 484 UINT ClosestSmallerDuration; // out 485 UINT ClosestLargerDuration; //out 486 } 487 488 struct DXGI_DDI_ARG_PRESENTSURFACE 489 { 490 DXGI_DDI_HRESOURCE hSurface; // In 491 UINT SubResourceIndex; // Index of surface level 492 } 493 494 struct DXGI_DDI_ARG_PRESENT1 495 { 496 DXGI_DDI_HDEVICE hDevice; //in 497 const(DXGI_DDI_ARG_PRESENTSURFACE)* phSurfacesToPresent; //in 498 UINT SurfacesToPresent; //in 499 DXGI_DDI_HRESOURCE hDstResource; // if non-zero, it's the destination of the present 500 UINT DstSubResourceIndex; // Index of surface level 501 void * pDXGIContext; // opaque: Pass this to the Present callback 502 DXGI_DDI_PRESENT_FLAGS Flags; // Presentation flags. 503 DXGI_DDI_FLIP_INTERVAL_TYPE FlipInterval; // Presentation interval (flip only) 504 UINT Reserved; 505 const(RECT)* pDirtyRects; // in: Array of dirty rects 506 UINT DirtyRects; // in: Number of dirty rects 507 508 //#if (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WDDM2_0) 509 // out: for LDA only. 510 // Only WDDM2.0 drivers should write this value 511 // The number of physical back buffer per logical back buffer. 512 UINT BackBufferMultiplicity; 513 //#endif 514 } 515 516 struct DXGI_DDI_ARG_TRIMRESIDENCYSET 517 { 518 DXGI_DDI_HDEVICE hDevice; 519 D3DDDI_TRIMRESIDENCYSET_FLAGS TrimFlags; 520 UINT64 NumBytesToTrim; 521 } 522 523 struct DXGI_DDI_ARG_CHECKMULTIPLANEOVERLAYCOLORSPACESUPPORT 524 { 525 DXGI_DDI_HDEVICE hDevice; 526 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 527 DXGI_FORMAT Format; 528 D3DDDI_COLOR_SPACE_TYPE ColorSpace; 529 BOOL Supported; // out 530 } 531 532 struct DXGI_DDI_MULTIPLANE_OVERLAY_ATTRIBUTES1 533 { 534 UINT Flags; // DXGI_DDI_MULTIPLANE_OVERLAY_FLAGS 535 RECT SrcRect; 536 RECT DstRect; 537 RECT ClipRect; 538 DXGI_DDI_MODE_ROTATION Rotation; 539 DXGI_DDI_MULTIPLANE_OVERLAY_BLEND Blend; 540 UINT DirtyRectCount; 541 RECT* pDirtyRects; 542 DXGI_DDI_MULTIPLANE_OVERLAY_VIDEO_FRAME_FORMAT VideoFrameFormat; 543 D3DDDI_COLOR_SPACE_TYPE ColorSpace; 544 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FORMAT StereoFormat; 545 BOOL StereoLeftViewFrame0; 546 BOOL StereoBaseViewFrame0; 547 DXGI_DDI_MULTIPLANE_OVERLAY_STEREO_FLIP_MODE StereoFlipMode; 548 DXGI_DDI_MULTIPLANE_OVERLAY_STRETCH_QUALITY StretchQuality; 549 UINT ColorKey; 550 } 551 552 struct DXGI_DDI_PRESENT_MULTIPLANE_OVERLAY1 553 { 554 UINT LayerIndex; 555 BOOL Enabled; 556 DXGI_DDI_HRESOURCE hResource; 557 UINT SubResourceIndex; 558 DXGI_DDI_MULTIPLANE_OVERLAY_ATTRIBUTES1 PlaneAttributes; 559 } 560 561 struct DXGI_DDI_ARG_PRESENTMULTIPLANEOVERLAY1 562 { 563 DXGI_DDI_HDEVICE hDevice; 564 void * pDXGIContext; 565 566 D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId; 567 DXGI_DDI_PRESENT_FLAGS Flags; 568 DXGI_DDI_FLIP_INTERVAL_TYPE FlipInterval; 569 570 UINT PresentPlaneCount; 571 DXGI_DDI_PRESENT_MULTIPLANE_OVERLAY1* pPresentPlanes; 572 } 573 574 //-------------------------------------------------------------------------------------------------------- 575 struct DXGI_DDI_BASE_FUNCTIONS 576 { 577 extern (Windows): 578 HRESULT function(DXGI_DDI_ARG_PRESENT*) pfnPresent; 579 HRESULT function(DXGI_DDI_ARG_GET_GAMMA_CONTROL_CAPS*) pfnGetGammaCaps; 580 HRESULT function(DXGI_DDI_ARG_SETDISPLAYMODE*) pfnSetDisplayMode; 581 HRESULT function(DXGI_DDI_ARG_SETRESOURCEPRIORITY*) pfnSetResourcePriority; 582 HRESULT function(DXGI_DDI_ARG_QUERYRESOURCERESIDENCY*) pfnQueryResourceResidency; 583 HRESULT function(DXGI_DDI_ARG_ROTATE_RESOURCE_IDENTITIES*) pfnRotateResourceIdentities; 584 HRESULT function(DXGI_DDI_ARG_BLT*) pfnBlt; 585 } 586 587 //-------------------------------------------------------------------------------------------------------- 588 struct DXGI1_1_DDI_BASE_FUNCTIONS 589 { 590 extern (Windows): 591 HRESULT function(DXGI_DDI_ARG_PRESENT*) pfnPresent; 592 HRESULT function(DXGI_DDI_ARG_GET_GAMMA_CONTROL_CAPS*) pfnGetGammaCaps; 593 HRESULT function(DXGI_DDI_ARG_SETDISPLAYMODE*) pfnSetDisplayMode; 594 HRESULT function(DXGI_DDI_ARG_SETRESOURCEPRIORITY*) pfnSetResourcePriority; 595 HRESULT function(DXGI_DDI_ARG_QUERYRESOURCERESIDENCY*) pfnQueryResourceResidency; 596 HRESULT function(DXGI_DDI_ARG_ROTATE_RESOURCE_IDENTITIES*) pfnRotateResourceIdentities; 597 HRESULT function(DXGI_DDI_ARG_BLT*) pfnBlt; 598 HRESULT function(DXGI_DDI_ARG_RESOLVESHAREDRESOURCE*) pfnResolveSharedResource; 599 } 600 601 //-------------------------------------------------------------------------------------------------------- 602 struct DXGI1_2_DDI_BASE_FUNCTIONS 603 { 604 extern (Windows): 605 HRESULT function(DXGI_DDI_ARG_PRESENT*) pfnPresent; 606 HRESULT function(DXGI_DDI_ARG_GET_GAMMA_CONTROL_CAPS*) pfnGetGammaCaps; 607 HRESULT function(DXGI_DDI_ARG_SETDISPLAYMODE*) pfnSetDisplayMode; 608 HRESULT function(DXGI_DDI_ARG_SETRESOURCEPRIORITY*) pfnSetResourcePriority; 609 HRESULT function(DXGI_DDI_ARG_QUERYRESOURCERESIDENCY*) pfnQueryResourceResidency; 610 HRESULT function(DXGI_DDI_ARG_ROTATE_RESOURCE_IDENTITIES*) pfnRotateResourceIdentities; 611 HRESULT function(DXGI_DDI_ARG_BLT*) pfnBlt; 612 HRESULT function(DXGI_DDI_ARG_RESOLVESHAREDRESOURCE*) pfnResolveSharedResource; 613 HRESULT function(DXGI_DDI_ARG_BLT1*) pfnBlt1; 614 HRESULT function(DXGI_DDI_ARG_OFFERRESOURCES*) pfnOfferResources; 615 HRESULT function(DXGI_DDI_ARG_RECLAIMRESOURCES*) pfnReclaimResources; 616 // Use IS_DXGI_MULTIPLANE_OVERLAY_FUNCTIONS macro to determine these functions fields are available 617 HRESULT function(DXGI_DDI_ARG_GETMULTIPLANEOVERLAYCAPS*) pfnGetMultiplaneOverlayCaps; 618 HRESULT function(void*) pfnGetMultiplaneOverlayFilterRange; 619 HRESULT function(DXGI_DDI_ARG_CHECKMULTIPLANEOVERLAYSUPPORT*) pfnCheckMultiplaneOverlaySupport; 620 HRESULT function(DXGI_DDI_ARG_PRESENTMULTIPLANEOVERLAY*) pfnPresentMultiplaneOverlay; 621 } 622 623 //-------------------------------------------------------------------------------------------------------- 624 struct DXGI1_3_DDI_BASE_FUNCTIONS 625 { 626 extern (Windows): 627 HRESULT function(DXGI_DDI_ARG_PRESENT*) pfnPresent; 628 HRESULT function(DXGI_DDI_ARG_GET_GAMMA_CONTROL_CAPS*) pfnGetGammaCaps; 629 HRESULT function(DXGI_DDI_ARG_SETDISPLAYMODE*) pfnSetDisplayMode; 630 HRESULT function(DXGI_DDI_ARG_SETRESOURCEPRIORITY*) pfnSetResourcePriority; 631 HRESULT function(DXGI_DDI_ARG_QUERYRESOURCERESIDENCY*) pfnQueryResourceResidency; 632 HRESULT function(DXGI_DDI_ARG_ROTATE_RESOURCE_IDENTITIES*) pfnRotateResourceIdentities; 633 HRESULT function(DXGI_DDI_ARG_BLT*) pfnBlt; 634 HRESULT function(DXGI_DDI_ARG_RESOLVESHAREDRESOURCE*) pfnResolveSharedResource; 635 HRESULT function(DXGI_DDI_ARG_BLT1*) pfnBlt1; 636 HRESULT function(DXGI_DDI_ARG_OFFERRESOURCES*) pfnOfferResources; 637 HRESULT function(DXGI_DDI_ARG_RECLAIMRESOURCES*) pfnReclaimResources; 638 HRESULT function(DXGI_DDI_ARG_GETMULTIPLANEOVERLAYCAPS*) pfnGetMultiplaneOverlayCaps; 639 HRESULT function(DXGI_DDI_ARG_GETMULTIPLANEOVERLAYGROUPCAPS*) pfnGetMultiplaneOverlayGroupCaps; 640 HRESULT function(void*) pfnReserved1; 641 HRESULT function(DXGI_DDI_ARG_PRESENTMULTIPLANEOVERLAY*) pfnPresentMultiplaneOverlay; 642 HRESULT function(void*) pfnReserved2; 643 HRESULT function(DXGI_DDI_ARG_PRESENT1*) pfnPresent1; 644 HRESULT function(DXGI_DDI_ARG_CHECKPRESENTDURATIONSUPPORT*) pfnCheckPresentDurationSupport; 645 } 646 647 //-------------------------------------------------------------------------------------------------------- 648 struct DXGI1_4_DDI_BASE_FUNCTIONS 649 { 650 extern (Windows): 651 HRESULT function(DXGI_DDI_ARG_PRESENT*) pfnPresent; 652 HRESULT function(DXGI_DDI_ARG_GET_GAMMA_CONTROL_CAPS*) pfnGetGammaCaps; 653 HRESULT function(DXGI_DDI_ARG_SETDISPLAYMODE*) pfnSetDisplayMode; 654 HRESULT function(DXGI_DDI_ARG_SETRESOURCEPRIORITY*) pfnSetResourcePriority; 655 HRESULT function(DXGI_DDI_ARG_QUERYRESOURCERESIDENCY*) pfnQueryResourceResidency; 656 HRESULT function(DXGI_DDI_ARG_ROTATE_RESOURCE_IDENTITIES*) pfnRotateResourceIdentities; 657 HRESULT function(DXGI_DDI_ARG_BLT*) pfnBlt; 658 HRESULT function(DXGI_DDI_ARG_RESOLVESHAREDRESOURCE*) pfnResolveSharedResource; 659 HRESULT function(DXGI_DDI_ARG_BLT1*) pfnBlt1; 660 HRESULT function(DXGI_DDI_ARG_OFFERRESOURCES*) pfnOfferResources; 661 HRESULT function(DXGI_DDI_ARG_RECLAIMRESOURCES*) pfnReclaimResources; 662 HRESULT function(DXGI_DDI_ARG_GETMULTIPLANEOVERLAYCAPS*) pfnGetMultiplaneOverlayCaps; 663 HRESULT function(DXGI_DDI_ARG_GETMULTIPLANEOVERLAYGROUPCAPS*) pfnGetMultiplaneOverlayGroupCaps; 664 HRESULT function(void*) pfnReserved1; 665 HRESULT function(DXGI_DDI_ARG_PRESENTMULTIPLANEOVERLAY*) pfnPresentMultiplaneOverlay; 666 HRESULT function(void*) pfnReserved2; 667 HRESULT function(DXGI_DDI_ARG_PRESENT1*) pfnPresent1; 668 HRESULT function(DXGI_DDI_ARG_CHECKPRESENTDURATIONSUPPORT*) pfnCheckPresentDurationSupport; 669 HRESULT function(DXGI_DDI_ARG_TRIMRESIDENCYSET*) pfnTrimResidencySet; 670 HRESULT function(DXGI_DDI_ARG_CHECKMULTIPLANEOVERLAYCOLORSPACESUPPORT*) pfnCheckMultiplaneOverlayColorSpaceSupport; 671 HRESULT function(DXGI_DDI_ARG_PRESENTMULTIPLANEOVERLAY1*) pfnPresentMultiplaneOverlay1; 672 } 673 674 //======================================================================================================== 675 // DXGI callback definitions. 676 // 677 678 //-------------------------------------------------------------------------------------------------------- 679 struct DXGIDDICB_PRESENT 680 { 681 D3DKMT_HANDLE hSrcAllocation; // in: The allocation of which content will be presented 682 D3DKMT_HANDLE hDstAllocation; // in: if non-zero, it's the destination allocation of the present 683 void * pDXGIContext; // opaque: Fill this with the value in DXGI_DDI_ARG_PRESENT.pDXGIContext 684 HANDLE hContext; // in: Context being submitted to. 685 UINT BroadcastContextCount; // in: Specifies the number of context 686 // to broadcast this present operation to. 687 // Only supported for flip operation. 688 HANDLE[D3DDDI_MAX_BROADCAST_CONTEXT] BroadcastContext; // in: Specifies the handle of the context to 689 // broadcast to. 690 D3DKMT_HANDLE* BroadcastSrcAllocation; // in: LDA 691 D3DKMT_HANDLE* BroadcastDstAllocation; // in: LDA 692 UINT PrivateDriverDataSize; // in: 693 PVOID pPrivateDriverData; // in: Private driver data to pass to DdiPresent and DdiSetVidPnSourceAddress 694 BOOLEAN bOptimizeForComposition; // out: DWM is involved in composition 695 } 696 697 struct DXGIDDI_MULTIPLANE_OVERLAY_ALLOCATION_INFO 698 { 699 D3DKMT_HANDLE PresentAllocation; 700 UINT SubResourceIndex; 701 } 702 703 struct DXGIDDICB_PRESENT_MULTIPLANE_OVERLAY 704 { 705 void * pDXGIContext; // opaque: Fill this with the value in DXGI_DDI_ARG_PRESENT.pDXGIContext 706 HANDLE hContext; 707 708 UINT BroadcastContextCount; 709 HANDLE[D3DDDI_MAX_BROADCAST_CONTEXT] BroadcastContext; 710 711 DWORD AllocationInfoCount; 712 DXGIDDI_MULTIPLANE_OVERLAY_ALLOCATION_INFO[DXGI_DDI_MAX_MULTIPLANE_OVERLAY_ALLOCATIONS] AllocationInfo; 713 } 714 715 extern (Windows) { 716 alias HRESULT function(HANDLE hDevice, DXGIDDICB_PRESENT*) PFNDDXGIDDI_PRESENTCB; 717 718 alias HRESULT function(HANDLE hDevice, const(DXGIDDICB_PRESENT_MULTIPLANE_OVERLAY)*) PFNDDXGIDDI_PRESENT_MULTIPLANE_OVERLAYCB; 719 } 720 721 //-------------------------------------------------------------------------------------------------------- 722 struct DXGI_DDI_BASE_CALLBACKS 723 { 724 PFNDDXGIDDI_PRESENTCB pfnPresentCb; 725 //#if (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WIN8) 726 // Use IS_DXGI_MULTIPLANE_OVERLAY_FUNCTIONS macro to check if field is available. 727 PFNDDXGIDDI_PRESENT_MULTIPLANE_OVERLAYCB pfnPresentMultiplaneOverlayCb; 728 //#endif // (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WIN8) 729 } 730 731 //======================================================================================================== 732 // DXGI basic DDI device creation arguments 733 734 struct DXGI_DDI_BASE_ARGS 735 { 736 DXGI_DDI_BASE_CALLBACKS *pDXGIBaseCallbacks; // in: The driver should record this pointer for later use 737 union 738 { 739 //#if (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WDDM2_0) 740 DXGI1_4_DDI_BASE_FUNCTIONS *pDXGIDDIBaseFunctions5; // in/out: The driver should fill the denoted struct with DXGI base driver entry points 741 //#endif 742 //#if (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WDDM1_3) // M1 743 DXGI1_3_DDI_BASE_FUNCTIONS *pDXGIDDIBaseFunctions4; // in/out: The driver should fill the denoted struct with DXGI base driver entry points 744 //#endif 745 //#if (D3D_UMD_INTERFACE_VERSION >= D3D_UMD_INTERFACE_VERSION_WIN8) 746 DXGI1_2_DDI_BASE_FUNCTIONS *pDXGIDDIBaseFunctions3; // in/out: The driver should fill the denoted struct with DXGI base driver entry points 747 //#endif 748 DXGI1_1_DDI_BASE_FUNCTIONS *pDXGIDDIBaseFunctions2; // in/out: The driver should fill the denoted struct with DXGI base driver entry points 749 DXGI_DDI_BASE_FUNCTIONS *pDXGIDDIBaseFunctions; // in/out: The driver should fill the denoted struct with DXGI base driver entry points 750 } 751 }