1 module directx.dxgi1_2;
2 
3 version(Windows):
4 
5 public import directx.dxgi;
6 	
7 mixin( uuid!(IDXGIDisplayControl, "ea9dbf1a-c88e-4486-854a-98aa0138f30c") );
8 extern (C++) interface IDXGIDisplayControl : IUnknown
9 {
10     BOOL IsStereoEnabled();
11 
12 	void SetStereoEnabled( 
13             BOOL enabled);
14 }
15 
16 struct DXGI_OUTDUPL_MOVE_RECT
17 {
18 	POINT SourcePoint;
19 	RECT DestinationRect;
20 }
21 
22 struct DXGI_OUTDUPL_DESC
23 {
24 	DXGI_MODE_DESC ModeDesc;
25 	DXGI_MODE_ROTATION Rotation;
26 	BOOL DesktopImageInSystemMemory;
27 }
28 
29 struct DXGI_OUTDUPL_POINTER_POSITION
30 {
31 	POINT Position;
32 	BOOL Visible;
33 }
34 
35 alias DXGI_OUTDUPL_POINTER_SHAPE_TYPE = int;
36 enum : DXGI_OUTDUPL_POINTER_SHAPE_TYPE
37 {
38 	DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MONOCHROME	= 0x1,
39 	DXGI_OUTDUPL_POINTER_SHAPE_TYPE_COLOR	= 0x2,
40 	DXGI_OUTDUPL_POINTER_SHAPE_TYPE_MASKED_COLOR	= 0x4
41 }
42 
43 struct DXGI_OUTDUPL_POINTER_SHAPE_INFO
44 {
45 	UINT Type;
46 	UINT Width;
47 	UINT Height;
48 	UINT Pitch;
49 	POINT HotSpot;
50 }
51 
52 struct DXGI_OUTDUPL_FRAME_INFO
53 {
54 	LARGE_INTEGER LastPresentTime;
55 	LARGE_INTEGER LastMouseUpdateTime;
56 	UINT AccumulatedFrames;
57 	BOOL RectsCoalesced;
58 	BOOL ProtectedContentMaskedOut;
59 	DXGI_OUTDUPL_POINTER_POSITION PointerPosition;
60 	UINT TotalMetadataBufferSize;
61 	UINT PointerShapeBufferSize;
62 }
63 
64 mixin( uuid!(IDXGIOutputDuplication, "191cfac3-a341-470d-b26e-a864f428319c") );
65 extern (C++) interface IDXGIOutputDuplication : IDXGIObject
66 {
67 	void GetDesc( 
68             /*out*/ DXGI_OUTDUPL_DESC* pDesc);
69 
70 	HRESULT AcquireNextFrame( 
71             UINT TimeoutInMilliseconds,
72             /*out*/ DXGI_OUTDUPL_FRAME_INFO* pFrameInfo,
73             /*out*/IDXGIResource* ppDesktopResource);
74 
75 	HRESULT GetFrameDirtyRects( 
76             UINT DirtyRectsBufferSize,
77             /*out*/ RECT* pDirtyRectsBuffer,
78             /*out*/ UINT* pDirtyRectsBufferSizeRequired);
79 
80 	HRESULT GetFrameMoveRects( 
81             UINT MoveRectsBufferSize,
82             /*out*/ DXGI_OUTDUPL_MOVE_RECT* pMoveRectBuffer,
83             /*out*/ UINT* pMoveRectsBufferSizeRequired);
84 
85 	HRESULT GetFramePointerShape( 
86             UINT PointerShapeBufferSize,
87             /*out*/ void* pPointerShapeBuffer,
88             /*out*/ UINT* pPointerShapeBufferSizeRequired,
89             /*out*/ DXGI_OUTDUPL_POINTER_SHAPE_INFO* pPointerShapeInfo);
90 
91 	HRESULT MapDesktopSurface( 
92             /*out*/ DXGI_MAPPED_RECT* pLockedRect);
93 
94 	HRESULT UnMapDesktopSurface();
95 
96 	HRESULT ReleaseFrame();
97 }
98 
99 alias DXGI_ALPHA_MODE = int;
100 enum : DXGI_ALPHA_MODE
101 {
102 	DXGI_ALPHA_MODE_UNSPECIFIED	= 0,
103 	DXGI_ALPHA_MODE_PREMULTIPLIED	= 1,
104 	DXGI_ALPHA_MODE_STRAIGHT	= 2,
105 	DXGI_ALPHA_MODE_IGNORE	= 3,
106 	DXGI_ALPHA_MODE_FORCE_DWORD	= 0xffffffff
107 }
108 
109 mixin( uuid!(IDXGISurface2, "aba496dd-b617-4cb8-a866-bc44d7eb1fa2") );
110 extern (C++) interface IDXGISurface2 : IDXGISurface1
111 {
112 	HRESULT GetResource( 
113             REFIID riid,
114             /*out*/ void** ppParentResource,
115             /*out*/ UINT* pSubresourceIndex);
116 }
117 
118 mixin( uuid!(IDXGIResource1, "30961379-4609-4a41-998e-54fe567ee0c1") );
119 extern (C++) interface IDXGIResource1 : IDXGIResource
120 {
121 	HRESULT CreateSubresourceSurface( 
122             UINT index,
123             /*out*/ IDXGISurface2* ppSurface);
124 
125 	HRESULT CreateSharedHandle( 
126             const(SECURITY_ATTRIBUTES)* pAttributes,
127             DWORD dwAccess,
128             LPCWSTR lpName,
129             /*out*/ HANDLE* pHandle);
130 }
131 
132 alias DXGI_OFFER_RESOURCE_PRIORITY = int;
133 enum : DXGI_OFFER_RESOURCE_PRIORITY
134 {
135 	DXGI_OFFER_RESOURCE_PRIORITY_LOW	= 1,
136 	DXGI_OFFER_RESOURCE_PRIORITY_NORMAL	= ( DXGI_OFFER_RESOURCE_PRIORITY_LOW + 1 ) ,
137 	DXGI_OFFER_RESOURCE_PRIORITY_HIGH	= ( DXGI_OFFER_RESOURCE_PRIORITY_NORMAL + 1 ) 
138 }
139 
140 mixin( uuid!(IDXGIDevice2, "05008617-fbfd-4051-a790-144884b4f6a9") );
141 extern (C++) interface IDXGIDevice2 : IDXGIDevice1
142 {
143 	HRESULT OfferResources( 
144             UINT NumResources,
145             const(IDXGIResource)* ppResources,
146             DXGI_OFFER_RESOURCE_PRIORITY Priority);
147 
148 	HRESULT ReclaimResources( 
149             UINT NumResources,
150             const(IDXGIResource)* ppResources,
151             /*out*/ BOOL* pDiscarded);
152 
153 	HRESULT EnqueueSetEvent( 
154             HANDLE hEvent);
155 }
156 
157 enum DXGI_ENUM_MODES_STEREO	= ( 4UL );
158 enum DXGI_ENUM_MODES_DISABLED_STEREO =	( 8UL );
159 enum DXGI_SHARED_RESOURCE_READ = ( 0x80000000L );
160 enum DXGI_SHARED_RESOURCE_WRITE	= ( 1 );
161 
162 struct DXGI_MODE_DESC1
163 {
164 	UINT Width;
165 	UINT Height;
166 	DXGI_RATIONAL RefreshRate;
167 	DXGI_FORMAT Format;
168 	DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;
169 	DXGI_MODE_SCALING Scaling;
170 	BOOL Stereo;
171 }
172 
173 alias DXGI_SCALING = int; 
174 enum : DXGI_SCALING
175 {
176 	DXGI_SCALING_STRETCH	= 0,
177 	DXGI_SCALING_NONE	= 1,
178 	DXGI_SCALING_ASPECT_RATIO_STRETCH	= 2
179 }
180 
181 struct DXGI_SWAP_CHAIN_DESC1
182 {
183 	UINT Width;
184 	UINT Height;
185 	DXGI_FORMAT Format;
186 	BOOL Stereo;
187 	DXGI_SAMPLE_DESC SampleDesc;
188 	DXGI_USAGE BufferUsage;
189 	UINT BufferCount;
190 	DXGI_SCALING Scaling;
191 	DXGI_SWAP_EFFECT SwapEffect;
192 	DXGI_ALPHA_MODE AlphaMode;
193 	UINT Flags;
194 }
195 
196 struct DXGI_SWAP_CHAIN_FULLSCREEN_DESC
197 {
198 	DXGI_RATIONAL RefreshRate;
199 	DXGI_MODE_SCANLINE_ORDER ScanlineOrdering;
200 	DXGI_MODE_SCALING Scaling;
201 	BOOL Windowed;
202 }
203 
204 struct DXGI_PRESENT_PARAMETERS
205 {
206 	UINT DirtyRectsCount;
207 	RECT *pDirtyRects;
208 	RECT *pScrollRect;
209 	POINT *pScrollOffset;
210 }
211 
212 mixin( uuid!(IDXGISwapChain1, "790a45f7-0d42-4876-983a-0a55cfe6f4aa") );
213 extern (C++) interface IDXGISwapChain1 : IDXGISwapChain
214 {
215 	HRESULT GetDesc1( 
216             /*out*/ DXGI_SWAP_CHAIN_DESC1* pDesc);
217 
218 	HRESULT GetFullscreenDesc( 
219             /*out*/ DXGI_SWAP_CHAIN_FULLSCREEN_DESC* pDesc);
220 
221 	HRESULT GetHwnd( 
222             /*out*/ HWND* pHwnd);
223 
224 	HRESULT GetCoreWindow( 
225             REFIID refiid,
226             /*out*/ void** ppUnk);
227 
228 	HRESULT Present1( 
229             UINT SyncInterval,
230             UINT PresentFlags,
231             const(DXGI_PRESENT_PARAMETERS)* pPresentParameters);
232 
233 	BOOL IsTemporaryMonoSupported();
234 
235 	HRESULT GetRestrictToOutput( 
236             /*out*/ IDXGIOutput* ppRestrictToOutput);
237 
238 	HRESULT SetBackgroundColor( 
239             const(DXGI_RGBA)* pColor);
240 
241 	HRESULT GetBackgroundColor( 
242             /*out*/ DXGI_RGBA* pColor);
243 
244 	HRESULT SetRotation( 
245             DXGI_MODE_ROTATION Rotation);
246 
247 	HRESULT GetRotation( 
248             /*out*/ DXGI_MODE_ROTATION* pRotation);
249 }
250 
251 mixin( uuid!(IDXGIFactory2, "50c83a1c-e072-4c48-87b0-3630fa36a6d0") );
252 extern (C++) interface IDXGIFactory2 : IDXGIFactory1
253 {
254 	BOOL IsWindowedStereoEnabled();
255         
256 	HRESULT CreateSwapChainForHwnd( 
257             IUnknown pDevice,
258             HWND hWnd,
259             const(DXGI_SWAP_CHAIN_DESC1)* pDesc,
260             const(DXGI_SWAP_CHAIN_FULLSCREEN_DESC)* pFullscreenDesc,
261             IDXGIOutput pRestrictToOutput,
262             /*out*/ IDXGISwapChain1* ppSwapChain);
263 
264 	HRESULT CreateSwapChainForCoreWindow( 
265             IUnknown pDevice,
266             IUnknown pWindow,
267             const(DXGI_SWAP_CHAIN_DESC1)* pDesc,
268             IDXGIOutput pRestrictToOutput,
269             /*out*/ IDXGISwapChain1* ppSwapChain);
270         
271 	HRESULT GetSharedResourceAdapterLuid( 
272             HANDLE hResource,
273             /*out*/ LUID* pLuid);
274 
275 	HRESULT RegisterStereoStatusWindow( 
276             HWND WindowHandle,
277             UINT wMsg,
278             /*out*/ DWORD* pdwCookie);
279 
280 	HRESULT RegisterStereoStatusEvent( 
281             HANDLE hEvent,
282             /*out*/ DWORD* pdwCookie);
283 
284 	void UnregisterStereoStatus( 
285             DWORD dwCookie);
286 
287 	HRESULT RegisterOcclusionStatusWindow( 
288             HWND WindowHandle,
289             UINT wMsg,
290             DWORD* pdwCookie);
291 
292 	HRESULT RegisterOcclusionStatusEvent( 
293             HANDLE hEvent,
294             /*out*/ DWORD* pdwCookie);
295 
296 	void UnregisterOcclusionStatus( 
297             DWORD dwCookie);
298 
299 	HRESULT CreateSwapChainForComposition( 
300             IUnknown pDevice,
301             const(DXGI_SWAP_CHAIN_DESC1)* pDesc,
302             IDXGIOutput pRestrictToOutput,
303             /*out*/ IDXGISwapChain1* ppSwapChain);
304 }
305     
306 alias DXGI_GRAPHICS_PREEMPTION_GRANULARITY = int;
307 enum : DXGI_GRAPHICS_PREEMPTION_GRANULARITY
308 {
309 	DXGI_GRAPHICS_PREEMPTION_DMA_BUFFER_BOUNDARY	= 0,
310 	DXGI_GRAPHICS_PREEMPTION_PRIMITIVE_BOUNDARY	= 1,
311 	DXGI_GRAPHICS_PREEMPTION_TRIANGLE_BOUNDARY	= 2,
312 	DXGI_GRAPHICS_PREEMPTION_PIXEL_BOUNDARY	= 3,
313 	DXGI_GRAPHICS_PREEMPTION_INSTRUCTION_BOUNDARY	= 4
314 }
315 
316 alias DXGI_COMPUTE_PREEMPTION_GRANULARITY = int;
317 enum : DXGI_COMPUTE_PREEMPTION_GRANULARITY
318 {
319 	DXGI_COMPUTE_PREEMPTION_DMA_BUFFER_BOUNDARY	= 0,
320 	DXGI_COMPUTE_PREEMPTION_DISPATCH_BOUNDARY	= 1,
321 	DXGI_COMPUTE_PREEMPTION_THREAD_GROUP_BOUNDARY	= 2,
322 	DXGI_COMPUTE_PREEMPTION_THREAD_BOUNDARY	= 3,
323 	DXGI_COMPUTE_PREEMPTION_INSTRUCTION_BOUNDARY	= 4
324 }
325 
326 struct DXGI_ADAPTER_DESC2
327 {
328 	WCHAR[128] Description;
329 	UINT VendorId;
330 	UINT DeviceId;
331 	UINT SubSysId;
332 	UINT Revision;
333 	SIZE_T DedicatedVideoMemory;
334 	SIZE_T DedicatedSystemMemory;
335 	SIZE_T SharedSystemMemory;
336 	LUID AdapterLuid;
337 	UINT Flags;
338 	DXGI_GRAPHICS_PREEMPTION_GRANULARITY GraphicsPreemptionGranularity;
339 	DXGI_COMPUTE_PREEMPTION_GRANULARITY ComputePreemptionGranularity;
340 }
341 
342 mixin( uuid!(IDXGIAdapter2, "0AA1AE0A-FA0E-4B84-8644-E05FF8E5ACB5") );
343 extern (C++) interface IDXGIAdapter2 : IDXGIAdapter1
344 {
345 	HRESULT GetDesc2( 
346             /*out*/ DXGI_ADAPTER_DESC2* pDesc);
347 }
348 
349 mixin( uuid!(IDXGIOutput1, "00cddea8-939b-4b83-a340-a685226666cc") );
350 extern (C++) interface IDXGIOutput1 : IDXGIOutput
351 {
352 	HRESULT GetDisplayModeList1( 
353             DXGI_FORMAT EnumFormat,
354             UINT Flags,
355             /*inout*/ UINT* pNumModes,
356             /*out*/ DXGI_MODE_DESC1* pDesc);
357 
358 	HRESULT FindClosestMatchingMode1( 
359             const(DXGI_MODE_DESC1)* pModeToMatch,
360             /*out*/ DXGI_MODE_DESC1* pClosestMatch,
361             IUnknown pConcernedDevice);
362 
363 	HRESULT GetDisplaySurfaceData1( 
364             IDXGIResource pDestination);
365 
366 	HRESULT DuplicateOutput( 
367             IUnknown pDevice,
368             /*out*/ IDXGIOutputDuplication* ppOutputDuplication);
369 }