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