1 module aurora.directx.dxgi.dxgi1_2;
2 
3 version(Windows):
4 
5 import aurora.directx.com;
6 public import aurora.directx.dxgi.dxgitype;
7 public import aurora.directx.dxgi.dxgicommon;
8 public import aurora.directx.dxgi.dxgiformat;
9 public import aurora.directx.dxgi.dxgi;
10 
11 public:
12 
13 //
14 //	Constants
15 //
16 
17 //DXGI_ENUM_MODES
18 enum DXGI_ENUM_MODES_STEREO          = (4U);
19 enum DXGI_ENUM_MODES_DISABLED_STEREO = (8U);
20 
21 //DXGI_PRESENT
22 enum DXGI_PRESENT_DO_NOT_WAIT           = (0x00000008U);
23 enum DXGI_PRESENT_STEREO_PREFER_RIGHT   = (0x00000010U);
24 enum DXGI_PRESENT_STEREO_TEMPORARY_MONO = (0x00000020U);
25 enum DXGI_PRESENT_RESTRICT_TO_OUTPUT    = (0x00000040U);
26 
27 //
28 //	Enumerations
29 //
30 
31 public enum DXGI_ALPHA_MODE : int { 
32 	UNSPECIFIED    = 0,
33 	PREMULTIPLIED  = 1,
34 	STRAIGHT       = 2,
35 	IGNORE         = 3,
36 	FORCE_DWORD    = 0xffffffff
37 }
38 
39 public enum DXGI_COMPUTE_PREEMPTION_GRANULARITY : int { 
40 	DMA_BUFFER_BOUNDARY    = 0,
41 	DISPATCH_BOUNDARY      = 1,
42 	THREAD_GROUP_BOUNDARY  = 2,
43 	THREAD_BOUNDARY        = 3,
44 	INSTRUCTION_BOUNDARY   = 4
45 }
46 
47 public enum DXGI_DEBUG_RLO_FLAGS : int { 
48 	SUMMARY  = 0x1,
49 	DETAIL   = 0x2,
50 	ALL      = 0x3
51 }
52 
53 public enum DXGI_GRAPHICS_PREEMPTION_GRANULARITY : int { 
54 	DMA_BUFFER_BOUNDARY   = 0,
55 	PRIMITIVE_BOUNDARY    = 1,
56 	TRIANGLE_BOUNDARY     = 2,
57 	PIXEL_BOUNDARY        = 3,
58 	INSTRUCTION_BOUNDARY  = 4
59 }
60 
61 public enum DXGI_INFO_QUEUE_MESSAGE_CATEGORY : int { 
62 	UNKNOWN                = 0,
63 	MISCELLANEOUS          = ( UNKNOWN + 1 ),
64 	INITIALIZATION         = ( MISCELLANEOUS + 1 ),
65 	CLEANUP                = ( INITIALIZATION + 1 ),
66 	COMPILATION            = ( CLEANUP + 1 ),
67 	STATE_CREATION         = ( COMPILATION + 1 ),
68 	STATE_SETTING          = ( STATE_CREATION + 1 ),
69 	STATE_GETTING          = ( STATE_SETTING + 1 ),
70 	RESOURCE_MANIPULATION  = ( STATE_GETTING + 1 ),
71 	EXECUTION              = ( RESOURCE_MANIPULATION + 1 ),
72 	SHADER                 = ( EXECUTION + 1 )
73 }
74 
75 public enum DXGI_INFO_QUEUE_MESSAGE_SEVERITY : int { 
76 	CORRUPTION  = 0,
77 	ERROR       = ( CORRUPTION + 1 ),
78 	WARNING     = ( ERROR + 1 ),
79 	INFO        = ( WARNING + 1 ),
80 	MESSAGE     = ( INFO + 1 )
81 }
82 
83 public enum DXGI_OFFER_RESOURCE_PRIORITY : int { 
84 	LOW     = 1,
85 	NORMAL  = ( LOW + 1 ),
86 	HIGH    = ( NORMAL + 1 )
87 }
88 
89 public enum DXGI_OUTDUPL_POINTER_SHAPE_TYPE : int { 
90 	MONOCHROME    = 0x1,
91 	COLOR         = 0x2,
92 	MASKED_COLOR  = 0x4
93 }
94 
95 public enum DXGI_SCALING : int { 
96 	STRETCH               = 0,
97 	NONE                  = 1,
98 	ASPECT_RATIO_STRETCH  = 2
99 }
100 
101 //
102 //	Structures
103 //
104 
105 public struct DXGI_ADAPTER_DESC2 {
106 	wchar[128] Description;
107 	uint VendorId;
108 	uint DeviceId;
109 	uint SubSysId;
110 	uint Revision;
111 	size_t DedicatedVideoMemory;
112 	size_t DedicatedSystemMemory;
113 	size_t SharedSystemMemory;
114 	LUID AdapterLuid;
115 	uint Flags;
116 	DXGI_GRAPHICS_PREEMPTION_GRANULARITY GraphicsPreemptionGranularity;
117 	DXGI_COMPUTE_PREEMPTION_GRANULARITY  ComputePreemptionGranularity;
118 }
119 
120 
121 public struct DXGI_INFO_QUEUE_FILTER {
122 	DXGI_INFO_QUEUE_FILTER_DESC AllowList;
123 	DXGI_INFO_QUEUE_FILTER_DESC DenyList;
124 }
125 
126 alias int DXGI_INFO_QUEUE_MESSAGE_ID;
127 public struct DXGI_INFO_QUEUE_FILTER_DESC {
128 	uint                              NumCategories;
129 	DXGI_INFO_QUEUE_MESSAGE_CATEGORY *pCategoryList;
130 	uint                              NumSeverities;
131 	DXGI_INFO_QUEUE_MESSAGE_SEVERITY *pSeverityList;
132 	uint                              NumIDs;
133 	DXGI_INFO_QUEUE_MESSAGE_ID       *pIDList;
134 }
135 
136 public struct DXGI_INFO_QUEUE_MESSAGE {
137 	GUID                             Producer;
138 	DXGI_INFO_QUEUE_MESSAGE_CATEGORY Category;
139 	DXGI_INFO_QUEUE_MESSAGE_SEVERITY Severity;
140 	DXGI_INFO_QUEUE_MESSAGE_ID       ID;
141 	const char                       *pDescription;
142 	size_t                           DescriptionByteLength;
143 }
144 
145 public struct DXGI_MODE_DESC1 {
146 	uint                     Width;
147 	uint                     Height;
148 	DXGI_RATIONAL            RefreshRate;
149 	DXGI_FORMAT              Format;
150 	DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;
151 	DXGI_MODE_SCALING        Scaling;
152 	BOOL                     Stereo;
153 }
154 
155 public struct DXGI_OUTDUPL_FRAME_INFO {
156 	LARGE_INTEGER                 LastPresentTime;
157 	LARGE_INTEGER                 LastMouseUpdateTime;
158 	uint                          AccumulatedFrames;
159 	BOOL                          RectsCoalesced;
160 	BOOL                          ProtectedContentMaskedOut;
161 	DXGI_OUTDUPL_POINTER_POSITION PointerPosition;
162 	uint                          TotalMetadataBufferSize;
163 	uint                          PointerShapeBufferSize;
164 }
165 
166 public struct DXGI_OUTDUPL_MOVE_RECT {
167 	POINT SourcePoint;
168 	RECT  DestinationRect;
169 }
170 
171 public struct DXGI_OUTDUPL_POINTER_POSITION {
172 	POINT Position;
173 	BOOL  Visible;
174 }
175 
176 public struct DXGI_OUTDUPL_POINTER_SHAPE_INFO {
177 	uint Type;
178 	uint Width;
179 	uint Height;
180 	uint Pitch;
181 	POINT HotSpot;
182 }
183 
184 public struct DXGI_PRESENT_PARAMETERS {
185 	uint DirtyRectsCount;
186 	RECT *pDirtyRects;
187 	RECT *pScrollRect;
188 	POINT *pScrollOffset;
189 }
190 
191 public struct DXGI_SWAP_CHAIN_DESC1 {
192 	uint             Width;
193 	uint             Height;
194 	DXGI_FORMAT      Format;
195 	BOOL             Stereo;
196 	DXGI_SAMPLE_DESC SampleDesc;
197 	uint       BufferUsage;
198 	uint             BufferCount;
199 	DXGI_SCALING     Scaling;
200 	DXGI_SWAP_EFFECT SwapEffect;
201 	DXGI_ALPHA_MODE  AlphaMode;
202 	uint             Flags;
203 }
204 
205 public struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC {
206 	DXGI_RATIONAL            RefreshRate;
207 	DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;
208 	DXGI_MODE_SCALING        Scaling;
209 	BOOL                     Windowed;
210 }
211 
212 //
213 //	Interfaces
214 //
215 
216 mixin(uuid!(IDXGIAdapter2, "0AA1AE0A-FA0E-4B84-8644-E05FF8E5ACB5"));
217 interface IDXGIAdapter2 : IDXGIAdapter1
218 {
219 extern(Windows):
220 	HRESULT GetDesc2(DXGI_ADAPTER_DESC2 *Desc);
221 }
222 
223 mixin(uuid!(IDXGIDebug, "119E7452-DE9E-40fe-8806-88F90C12B441"));
224 interface IDXGIDebug : IUnknown
225 {
226 extern(Windows):
227 	HRESULT ReportLiveObjects(GUID APIID, DXGI_DEBUG_RLO_FLAGS Flags);
228 }
229 
230 mixin(uuid!(IDXGIDevice2, "05008617-fbfd-4051-a790-144884b4f6a9"));
231 interface IDXGIDevice2 : IDXGIDevice1
232 {
233 extern(Windows):
234 	HRESULT EnqueueSetEvent(HANDLE Event);
235 	HRESULT OfferResources(uint NumResources, const(IDXGIResource) *Resources, DXGI_OFFER_RESOURCE_PRIORITY Priority);
236 	HRESULT ReclaimResources(uint NumResources, const(IDXGIResource) *Resources, BOOL *Discarded);
237 }
238 
239 mixin(uuid!(IDXGIDisplayControl, "ea9dbf1a-c88e-4486-854a-98aa0138f30c"));
240 interface IDXGIDisplayControl : IUnknown
241 {
242 extern(Windows):
243 	BOOL IsStereoEnabled();
244 	void SetStereoEnabled(BOOL Enabled);
245 }
246 
247 mixin(uuid!(IDXGIFactory2, "50c83a1c-e072-4c48-87b0-3630fa36a6d0"));
248 interface IDXGIFactory2 : IDXGIFactory1
249 {
250 extern(Windows):
251 	HRESULT CreateSwapChainForComposition(IUnknown Device, const DXGI_SWAP_CHAIN_DESC1 *Desc, IDXGIOutput RestrictToOutput, IDXGISwapChain1 *SwapChain);
252 	HRESULT CreateSwapChainForCoreWindow(IUnknown Device, IUnknown Window, const DXGI_SWAP_CHAIN_DESC1 *Desc, IDXGIOutput RestrictToOutput, IDXGISwapChain1 *SwapChain);
253 	HRESULT CreateSwapChainForHwnd(IUnknown Device, HWND hWnd, const DXGI_SWAP_CHAIN_DESC1 *Desc, const DXGI_SWAP_CHAIN_FULLSCREEN_DESC *FullscreenDesc, IDXGIOutput RestrictToOutput, IDXGISwapChain1 *SwapChain);
254 	HRESULT GetSharedResourceAdapterLuid(HANDLE Resource, LUID *Luid);
255 	BOOL IsWindowedStereoEnabled();
256 	HRESULT RegisterOcclusionStatusEvent(HANDLE Event, DWORD *Cookie);
257 	HRESULT RegisterOcclusionStatusWindow(HWND WindowHandle, uint Msg, DWORD *Cookie);
258 	HRESULT RegisterStereoStatusEvent(HANDLE Event, DWORD *Cookie);
259 	HRESULT RegisterStereoStatusWindow(HWND WindowHandle, uint Msg, DWORD *Cookie);
260 	void UnregisterOcclusionStatus(DWORD Cookie);
261 	void UnregisterStereoStatus(DWORD Cookie);
262 }
263 
264 mixin(uuid!(IDXGIInfoQueue, "D67441C7-672A-476f-9E82-CD55B44949CE"));
265 interface IDXGIInfoQueue : IUnknown
266 {
267 extern(Windows):
268 	HRESULT AddApplicationMessage(DXGI_INFO_QUEUE_MESSAGE_SEVERITY Severity, const(char)* Description);
269 	HRESULT AddMessage(GUID Producer, DXGI_INFO_QUEUE_MESSAGE_CATEGORY Category, DXGI_INFO_QUEUE_MESSAGE_SEVERITY Severity, DXGI_INFO_QUEUE_MESSAGE_ID ID, const(char)* Description);
270 	HRESULT AddRetrievalFilterEntries(GUID Producer, DXGI_INFO_QUEUE_FILTER *Filter);
271 	HRESULT AddStorageFilterEntries(GUID Producer, DXGI_INFO_QUEUE_FILTER *Filter);
272 	void ClearRetrievalFilter(GUID Producer);
273 	void ClearStorageFilter(GUID Producer);
274 	void ClearStoredMessages(GUID Producer);
275 	BOOL GetBreakOnCategory(GUID Producer, DXGI_INFO_QUEUE_MESSAGE_CATEGORY Category);
276 	BOOL GetBreakOnID(GUID Producer, DXGI_INFO_QUEUE_MESSAGE_ID ID);
277 	BOOL GetBreakOnSeverity(GUID Producer, DXGI_INFO_QUEUE_MESSAGE_SEVERITY Severity);
278 	HRESULT GetMessage(GUID Producer, ulong MessageIndex, DXGI_INFO_QUEUE_MESSAGE *Message, size_t *MessageByteLength);
279 	ulong GetMessageCountLimit(GUID Producer);
280 	BOOL GetMuteDebugOutput(GUID Producer);
281 	ulong GetNumMessagesAllowedByStorageFilter(GUID Producer);
282 	ulong GetNumMessagesDeniedByStorageFilter(GUID Producer);
283 	ulong GetNumMessagesDiscardedByMessageCountLimit(GUID Producer);
284 	ulong GetNumStoredMessages(GUID Producer);
285 	ulong GetNumStoredMessagesAllowedByRetrievalFilters(GUID Producer);
286 	HRESULT GetRetrievalFilter(GUID Producer, DXGI_INFO_QUEUE_FILTER *Filter, size_t *FilterByteLength);
287 	uint GetRetrievalFilterStackSize(GUID Producer);
288 	HRESULT GetStorageFilter(GUID Producer, DXGI_INFO_QUEUE_FILTER *Filter, size_t *FilterByteLength);
289 	uint GetStorageFilterStackSize(GUID Producer);
290 	void PopRetrievalFilter(GUID Producer);
291 	void PopStorageFilter(GUID Producer);
292 	HRESULT PushCopyOfRetrievalFilter(GUID Producer);
293 	HRESULT PushCopyOfStorageFilter(GUID Producer);
294 	HRESULT PushDenyAllRetrievalFilter(GUID Producer);
295 	HRESULT PushDenyAllStorageFilter(GUID Producer);
296 	HRESULT PushEmptyRetrievalFilter(GUID Producer);
297 	HRESULT PushEmptyStorageFilter(GUID Producer);
298 	HRESULT PushRetrievalFilter(GUID Producer, DXGI_INFO_QUEUE_FILTER *Filter);
299 	HRESULT PushStorageFilter(GUID Producer, DXGI_INFO_QUEUE_FILTER *Filter);
300 	HRESULT SetBreakOnCategory(GUID Producer, DXGI_INFO_QUEUE_MESSAGE_CATEGORY Category, BOOL Enable);
301 	HRESULT SetBreakOnID(GUID Producer, DXGI_INFO_QUEUE_MESSAGE_ID ID, BOOL Enable);
302 	HRESULT SetBreakOnSeverity(GUID Producer, DXGI_INFO_QUEUE_MESSAGE_SEVERITY Severity, BOOL Enable);
303 	HRESULT SetMessageCountLimit(GUID Producer, ulong MessageCountLimit);
304 	HRESULT SetMuteDebugOutput(GUID Producer, BOOL Mute);
305 }
306 
307 mixin(uuid!(IDXGIOutput1, "00cddea8-939b-4b83-a340-a685226666cc"));
308 interface IDXGIOutput1 : IDXGIOutput
309 {
310 extern(Windows):
311 	HRESULT DuplicateOutput(IUnknown Device, IDXGIOutputDuplication *OutputDuplication);
312 	HRESULT FindClosestMatchingMode1(const DXGI_MODE_DESC1 *ModeToMatch, DXGI_MODE_DESC1 *ClosestMatch, IUnknown ConcernedDevice);
313 	HRESULT GetDisplayModeList1(DXGI_FORMAT EnumFormat, uint Flags, uint *NumModes, DXGI_MODE_DESC1 *Desc);
314 	HRESULT GetDisplaySurfaceData1(IDXGIResource Destination);
315 }
316 
317 mixin(uuid!(IDXGIOutputDuplication, "191cfac3-a341-470d-b26e-a864f428319c"));
318 interface IDXGIOutputDuplication : IDXGIObject
319 {
320 extern(Windows):
321 	HRESULT AcquireNextFrame(uint TimeoutInMilliseconds, DXGI_OUTDUPL_FRAME_INFO *FrameInfo, IDXGIResource *DesktopResource);
322 	void GetDesc(DXGI_OUTDUPL_DESC *pDesc);
323 	HRESULT GetFrameDirtyRects(uint DirtyRectsBufferSize, RECT *DirtyRectsBuffer, uint *DirtyRectsBufferSizeRequired);
324 	HRESULT GetFrameMoveRects(uint MoveRectsBufferSize, DXGI_OUTDUPL_MOVE_RECT *MoveRectBuffer, uint *MoveRectsBufferSizeRequired);
325 	HRESULT GetFramePointerShape(uint PointerShapeBufferSize, void *PointerShapeBuffer, uint *PointerShapeBufferSizeRequired, DXGI_OUTDUPL_POINTER_SHAPE_INFO *PointerShapeInfo);
326 	HRESULT MapDesktopSurface(DXGI_MAPPED_RECT *LockedRect);
327 	HRESULT ReleaseFrame();
328 	HRESULT UnMapDesktopSurface();
329 }
330 
331 mixin(uuid!(IDXGIResource1, "035f3ab4-482e-4e50-b41f-8a7f8bd8960b"));
332 interface IDXGIResource1 : IDXGIResource
333 {
334 extern(Windows):
335 	HRESULT CreateSharedHandle(const SECURITY_ATTRIBUTES *Attributes, DWORD Access, const(wchar)* Name, HANDLE *Handle);
336 	HRESULT CreateSubresourceSurface(uint Index, IDXGISurface2 *Surface);
337 }
338 
339 mixin(uuid!(IDXGISurface2, "aba496dd-b617-4cb8-a866-bc44d7eb1fa2"));
340 interface IDXGISurface2 : IDXGISurface1
341 {
342 extern(Windows):
343 	HRESULT GetResource(GUID* RIID, void **ParentResource, uint *SubresourceIndex);
344 }
345 
346 mixin(uuid!(IDXGISwapChain1, "790a45f7-0d42-4876-983a-0a55cfe6f4aa"));
347 interface IDXGISwapChain1 : IDXGISwapChain
348 {
349 extern(Windows):
350 	HRESULT GetBackgroundColor(DXGI_RGBA *Color);
351 	HRESULT GetCoreWindow(GUID **RefIID, void **ppUnk);
352 	HRESULT GetDesc1(DXGI_SWAP_CHAIN_DESC1 *Desc);
353 	HRESULT GetFullscreenDesc(DXGI_SWAP_CHAIN_FULLSCREEN_DESC *Desc);
354 	HRESULT GetHwnd(HWND *Hwnd);
355 	HRESULT GetRestrictToOutput(IDXGIOutput *RestrictToOutput);
356 	HRESULT GetRotation(DXGI_MODE_ROTATION *Rotation);
357 	BOOL IsTemporaryMonoSupported();
358 	HRESULT Present1(uint SyncInterval, uint Flags, const DXGI_PRESENT_PARAMETERS *pPresentParameters);
359 	HRESULT SetBackgroundColor(const DXGI_RGBA *Color);
360 	HRESULT SetRotation(const DXGI_MODE_ROTATION Rotation);
361 }