1 // Copyright © 2015-2017 winapi-rs developers
2 // Licensed under the Apache License, Version 2.0
3 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
4 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
5 // All files in the project carrying such notice may not be copied, modified, or distributed
6 // except according to those terms.
7 //! Direct3D include file
8 use shared::basetsd::UINT32;
9 use shared::d3d9caps::{D3DCAPS9, D3DCONTENTPROTECTIONCAPS, D3DOVERLAYCAPS};
10 use shared::d3d9types::{
11     D3DADAPTER_IDENTIFIER9, D3DAUTHENTICATEDCHANNELTYPE, D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT,
12     D3DBACKBUFFER_TYPE, D3DBOX, D3DCLIPSTATUS9, D3DCOLOR, D3DCOMPOSERECTSOP, D3DCUBEMAP_FACES,
13     D3DDEVICE_CREATION_PARAMETERS, D3DDEVTYPE, D3DDISPLAYMODE, D3DDISPLAYMODEEX,
14     D3DDISPLAYMODEFILTER, D3DDISPLAYROTATION, D3DENCRYPTED_BLOCK_INFO, D3DFORMAT, D3DGAMMARAMP,
15     D3DINDEXBUFFER_DESC, D3DLIGHT9, D3DLOCKED_BOX, D3DLOCKED_RECT, D3DMATERIAL9, D3DMATRIX,
16     D3DMULTISAMPLE_TYPE, D3DPOOL, D3DPRESENTSTATS, D3DPRESENT_PARAMETERS, D3DPRIMITIVETYPE,
17     D3DQUERYTYPE, D3DRASTER_STATUS, D3DRECT, D3DRECTPATCH_INFO, D3DRENDERSTATETYPE,
18     D3DRESOURCETYPE, D3DSAMPLERSTATETYPE, D3DSTATEBLOCKTYPE, D3DSURFACE_DESC, D3DTEXTUREFILTERTYPE,
19     D3DTEXTURESTAGESTATETYPE, D3DTRANSFORMSTATETYPE, D3DTRIPATCH_INFO, D3DVERTEXBUFFER_DESC,
20     D3DVERTEXELEMENT9, D3DVIEWPORT9, D3DVOLUME_DESC,
21 };
22 use shared::guiddef::{GUID, IID};
23 use shared::minwindef::{BOOL, BYTE, DWORD, FLOAT, INT, UINT};
24 use shared::windef::{HDC, HMONITOR, HWND, POINT, RECT};
25 use um::unknwnbase::{IUnknown, IUnknownVtbl};
26 use um::wingdi::{PALETTEENTRY, RGNDATA};
27 use um::winnt::{HANDLE, HRESULT, LPCWSTR, LUID, VOID};
28 pub const D3D_SDK_VERSION: DWORD = 32;
29 pub const D3D9b_SDK_VERSION: DWORD = 31;
30 DEFINE_GUID!{IID_IDirect3D9,
31     0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x01, 0x47, 0xf4, 0x27, 0x5c}
32 DEFINE_GUID!{IID_IDirect3DDevice9,
33     0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0x0d, 0x82, 0xb9, 0xeb}
34 DEFINE_GUID!{IID_IDirect3DResource9,
35     0x05eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x04}
36 DEFINE_GUID!{IID_IDirect3DBaseTexture9,
37     0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce}
38 DEFINE_GUID!{IID_IDirect3DTexture9,
39     0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5}
40 DEFINE_GUID!{IID_IDirect3DCubeTexture9,
41     0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f}
42 DEFINE_GUID!{IID_IDirect3DVolumeTexture9,
43     0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6}
44 DEFINE_GUID!{IID_IDirect3DVertexBuffer9,
45     0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3}
46 DEFINE_GUID!{IID_IDirect3DIndexBuffer9,
47     0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35}
48 DEFINE_GUID!{IID_IDirect3DSurface9,
49     0x0cfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b}
50 DEFINE_GUID!{IID_IDirect3DVolume9,
51     0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1}
52 DEFINE_GUID!{IID_IDirect3DSwapChain9,
53     0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0x0b, 0x0b, 0x50, 0x3b}
54 DEFINE_GUID!{IID_IDirect3DVertexDeclaration9,
55     0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46}
56 DEFINE_GUID!{IID_IDirect3DVertexShader9,
57     0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36}
58 DEFINE_GUID!{IID_IDirect3DPixelShader9,
59     0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89}
60 DEFINE_GUID!{IID_IDirect3DStateBlock9,
61     0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0x0f, 0x20, 0x6f, 0x21, 0x8b}
62 DEFINE_GUID!{IID_IDirect3DQuery9,
63     0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc}
64 DEFINE_GUID!{IID_HelperName,
65     0xe4a36723, 0xfdfe, 0x4b22, 0xb1, 0x46, 0x3c, 0x04, 0xc0, 0x7f, 0x4c, 0xc8}
66 DEFINE_GUID!{IID_IDirect3D9Ex,
67     0x02177241, 0x69fc, 0x400c, 0x8f, 0xf1, 0x93, 0xa4, 0x4d, 0xf6, 0x86, 0x1d}
68 DEFINE_GUID!{IID_IDirect3DDevice9Ex,
69     0xb18b10ce, 0x2649, 0x405a, 0x87, 0x0f, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a}
70 DEFINE_GUID!{IID_IDirect3DSwapChain9Ex,
71     0x91886caf, 0x1c3d, 0x4d2e, 0xa0, 0xab, 0x3e, 0x4c, 0x7d, 0x8d, 0x33, 0x03}
72 DEFINE_GUID!{IID_IDirect3D9ExOverlayExtension,
73     0x187aeb13, 0xaaf5, 0x4c59, 0x87, 0x6d, 0xe0, 0x59, 0x08, 0x8c, 0x0d, 0xf8}
74 DEFINE_GUID!{IID_IDirect3DDevice9Video,
75     0x26dc4561, 0xa1ee, 0x4ae7, 0x96, 0xda, 0x11, 0x8a, 0x36, 0xc0, 0xec, 0x95}
76 DEFINE_GUID!{IID_IDirect3DAuthenticatedChannel9,
77     0xff24beee, 0xda21, 0x4beb, 0x98, 0xb5, 0xd2, 0xf8, 0x99, 0xf9, 0x8a, 0xf9}
78 DEFINE_GUID!{IID_IDirect3DCryptoSession9,
79     0xfa0ab799, 0x7a9c, 0x48ca, 0x8c, 0x5b, 0x23, 0x7e, 0x71, 0xa5, 0x44, 0x34}
80 extern "system" {
Direct3DCreate9( SDKVersion: UINT, ) -> *mut IDirect3D981     pub fn Direct3DCreate9(
82         SDKVersion: UINT,
83     ) -> *mut IDirect3D9;
D3DPERF_BeginEvent( col: D3DCOLOR, wszName: LPCWSTR, ) -> INT84     pub fn D3DPERF_BeginEvent(
85         col: D3DCOLOR,
86         wszName: LPCWSTR,
87     ) -> INT;
D3DPERF_EndEvent() -> INT88     pub fn D3DPERF_EndEvent() -> INT;
D3DPERF_SetMarker( col: D3DCOLOR, wszName: LPCWSTR, ) -> ()89     pub fn D3DPERF_SetMarker(
90         col: D3DCOLOR,
91         wszName: LPCWSTR,
92     ) -> ();
D3DPERF_SetRegion( col: D3DCOLOR, wszName: LPCWSTR, ) -> ()93     pub fn D3DPERF_SetRegion(
94         col: D3DCOLOR,
95         wszName: LPCWSTR,
96     ) -> ();
D3DPERF_QueryRepeatFrame() -> BOOL97     pub fn D3DPERF_QueryRepeatFrame() -> BOOL;
D3DPERF_SetOptions( dwOptions: DWORD, ) -> ()98     pub fn D3DPERF_SetOptions(
99         dwOptions: DWORD,
100     ) -> ();
D3DPERF_GetStatus() -> DWORD101     pub fn D3DPERF_GetStatus() -> DWORD;
102 }
103 RIDL!{#[uuid(0x81bdcbca, 0x64d4, 0x426d, 0xae, 0x8d, 0xad, 0x1, 0x47, 0xf4, 0x27, 0x5c)]
104 interface IDirect3D9(IDirect3D9Vtbl): IUnknown(IUnknownVtbl) {
105     fn RegisterSoftwareDevice(
106         pInitializeFunction: *mut VOID,
107     ) -> HRESULT,
108     fn GetAdapterCount() -> UINT,
109     fn GetAdapterIdentifier(
110         Adapter: UINT,
111         Flags: DWORD,
112         pIdentifier: *mut D3DADAPTER_IDENTIFIER9,
113     ) -> HRESULT,
114     fn GetAdapterModeCount(
115         Adapter: UINT,
116         Format: D3DFORMAT,
117     ) -> UINT,
118     fn EnumAdapterModes(
119         Adapter: UINT,
120         Format: D3DFORMAT,
121         Mode: UINT,
122         pMode: *mut D3DDISPLAYMODE,
123     ) -> HRESULT,
124     fn GetAdapterDisplayMode(
125         Adapter: UINT,
126         pMode: *mut D3DDISPLAYMODE,
127     ) -> HRESULT,
128     fn CheckDeviceType(
129         Adapter: UINT,
130         DevType: D3DDEVTYPE,
131         AdapterFormat: D3DFORMAT,
132         BackBufferFormat: D3DFORMAT,
133         bWindowed: BOOL,
134     ) -> HRESULT,
135     fn CheckDeviceFormat(
136         Adapter: UINT,
137         DeviceType: D3DDEVTYPE,
138         AdapterFormat: D3DFORMAT,
139         Usage: DWORD,
140         RType: D3DRESOURCETYPE,
141         CheckFormat: D3DFORMAT,
142     ) -> HRESULT,
143     fn CheckDeviceMultiSampleType(
144         Adapter: UINT,
145         DeviceType: D3DDEVTYPE,
146         SurfaceFormat: D3DFORMAT,
147         Windowed: BOOL,
148         MultiSampleType: D3DMULTISAMPLE_TYPE,
149         pQualityLevels: *mut DWORD,
150     ) -> HRESULT,
151     fn CheckDepthStencilMatch(
152         Adapter: UINT,
153         DeviceType: D3DDEVTYPE,
154         AdapterFormat: D3DFORMAT,
155         RenderTargetFormat: D3DFORMAT,
156         DepthStencilFormat: D3DFORMAT,
157     ) -> HRESULT,
158     fn CheckDeviceFormatConversion(
159         Adapter: UINT,
160         DeviceType: D3DDEVTYPE,
161         SourceFormat: D3DFORMAT,
162         TargetFormat: D3DFORMAT,
163     ) -> HRESULT,
164     fn GetDeviceCaps(
165         Adapter: UINT,
166         DeviceType: D3DDEVTYPE,
167         pCaps: *mut D3DCAPS9,
168     ) -> HRESULT,
169     fn GetAdapterMonitor(
170         Adapter: UINT,
171     ) -> HMONITOR,
172     fn CreateDevice(
173         Adapter: UINT,
174         DeviceType: D3DDEVTYPE,
175         hFocusWindow: HWND,
176         BehaviorFlags: DWORD,
177         pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
178         ppReturnedDeviceInterface: *mut *mut IDirect3DDevice9,
179     ) -> HRESULT,
180 }}
181 pub type LPDIRECT3D9 = *mut IDirect3D9;
182 pub type PDIRECT3D9 = *mut IDirect3D9;
183 RIDL!{#[uuid(0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0xd, 0x82, 0xb9, 0xeb)]
184 interface IDirect3DDevice9(IDirect3DDevice9Vtbl): IUnknown(IUnknownVtbl) {
185     fn TestCooperativeLevel() -> HRESULT,
186     fn GetAvailableTextureMem() -> UINT,
187     fn EvictManagedResources() -> HRESULT,
188     fn GetDirect3D(
189         ppD3D9: *mut *mut IDirect3D9,
190     ) -> HRESULT,
191     fn GetDeviceCaps(
192         pCaps: *mut D3DCAPS9,
193     ) -> HRESULT,
194     fn GetDisplayMode(
195         iSwapChain: UINT,
196         pMode: *mut D3DDISPLAYMODE,
197     ) -> HRESULT,
198     fn GetCreationParameters(
199         pParameters: *mut D3DDEVICE_CREATION_PARAMETERS,
200     ) -> HRESULT,
201     fn SetCursorProperties(
202         XHotSpot: UINT,
203         YHotSpot: UINT,
204         pCursorBitmap: *mut IDirect3DSurface9,
205     ) -> HRESULT,
206     fn SetCursorPosition(
207         X: INT,
208         Y: INT,
209         Flags: DWORD,
210     ) -> (),
211     fn ShowCursor(
212         bShow: BOOL,
213     ) -> BOOL,
214     fn CreateAdditionalSwapChain(
215         pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
216         pSwapChain: *mut *mut IDirect3DSwapChain9,
217     ) -> HRESULT,
218     fn GetSwapChain(
219         iSwapChain: UINT,
220         pSwapChain: *mut *mut IDirect3DSwapChain9,
221     ) -> HRESULT,
222     fn GetNumberOfSwapChains() -> UINT,
223     fn Reset(
224         pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
225     ) -> HRESULT,
226     fn Present(
227         pSourceRect: *const RECT,
228         pDestRect: *const RECT,
229         hDestWindowOverride: HWND,
230         pDirtyRegion: *const RGNDATA,
231     ) -> HRESULT,
232     fn GetBackBuffer(
233         iSwapChain: UINT,
234         iBackBuffer: UINT,
235         Type: D3DBACKBUFFER_TYPE,
236         ppBackBuffer: *mut *mut IDirect3DSurface9,
237     ) -> HRESULT,
238     fn GetRasterStatus(
239         iSwapChain: UINT,
240         pRasterStatus: *mut D3DRASTER_STATUS,
241     ) -> HRESULT,
242     fn SetDialogBoxMode(
243         bEnableDialogs: BOOL,
244     ) -> HRESULT,
245     fn SetGammaRamp(
246         iSwapChain: UINT,
247         Flags: DWORD,
248         pRamp: *const D3DGAMMARAMP,
249     ) -> (),
250     fn GetGammaRamp(
251         iSwapChain: UINT,
252         pRamp: *mut D3DGAMMARAMP,
253     ) -> (),
254     fn CreateTexture(
255         Width: UINT,
256         Height: UINT,
257         Levels: UINT,
258         Usage: DWORD,
259         Format: D3DFORMAT,
260         Pool: D3DPOOL,
261         ppTexture: *mut *mut IDirect3DTexture9,
262         pSharedHandle: *mut HANDLE,
263     ) -> HRESULT,
264     fn CreateVolumeTexture(
265         Width: UINT,
266         Height: UINT,
267         Depth: UINT,
268         Levels: UINT,
269         Usage: DWORD,
270         Format: D3DFORMAT,
271         Pool: D3DPOOL,
272         ppVolumeTexture: *mut *mut IDirect3DVolumeTexture9,
273         pSharedHandle: *mut HANDLE,
274     ) -> HRESULT,
275     fn CreateCubeTexture(
276         EdgeLength: UINT,
277         Levels: UINT,
278         Usage: DWORD,
279         Format: D3DFORMAT,
280         Pool: D3DPOOL,
281         ppCubeTexture: *mut *mut IDirect3DCubeTexture9,
282         pSharedHandle: *mut HANDLE,
283     ) -> HRESULT,
284     fn CreateVertexBuffer(
285         Length: UINT,
286         Usage: DWORD,
287         FVF: DWORD,
288         Pool: D3DPOOL,
289         ppVertexBuffer: *mut *mut IDirect3DVertexBuffer9,
290         pSharedHandle: *mut HANDLE,
291     ) -> HRESULT,
292     fn CreateIndexBuffer(
293         Length: UINT,
294         Usage: DWORD,
295         Format: D3DFORMAT,
296         Pool: D3DPOOL,
297         ppIndexBuffer: *mut *mut IDirect3DIndexBuffer9,
298         pSharedHandle: *mut HANDLE,
299     ) -> HRESULT,
300     fn CreateRenderTarget(
301         Width: UINT,
302         Height: UINT,
303         Format: D3DFORMAT,
304         MultiSample: D3DMULTISAMPLE_TYPE,
305         MultisampleQuality: DWORD,
306         Lockable: BOOL,
307         ppSurface: *mut *mut IDirect3DSurface9,
308         pSharedHandle: *mut HANDLE,
309     ) -> HRESULT,
310     fn CreateDepthStencilSurface(
311         Width: UINT,
312         Height: UINT,
313         Format: D3DFORMAT,
314         MultiSample: D3DMULTISAMPLE_TYPE,
315         MultisampleQuality: DWORD,
316         Discard: BOOL,
317         ppSurface: *mut *mut IDirect3DSurface9,
318         pSharedHandle: *mut HANDLE,
319     ) -> HRESULT,
320     fn UpdateSurface(
321         pSourceSurface: *mut IDirect3DSurface9,
322         pSourceRect: *const RECT,
323         pDestinationSurface: *mut IDirect3DSurface9,
324         pDestPoint: *const POINT,
325     ) -> HRESULT,
326     fn UpdateTexture(
327         pSourceTexture: *mut IDirect3DBaseTexture9,
328         pDestinationTexture: *mut IDirect3DBaseTexture9,
329     ) -> HRESULT,
330     fn GetRenderTargetData(
331         pRenderTarget: *mut IDirect3DSurface9,
332         pDestSurface: *mut IDirect3DSurface9,
333     ) -> HRESULT,
334     fn GetFrontBufferData(
335         iSwapChain: UINT,
336         pDestSurface: *mut IDirect3DSurface9,
337     ) -> HRESULT,
338     fn StretchRect(
339         pSourceSurface: *mut IDirect3DSurface9,
340         pSourceRect: *const RECT,
341         pDestSurface: *mut IDirect3DSurface9,
342         pDestRect: *const RECT,
343         Filter: D3DTEXTUREFILTERTYPE,
344     ) -> HRESULT,
345     fn ColorFill(
346         pSurface: *mut IDirect3DSurface9,
347         pRect: *const RECT,
348         color: D3DCOLOR,
349     ) -> HRESULT,
350     fn CreateOffscreenPlainSurface(
351         Width: UINT,
352         Height: UINT,
353         Format: D3DFORMAT,
354         Pool: D3DPOOL,
355         ppSurface: *mut *mut IDirect3DSurface9,
356         pSharedHandle: *mut HANDLE,
357     ) -> HRESULT,
358     fn SetRenderTarget(
359         RenderTargetIndex: DWORD,
360         pRenderTarget: *mut IDirect3DSurface9,
361     ) -> HRESULT,
362     fn GetRenderTarget(
363         RenderTargetIndex: DWORD,
364         ppRenderTarget: *mut *mut IDirect3DSurface9,
365     ) -> HRESULT,
366     fn SetDepthStencilSurface(
367         pNewZStencil: *mut IDirect3DSurface9,
368     ) -> HRESULT,
369     fn GetDepthStencilSurface(
370         ppZStencilSurface: *mut *mut IDirect3DSurface9,
371     ) -> HRESULT,
372     fn BeginScene() -> HRESULT,
373     fn EndScene() -> HRESULT,
374     fn Clear(
375         Count: DWORD,
376         pRects: *const D3DRECT,
377         Flags: DWORD,
378         Color: D3DCOLOR,
379         Z: FLOAT,
380         Stencil: DWORD,
381     ) -> HRESULT,
382     fn SetTransform(
383         State: D3DTRANSFORMSTATETYPE,
384         pMatrix: *const D3DMATRIX,
385     ) -> HRESULT,
386     fn GetTransform(
387         State: D3DTRANSFORMSTATETYPE,
388         pMatrix: *mut D3DMATRIX,
389     ) -> HRESULT,
390     fn MultiplyTransform(
391         arg1: D3DTRANSFORMSTATETYPE,
392         arg2: *const D3DMATRIX,
393     ) -> HRESULT,
394     fn SetViewport(
395         pViewport: *const D3DVIEWPORT9,
396     ) -> HRESULT,
397     fn GetViewport(
398         pViewport: *mut D3DVIEWPORT9,
399     ) -> HRESULT,
400     fn SetMaterial(
401         pMaterial: *const D3DMATERIAL9,
402     ) -> HRESULT,
403     fn GetMaterial(
404         pMaterial: *mut D3DMATERIAL9,
405     ) -> HRESULT,
406     fn SetLight(
407         Index: DWORD,
408         arg1: *const D3DLIGHT9,
409     ) -> HRESULT,
410     fn GetLight(
411         Index: DWORD,
412         arg1: *mut D3DLIGHT9,
413     ) -> HRESULT,
414     fn LightEnable(
415         Index: DWORD,
416         Enable: BOOL,
417     ) -> HRESULT,
418     fn GetLightEnable(
419         Index: DWORD,
420         pEnable: *mut BOOL,
421     ) -> HRESULT,
422     fn SetClipPlane(
423         Index: DWORD,
424         pPlane: *const FLOAT,
425     ) -> HRESULT,
426     fn GetClipPlane(
427         Index: DWORD,
428         pPlane: *mut FLOAT,
429     ) -> HRESULT,
430     fn SetRenderState(
431         State: D3DRENDERSTATETYPE,
432         Value: DWORD,
433     ) -> HRESULT,
434     fn GetRenderState(
435         State: D3DRENDERSTATETYPE,
436         pValue: *mut DWORD,
437     ) -> HRESULT,
438     fn CreateStateBlock(
439         Type: D3DSTATEBLOCKTYPE,
440         ppSB: *mut *mut IDirect3DStateBlock9,
441     ) -> HRESULT,
442     fn BeginStateBlock() -> HRESULT,
443     fn EndStateBlock(
444         ppSB: *mut *mut IDirect3DStateBlock9,
445     ) -> HRESULT,
446     fn SetClipStatus(
447         pClipStatus: *const D3DCLIPSTATUS9,
448     ) -> HRESULT,
449     fn GetClipStatus(
450         pClipStatus: *mut D3DCLIPSTATUS9,
451     ) -> HRESULT,
452     fn GetTexture(
453         Stage: DWORD,
454         ppTexture: *mut *mut IDirect3DBaseTexture9,
455     ) -> HRESULT,
456     fn SetTexture(
457         Stage: DWORD,
458         pTexture: *mut IDirect3DBaseTexture9,
459     ) -> HRESULT,
460     fn GetTextureStageState(
461         Stage: DWORD,
462         Type: D3DTEXTURESTAGESTATETYPE,
463         pValue: *mut DWORD,
464     ) -> HRESULT,
465     fn SetTextureStageState(
466         Stage: DWORD,
467         Type: D3DTEXTURESTAGESTATETYPE,
468         Value: DWORD,
469     ) -> HRESULT,
470     fn GetSamplerState(
471         Sampler: DWORD,
472         Type: D3DSAMPLERSTATETYPE,
473         pValue: *mut DWORD,
474     ) -> HRESULT,
475     fn SetSamplerState(
476         Sampler: DWORD,
477         Type: D3DSAMPLERSTATETYPE,
478         Value: DWORD,
479     ) -> HRESULT,
480     fn ValidateDevice(
481         pNumPasses: *mut DWORD,
482     ) -> HRESULT,
483     fn SetPaletteEntries(
484         PaletteNumber: UINT,
485         pEntries: *const PALETTEENTRY,
486     ) -> HRESULT,
487     fn GetPaletteEntries(
488         PaletteNumber: UINT,
489         pEntries: *mut PALETTEENTRY,
490     ) -> HRESULT,
491     fn SetCurrentTexturePalette(
492         PaletteNumber: UINT,
493     ) -> HRESULT,
494     fn GetCurrentTexturePalette(
495         PaletteNumber: *mut UINT,
496     ) -> HRESULT,
497     fn SetScissorRect(
498         pRect: *const RECT,
499     ) -> HRESULT,
500     fn GetScissorRect(
501         pRect: *mut RECT,
502     ) -> HRESULT,
503     fn SetSoftwareVertexProcessing(
504         bSoftware: BOOL,
505     ) -> HRESULT,
506     fn GetSoftwareVertexProcessing() -> BOOL,
507     fn SetNPatchMode(
508         nSegments: FLOAT,
509     ) -> HRESULT,
510     fn GetNPatchMode() -> FLOAT,
511     fn DrawPrimitive(
512         PrimitiveType: D3DPRIMITIVETYPE,
513         StartVertex: UINT,
514         PrimitiveCount: UINT,
515     ) -> HRESULT,
516     fn DrawIndexedPrimitive(
517         arg1: D3DPRIMITIVETYPE,
518         BaseVertexIndex: INT,
519         MinVertexIndex: UINT,
520         NumVertices: UINT,
521         startIndex: UINT,
522         primCount: UINT,
523     ) -> HRESULT,
524     fn DrawPrimitiveUP(
525         PrimitiveType: D3DPRIMITIVETYPE,
526         PrimitiveCount: UINT,
527         pVertexStreamZeroData: *const VOID,
528         VertexStreamZeroStride: UINT,
529     ) -> HRESULT,
530     fn DrawIndexedPrimitiveUP(
531         PrimitiveType: D3DPRIMITIVETYPE,
532         MinVertexIndex: UINT,
533         NumVertices: UINT,
534         PrimitiveCount: UINT,
535         pIndexData: *const VOID,
536         IndexDataFormat: D3DFORMAT,
537         pVertexStreamZeroData: *const VOID,
538         VertexStreamZeroStride: UINT,
539     ) -> HRESULT,
540     fn ProcessVertices(
541         SrcStartIndex: UINT,
542         DestIndex: UINT,
543         VertexCount: UINT,
544         pDestBuffer: *mut IDirect3DVertexBuffer9,
545         pVertexDecl: *mut IDirect3DVertexDeclaration9,
546         Flags: DWORD,
547     ) -> HRESULT,
548     fn CreateVertexDeclaration(
549         pVertexElements: *const D3DVERTEXELEMENT9,
550         ppDecl: *mut *mut IDirect3DVertexDeclaration9,
551     ) -> HRESULT,
552     fn SetVertexDeclaration(
553         pDecl: *mut IDirect3DVertexDeclaration9,
554     ) -> HRESULT,
555     fn GetVertexDeclaration(
556         ppDecl: *mut *mut IDirect3DVertexDeclaration9,
557     ) -> HRESULT,
558     fn SetFVF(
559         FVF: DWORD,
560     ) -> HRESULT,
561     fn GetFVF(
562         pFVF: *mut DWORD,
563     ) -> HRESULT,
564     fn CreateVertexShader(
565         pFunction: *const DWORD,
566         ppShader: *mut *mut IDirect3DVertexShader9,
567     ) -> HRESULT,
568     fn SetVertexShader(
569         pShader: *mut IDirect3DVertexShader9,
570     ) -> HRESULT,
571     fn GetVertexShader(
572         ppShader: *mut *mut IDirect3DVertexShader9,
573     ) -> HRESULT,
574     fn SetVertexShaderConstantF(
575         StartRegister: UINT,
576         pConstantData: *const FLOAT,
577         Vector4fCount: UINT,
578     ) -> HRESULT,
579     fn GetVertexShaderConstantF(
580         StartRegister: UINT,
581         pConstantData: *mut FLOAT,
582         Vector4fCount: UINT,
583     ) -> HRESULT,
584     fn SetVertexShaderConstantI(
585         StartRegister: UINT,
586         pConstantData: *const INT,
587         Vector4iCount: UINT,
588     ) -> HRESULT,
589     fn GetVertexShaderConstantI(
590         StartRegister: UINT,
591         pConstantData: *mut INT,
592         Vector4iCount: UINT,
593     ) -> HRESULT,
594     fn SetVertexShaderConstantB(
595         StartRegister: UINT,
596         pConstantData: *const BOOL,
597         BoolCount: UINT,
598     ) -> HRESULT,
599     fn GetVertexShaderConstantB(
600         StartRegister: UINT,
601         pConstantData: *mut BOOL,
602         BoolCount: UINT,
603     ) -> HRESULT,
604     fn SetStreamSource(
605         StreamNumber: UINT,
606         pStreamData: *mut IDirect3DVertexBuffer9,
607         OffsetInBytes: UINT,
608         Stride: UINT,
609     ) -> HRESULT,
610     fn GetStreamSource(
611         StreamNumber: UINT,
612         ppStreamData: *mut *mut IDirect3DVertexBuffer9,
613         pOffsetInBytes: *mut UINT,
614         pStride: *mut UINT,
615     ) -> HRESULT,
616     fn SetStreamSourceFreq(
617         StreamNumber: UINT,
618         Setting: UINT,
619     ) -> HRESULT,
620     fn GetStreamSourceFreq(
621         StreamNumber: UINT,
622         pSetting: *mut UINT,
623     ) -> HRESULT,
624     fn SetIndices(
625         pIndexData: *mut IDirect3DIndexBuffer9,
626     ) -> HRESULT,
627     fn GetIndices(
628         ppIndexData: *mut *mut IDirect3DIndexBuffer9,
629     ) -> HRESULT,
630     fn CreatePixelShader(
631         pFunction: *const DWORD,
632         ppShader: *mut *mut IDirect3DPixelShader9,
633     ) -> HRESULT,
634     fn SetPixelShader(
635         pShader: *mut IDirect3DPixelShader9,
636     ) -> HRESULT,
637     fn GetPixelShader(
638         ppShader: *mut *mut IDirect3DPixelShader9,
639     ) -> HRESULT,
640     fn SetPixelShaderConstantF(
641         StartRegister: UINT,
642         pConstantData: *const FLOAT,
643         Vector4fCount: UINT,
644     ) -> HRESULT,
645     fn GetPixelShaderConstantF(
646         StartRegister: UINT,
647         pConstantData: *mut FLOAT,
648         Vector4fCount: UINT,
649     ) -> HRESULT,
650     fn SetPixelShaderConstantI(
651         StartRegister: UINT,
652         pConstantData: *const INT,
653         Vector4iCount: UINT,
654     ) -> HRESULT,
655     fn GetPixelShaderConstantI(
656         StartRegister: UINT,
657         pConstantData: *mut INT,
658         Vector4iCount: UINT,
659     ) -> HRESULT,
660     fn SetPixelShaderConstantB(
661         StartRegister: UINT,
662         pConstantData: *const BOOL,
663         BoolCount: UINT,
664     ) -> HRESULT,
665     fn GetPixelShaderConstantB(
666         StartRegister: UINT,
667         pConstantData: *mut BOOL,
668         BoolCount: UINT,
669     ) -> HRESULT,
670     fn DrawRectPatch(
671         Handle: UINT,
672         pNumSegs: *const FLOAT,
673         pRectPatchInfo: *const D3DRECTPATCH_INFO,
674     ) -> HRESULT,
675     fn DrawTriPatch(
676         Handle: UINT,
677         pNumSegs: *const FLOAT,
678         pTriPatchInfo: *const D3DTRIPATCH_INFO,
679     ) -> HRESULT,
680     fn DeletePatch(
681         Handle: UINT,
682     ) -> HRESULT,
683     fn CreateQuery(
684         Type: D3DQUERYTYPE,
685         ppQuery: *mut *mut IDirect3DQuery9,
686     ) -> HRESULT,
687 }}
688 pub type LPDIRECT3DDEVICE9 = *mut IDirect3DDevice9;
689 pub type PDIRECT3DDEVICE9 = *mut IDirect3DDevice9;
690 RIDL!{#[uuid(0xb07c4fe5, 0x310d, 0x4ba8, 0xa2, 0x3c, 0x4f, 0xf, 0x20, 0x6f, 0x21, 0x8b)]
691 interface IDirect3DStateBlock9(IDirect3DStateBlock9Vtbl): IUnknown(IUnknownVtbl) {
692     fn GetDevice(
693         ppDevice: *mut *mut IDirect3DDevice9,
694     ) -> HRESULT,
695     fn Capture() -> HRESULT,
696     fn Apply() -> HRESULT,
697 }}
698 pub type LPDIRECT3DSTATEBLOCK9 = *mut IDirect3DStateBlock9;
699 pub type PDIRECT3DSTATEBLOCK9 = *mut IDirect3DStateBlock9;
700 RIDL!{#[uuid(0x794950f2, 0xadfc, 0x458a, 0x90, 0x5e, 0x10, 0xa1, 0xb, 0xb, 0x50, 0x3b)]
701 interface IDirect3DSwapChain9(IDirect3DSwapChain9Vtbl): IUnknown(IUnknownVtbl) {
702     fn Present(
703         pSourceRect: *const RECT,
704         pDestRect: *const RECT,
705         hDestWindowOverride: HWND,
706         pDirtyRegion: *const RGNDATA,
707         dwFlags: DWORD,
708     ) -> HRESULT,
709     fn GetFrontBufferData(
710         pDestSurface: *mut IDirect3DSurface9,
711     ) -> HRESULT,
712     fn GetBackBuffer(
713         iBackBuffer: UINT,
714         Type: D3DBACKBUFFER_TYPE,
715         ppBackBuffer: *mut *mut IDirect3DSurface9,
716     ) -> HRESULT,
717     fn GetRasterStatus(
718         pRasterStatus: *mut D3DRASTER_STATUS,
719     ) -> HRESULT,
720     fn GetDisplayMode(
721         pMode: *mut D3DDISPLAYMODE,
722     ) -> HRESULT,
723     fn GetDevice(
724         ppDevice: *mut *mut IDirect3DDevice9,
725     ) -> HRESULT,
726     fn GetPresentParameters(
727         pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
728     ) -> HRESULT,
729 }}
730 pub type LPDIRECT3DSWAPCHAIN9 = *mut IDirect3DSwapChain9;
731 pub type PDIRECT3DSWAPCHAIN9 = *mut IDirect3DSwapChain9;
732 RIDL!{#[uuid(0x5eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x4)]
733 interface IDirect3DResource9(IDirect3DResource9Vtbl): IUnknown(IUnknownVtbl) {
734     fn GetDevice(
735         ppDevice: *mut *mut IDirect3DDevice9,
736     ) -> HRESULT,
737     fn SetPrivateData(
738         refguid: *const GUID,
739         pData: *const VOID,
740         SizeOfData: DWORD,
741         Flags: DWORD,
742     ) -> HRESULT,
743     fn GetPrivateData(
744         refguid: *const GUID,
745         pData: *mut VOID,
746         pSizeOfData: *mut DWORD,
747     ) -> HRESULT,
748     fn FreePrivateData(
749         refguid: *const GUID,
750     ) -> HRESULT,
751     fn SetPriority(
752         PriorityNew: DWORD,
753     ) -> DWORD,
754     fn GetPriority() -> DWORD,
755     fn PreLoad() -> (),
756     fn GetType() -> D3DRESOURCETYPE,
757 }}
758 pub type LPDIRECT3DRESOURCE9 = *mut IDirect3DResource9;
759 pub type PDIRECT3DRESOURCE9 = *mut IDirect3DResource9;
760 RIDL!{#[uuid(0xdd13c59c, 0x36fa, 0x4098, 0xa8, 0xfb, 0xc7, 0xed, 0x39, 0xdc, 0x85, 0x46)]
761 interface IDirect3DVertexDeclaration9(IDirect3DVertexDeclaration9Vtbl): IUnknown(IUnknownVtbl) {
762     fn GetDevice(
763         ppDevice: *mut *mut IDirect3DDevice9,
764     ) -> HRESULT,
765     fn GetDeclaration(
766         pElement: *mut D3DVERTEXELEMENT9,
767         pNumElements: *mut UINT,
768     ) -> HRESULT,
769 }}
770 pub type LPDIRECT3DVERTEXDECLARATION9 = *mut IDirect3DVertexDeclaration9;
771 pub type PDIRECT3DVERTEXDECLARATION9 = *mut IDirect3DVertexDeclaration9;
772 RIDL!{#[uuid(0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36)]
773 interface IDirect3DVertexShader9(IDirect3DVertexShader9Vtbl): IUnknown(IUnknownVtbl) {
774     fn GetDevice(
775         ppDevice: *mut *mut IDirect3DDevice9,
776     ) -> HRESULT,
777     fn GetFunction(
778         arg1: *mut VOID,
779         pSizeOfData: *mut UINT,
780     ) -> HRESULT,
781 }}
782 pub type LPDIRECT3DVERTEXSHADER9 = *mut IDirect3DVertexShader9;
783 pub type PDIRECT3DVERTEXSHADER9 = *mut IDirect3DVertexShader9;
784 RIDL!{#[uuid(0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89)]
785 interface IDirect3DPixelShader9(IDirect3DPixelShader9Vtbl): IUnknown(IUnknownVtbl) {
786     fn GetDevice(
787         ppDevice: *mut *mut IDirect3DDevice9,
788     ) -> HRESULT,
789     fn GetFunction(
790         arg1: *mut VOID,
791         pSizeOfData: *mut UINT,
792     ) -> HRESULT,
793 }}
794 pub type LPDIRECT3DPIXELSHADER9 = *mut IDirect3DPixelShader9;
795 pub type PDIRECT3DPIXELSHADER9 = *mut IDirect3DPixelShader9;
796 RIDL!{#[uuid(0x580ca87e, 0x1d3c, 0x4d54, 0x99, 0x1d, 0xb7, 0xd3, 0xe3, 0xc2, 0x98, 0xce)]
797 interface IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl):
798     IDirect3DResource9(IDirect3DResource9Vtbl) {
799     fn SetLOD(
800         LODNew: DWORD,
801     ) -> DWORD,
802     fn GetLOD() -> DWORD,
803     fn GetLevelCount() -> DWORD,
804     fn SetAutoGenFilterType(
805         FilterType: D3DTEXTUREFILTERTYPE,
806     ) -> HRESULT,
807     fn GetAutoGenFilterType() -> D3DTEXTUREFILTERTYPE,
808     fn GenerateMipSubLevels() -> (),
809 }}
810 pub type LPDIRECT3DBASETEXTURE9 = *mut IDirect3DBaseTexture9;
811 pub type PDIRECT3DBASETEXTURE9 = *mut IDirect3DBaseTexture9;
812 RIDL!{#[uuid(0x85c31227, 0x3de5, 0x4f00, 0x9b, 0x3a, 0xf1, 0x1a, 0xc3, 0x8c, 0x18, 0xb5)]
813 interface IDirect3DTexture9(IDirect3DTexture9Vtbl):
814     IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) {
815     fn GetLevelDesc(
816         Level: UINT,
817         pDesc: *mut D3DSURFACE_DESC,
818     ) -> HRESULT,
819     fn GetSurfaceLevel(
820         Level: UINT,
821         ppSurfaceLevel: *mut *mut IDirect3DSurface9,
822     ) -> HRESULT,
823     fn LockRect(
824         Level: UINT,
825         pLockedRect: *mut D3DLOCKED_RECT,
826         pRect: *const RECT,
827         Flags: DWORD,
828     ) -> HRESULT,
829     fn UnlockRect(
830         Level: UINT,
831     ) -> HRESULT,
832     fn AddDirtyRect(
833         pDirtyRect: *const RECT,
834     ) -> HRESULT,
835 }}
836 pub type LPDIRECT3DTEXTURE9 = *mut IDirect3DTexture9;
837 pub type PDIRECT3DTEXTURE9 = *mut IDirect3DTexture9;
838 RIDL!{#[uuid(0x2518526c, 0xe789, 0x4111, 0xa7, 0xb9, 0x47, 0xef, 0x32, 0x8d, 0x13, 0xe6)]
839 interface IDirect3DVolumeTexture9(IDirect3DVolumeTexture9Vtbl):
840     IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) {
841     fn GetLevelDesc(
842         Level: UINT,
843         pDesc: *mut D3DVOLUME_DESC,
844     ) -> HRESULT,
845     fn GetVolumeLevel(
846         Level: UINT,
847         ppVolumeLevel: *mut *mut IDirect3DVolume9,
848     ) -> HRESULT,
849     fn LockBox(
850         Level: UINT,
851         pLockedVolume: *mut D3DLOCKED_BOX,
852         pBox: *const D3DBOX,
853         Flags: DWORD,
854     ) -> HRESULT,
855     fn UnlockBox(
856         Level: UINT,
857     ) -> HRESULT,
858     fn AddDirtyBox(
859         pDirtyBox: *const D3DBOX,
860     ) -> HRESULT,
861 }}
862 pub type LPDIRECT3DVOLUMETEXTURE9 = *mut IDirect3DVolumeTexture9;
863 pub type PDIRECT3DVOLUMETEXTURE9 = *mut IDirect3DVolumeTexture9;
864 RIDL!{#[uuid(0xfff32f81, 0xd953, 0x473a, 0x92, 0x23, 0x93, 0xd6, 0x52, 0xab, 0xa9, 0x3f)]
865 interface IDirect3DCubeTexture9(IDirect3DCubeTexture9Vtbl):
866     IDirect3DBaseTexture9(IDirect3DBaseTexture9Vtbl) {
867     fn GetLevelDesc(
868         Level: UINT,
869         pDesc: *mut D3DSURFACE_DESC,
870     ) -> HRESULT,
871     fn GetCubeMapSurface(
872         FaceType: D3DCUBEMAP_FACES,
873         Level: UINT,
874         ppCubeMapSurface: *mut *mut IDirect3DSurface9,
875     ) -> HRESULT,
876     fn LockRect(
877         FaceType: D3DCUBEMAP_FACES,
878         Level: UINT,
879         pLockedRect: *mut D3DLOCKED_RECT,
880         pRect: *const RECT,
881         Flags: DWORD,
882     ) -> HRESULT,
883     fn UnlockRect(
884         FaceType: D3DCUBEMAP_FACES,
885         Level: UINT,
886     ) -> HRESULT,
887     fn AddDirtyRect(
888         FaceType: D3DCUBEMAP_FACES,
889         pDirtyRect: *const RECT,
890     ) -> HRESULT,
891 }}
892 pub type LPDIRECT3DCUBETEXTURE9 = *mut IDirect3DCubeTexture9;
893 pub type PDIRECT3DCUBETEXTURE9 = *mut IDirect3DCubeTexture9;
894 RIDL!{#[uuid(0xb64bb1b5, 0xfd70, 0x4df6, 0xbf, 0x91, 0x19, 0xd0, 0xa1, 0x24, 0x55, 0xe3)]
895 interface IDirect3DVertexBuffer9(IDirect3DVertexBuffer9Vtbl):
896     IDirect3DResource9(IDirect3DResource9Vtbl) {
897     fn Lock(
898         OffsetToLock: UINT,
899         SizeToLock: UINT,
900         ppbData: *mut *mut VOID,
901         Flags: DWORD,
902     ) -> HRESULT,
903     fn Unlock() -> HRESULT,
904     fn GetDesc(
905         pDesc: *mut D3DVERTEXBUFFER_DESC,
906     ) -> HRESULT,
907 }}
908 pub type LPDIRECT3DVERTEXBUFFER9 = *mut IDirect3DVertexBuffer9;
909 pub type PDIRECT3DVERTEXBUFFER9 = *mut IDirect3DVertexBuffer9;
910 RIDL!{#[uuid(0x7c9dd65e, 0xd3f7, 0x4529, 0xac, 0xee, 0x78, 0x58, 0x30, 0xac, 0xde, 0x35)]
911 interface IDirect3DIndexBuffer9(IDirect3DIndexBuffer9Vtbl):
912     IDirect3DResource9(IDirect3DResource9Vtbl) {
913     fn Lock(
914         OffsetToLock: UINT,
915         SizeToLock: UINT,
916         ppbData: *mut *mut VOID,
917         Flags: DWORD,
918     ) -> HRESULT,
919     fn Unlock() -> HRESULT,
920     fn GetDesc(
921         pDesc: *mut D3DINDEXBUFFER_DESC,
922     ) -> HRESULT,
923 }}
924 pub type LPDIRECT3DINDEXBUFFER9 = *mut IDirect3DIndexBuffer9;
925 pub type PDIRECT3DINDEXBUFFER9 = *mut IDirect3DIndexBuffer9;
926 RIDL!{#[uuid(0xcfbaf3a, 0x9ff6, 0x429a, 0x99, 0xb3, 0xa2, 0x79, 0x6a, 0xf8, 0xb8, 0x9b)]
927 interface IDirect3DSurface9(IDirect3DSurface9Vtbl): IDirect3DResource9(IDirect3DResource9Vtbl) {
928     fn GetContainer(
929         riid: *const IID,
930         ppContainer: *mut *mut VOID,
931     ) -> HRESULT,
932     fn GetDesc(
933         pDesc: *mut D3DSURFACE_DESC,
934     ) -> HRESULT,
935     fn LockRect(
936         pLockedRect: *mut D3DLOCKED_RECT,
937         pRect: *const RECT,
938         Flags: DWORD,
939     ) -> HRESULT,
940     fn UnlockRect() -> HRESULT,
941     fn GetDC(
942         phdc: *mut HDC,
943     ) -> HRESULT,
944     fn ReleaseDC(
945         hdc: HDC,
946     ) -> HRESULT,
947 }}
948 pub type LPDIRECT3DSURFACE9 = *mut IDirect3DSurface9;
949 pub type PDIRECT3DSURFACE9 = *mut IDirect3DSurface9;
950 RIDL!{#[uuid(0x24f416e6, 0x1f67, 0x4aa7, 0xb8, 0x8e, 0xd3, 0x3f, 0x6f, 0x31, 0x28, 0xa1)]
951 interface IDirect3DVolume9(IDirect3DVolume9Vtbl): IUnknown(IUnknownVtbl) {
952     fn GetDevice(
953         ppDevice: *mut *mut IDirect3DDevice9,
954     ) -> HRESULT,
955     fn SetPrivateData(
956         refguid: *const GUID,
957         pData: *const VOID,
958         SizeOfData: DWORD,
959         Flags: DWORD,
960     ) -> HRESULT,
961     fn GetPrivateData(
962         refguid: *const GUID,
963         pData: *mut VOID,
964         pSizeOfData: *mut DWORD,
965     ) -> HRESULT,
966     fn FreePrivateData(
967         refguid: *const GUID,
968     ) -> HRESULT,
969     fn GetContainer(
970         riid: *const IID,
971         ppContainer: *mut *mut VOID,
972     ) -> HRESULT,
973     fn GetDesc(
974         pDesc: *mut D3DVOLUME_DESC,
975     ) -> HRESULT,
976     fn LockBox(
977         pLockedVolume: *mut D3DLOCKED_BOX,
978         pBox: *const D3DBOX,
979         Flags: DWORD,
980     ) -> HRESULT,
981     fn UnlockBox() -> HRESULT,
982 }}
983 pub type LPDIRECT3DVOLUME9 = *mut IDirect3DVolume9;
984 pub type PDIRECT3DVOLUME9 = *mut IDirect3DVolume9;
985 RIDL!{#[uuid(0xd9771460, 0xa695, 0x4f26, 0xbb, 0xd3, 0x27, 0xb8, 0x40, 0xb5, 0x41, 0xcc)]
986 interface IDirect3DQuery9(IDirect3DQuery9Vtbl): IUnknown(IUnknownVtbl) {
987     fn GetDevice(
988         ppDevice: *mut *mut IDirect3DDevice9,
989     ) -> HRESULT,
990     fn GetType() -> D3DRESOURCETYPE,
991     fn GetDataSize() -> DWORD,
992     fn Issue(
993         dwIssueFlags: DWORD,
994     ) -> HRESULT,
995     fn GetData(
996         pData: *mut VOID,
997         dwSize: DWORD,
998         dwGetDataFlags: DWORD,
999     ) -> HRESULT,
1000 }}
1001 pub type LPDIRECT3DQUERY9 = *mut IDirect3DQuery9;
1002 pub type PDIRECT3DQUERY9 = *mut IDirect3DQuery9;
1003 pub const D3DCREATE_FPU_PRESERVE: DWORD = 0x2;
1004 pub const D3DCREATE_MULTITHREADED: DWORD = 0x4;
1005 pub const D3DCREATE_PUREDEVICE: DWORD = 0x10;
1006 pub const D3DCREATE_SOFTWARE_VERTEXPROCESSING: DWORD = 0x20;
1007 pub const D3DCREATE_HARDWARE_VERTEXPROCESSING: DWORD = 0x40;
1008 pub const D3DCREATE_MIXED_VERTEXPROCESSING: DWORD = 0x80;
1009 pub const D3DCREATE_DISABLE_DRIVER_MANAGEMENT: DWORD = 0x100;
1010 pub const D3DCREATE_ADAPTERGROUP_DEVICE: DWORD = 0x200;
1011 pub const D3DCREATE_DISABLE_DRIVER_MANAGEMENT_EX: DWORD = 0x400;
1012 pub const D3DCREATE_NOWINDOWCHANGES: DWORD = 0x800;
1013 pub const D3DCREATE_DISABLE_PSGP_THREADING: DWORD = 0x2000;
1014 pub const D3DCREATE_ENABLE_PRESENTSTATS: DWORD = 0x4000;
1015 pub const D3DCREATE_DISABLE_PRESENTSTATS: DWORD = 0x8000;
1016 pub const D3DCREATE_SCREENSAVER: DWORD = 0x10000000;
1017 pub const D3DADAPTER_DEFAULT: DWORD = 0;
1018 extern "system" {
Direct3DCreate9Ex( SDKVersion: UINT, arg1: *mut *mut IDirect3D9Ex, ) -> HRESULT1019     pub fn Direct3DCreate9Ex(
1020         SDKVersion: UINT,
1021         arg1: *mut *mut IDirect3D9Ex,
1022     ) -> HRESULT;
1023 }
1024 RIDL!{#[uuid(0x02177241, 0x69fc, 0x400c, 0x8f, 0xf1, 0x93, 0xa4, 0x4d, 0xf6, 0x86, 0x1d)]
1025 interface IDirect3D9Ex(IDirect3D9ExVtbl): IDirect3D9(IDirect3D9Vtbl) {
1026     fn GetAdapterModeCountEx(
1027         Adapter: UINT,
1028         pFilter: *const D3DDISPLAYMODEFILTER,
1029     ) -> UINT,
1030     fn EnumAdapterModesEx(
1031         Adapter: UINT,
1032         pFilter: *const D3DDISPLAYMODEFILTER,
1033         Mode: UINT,
1034         pMode: *mut D3DDISPLAYMODEEX,
1035     ) -> HRESULT,
1036     fn GetAdapterDisplayModeEx(
1037         Adapter: UINT,
1038         pMode: *mut D3DDISPLAYMODEEX,
1039         pRotation: *mut D3DDISPLAYROTATION,
1040     ) -> HRESULT,
1041     fn CreateDeviceEx(
1042         Adapter: UINT,
1043         DeviceType: D3DDEVTYPE,
1044         hFocusWindow: HWND,
1045         BehaviorFlags: DWORD,
1046         pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
1047         pFullscreenDisplayMode: *mut D3DDISPLAYMODEEX,
1048         ppReturnedDeviceInterface: *mut *mut IDirect3DDevice9Ex,
1049     ) -> HRESULT,
1050     fn GetAdapterLUID(
1051         Adapter: UINT,
1052         pLUID: *mut LUID,
1053     ) -> HRESULT,
1054 }}
1055 pub type LPDIRECT3D9EX = *mut IDirect3D9Ex;
1056 pub type PDIRECT3D9EX = *mut IDirect3D9Ex;
1057 RIDL!{#[uuid(0xb18b10ce, 0x2649, 0x405a, 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a)]
1058 interface IDirect3DDevice9Ex(IDirect3DDevice9ExVtbl): IDirect3DDevice9(IDirect3DDevice9Vtbl) {
1059     fn SetConvolutionMonoKernel(
1060         width: UINT,
1061         height: UINT,
1062         rows: *mut FLOAT,
1063         columns: *mut FLOAT,
1064     ) -> HRESULT,
1065     fn ComposeRects(
1066         pSrc: *mut IDirect3DSurface9,
1067         pDst: *mut IDirect3DSurface9,
1068         pSrcRectDescs: *mut IDirect3DVertexBuffer9,
1069         NumRects: UINT,
1070         pDstRectDescs: *mut IDirect3DVertexBuffer9,
1071         Operation: D3DCOMPOSERECTSOP,
1072         Xoffset: INT,
1073         Yoffset: INT,
1074     ) -> HRESULT,
1075     fn PresentEx(
1076         pSourceRect: *const RECT,
1077         pDestRect: *const RECT,
1078         hDestWindowOverride: HWND,
1079         pDirtyRegion: *const RGNDATA,
1080         dwFlags: DWORD,
1081     ) -> HRESULT,
1082     fn GetGPUThreadPriority(
1083         pPriority: *mut INT,
1084     ) -> HRESULT,
1085     fn SetGPUThreadPriority(
1086         Priority: INT,
1087     ) -> HRESULT,
1088     fn WaitForVBlank(
1089         iSwapChain: UINT,
1090     ) -> HRESULT,
1091     fn CheckResourceResidency(
1092         pResourceArray: *mut *mut IDirect3DResource9,
1093         NumResources: UINT32,
1094     ) -> HRESULT,
1095     fn SetMaximumFrameLatency(
1096         MaxLatency: UINT,
1097     ) -> HRESULT,
1098     fn GetMaximumFrameLatency(
1099         pMaxLatency: *mut UINT,
1100     ) -> HRESULT,
1101     fn CheckDeviceState(
1102         hDestinationWindow: HWND,
1103     ) -> HRESULT,
1104     fn CreateRenderTargetEx(
1105         Width: UINT,
1106         Height: UINT,
1107         Format: D3DFORMAT,
1108         MultiSample: D3DMULTISAMPLE_TYPE,
1109         MultisampleQuality: DWORD,
1110         Lockable: BOOL,
1111         ppSurface: *mut *mut IDirect3DSurface9,
1112         pSharedHandle: *mut HANDLE,
1113         Usage: DWORD,
1114     ) -> HRESULT,
1115     fn CreateOffscreenPlainSurfaceEx(
1116         Width: UINT,
1117         Height: UINT,
1118         Format: D3DFORMAT,
1119         Pool: D3DPOOL,
1120         ppSurface: *mut *mut IDirect3DSurface9,
1121         pSharedHandle: *mut HANDLE,
1122         Usage: DWORD,
1123     ) -> HRESULT,
1124     fn CreateDepthStencilSurfaceEx(
1125         Width: UINT,
1126         Height: UINT,
1127         Format: D3DFORMAT,
1128         MultiSample: D3DMULTISAMPLE_TYPE,
1129         MultisampleQuality: DWORD,
1130         Discard: BOOL,
1131         ppSurface: *mut *mut IDirect3DSurface9,
1132         pSharedHandle: *mut HANDLE,
1133         Usage: DWORD,
1134     ) -> HRESULT,
1135     fn ResetEx(
1136         pPresentationParameters: *mut D3DPRESENT_PARAMETERS,
1137         pFullscreenDisplayMode: *mut D3DDISPLAYMODEEX,
1138     ) -> HRESULT,
1139     fn GetDisplayModeEx(
1140         iSwapChain: UINT,
1141         pMode: *mut D3DDISPLAYMODEEX,
1142         pRotation: *mut D3DDISPLAYROTATION,
1143     ) -> HRESULT,
1144 }}
1145 pub type LPDIRECT3DDEVICE9EX = *mut IDirect3DDevice9Ex;
1146 pub type PDIRECT3DDEVICE9EX = *mut IDirect3DDevice9Ex;
1147 RIDL!{#[uuid(0x91886caf, 0x1c3d, 0x4d2e, 0xa0, 0xab, 0x3e, 0x4c, 0x7d, 0x8d, 0x33, 0x3)]
1148 interface IDirect3DSwapChain9Ex(IDirect3DSwapChain9ExVtbl):
1149     IDirect3DSwapChain9(IDirect3DSwapChain9Vtbl) {
1150     fn GetLastPresentCount(
1151         pLastPresentCount: *mut UINT,
1152     ) -> HRESULT,
1153     fn GetPresentStats(
1154         pPresentationStatistics: *mut D3DPRESENTSTATS,
1155     ) -> HRESULT,
1156     fn GetDisplayModeEx(
1157         pMode: *mut D3DDISPLAYMODEEX,
1158         pRotation: *mut D3DDISPLAYROTATION,
1159     ) -> HRESULT,
1160 }}
1161 pub type LPDIRECT3DSWAPCHAIN9EX = *mut IDirect3DSwapChain9Ex;
1162 pub type PDIRECT3DSWAPCHAIN9EX = *mut IDirect3DSwapChain9Ex;
1163 RIDL!{#[uuid(0x187aeb13, 0xaaf5, 0x4c59, 0x87, 0x6d, 0xe0, 0x59, 0x8, 0x8c, 0xd, 0xf8)]
1164 interface IDirect3D9ExOverlayExtension(IDirect3D9ExOverlayExtensionVtbl): IUnknown(IUnknownVtbl) {
1165     fn CheckDeviceOverlayType(
1166         Adapter: UINT,
1167         DevType: D3DDEVTYPE,
1168         OverlayWidth: UINT,
1169         OverlayHeight: UINT,
1170         OverlayFormat: D3DFORMAT,
1171         pDisplayMode: *mut D3DDISPLAYMODEEX,
1172         DisplayRotation: D3DDISPLAYROTATION,
1173         pOverlayCaps: *mut D3DOVERLAYCAPS,
1174     ) -> HRESULT,
1175 }}
1176 pub type LPDIRECT3D9EXOVERLAYEXTENSION = *mut IDirect3D9ExOverlayExtension;
1177 pub type PDIRECT3D9EXOVERLAYEXTENSION = *mut IDirect3D9ExOverlayExtension;
1178 RIDL!{#[uuid(0x26dc4561, 0xa1ee, 0x4ae7, 0x96, 0xda, 0x11, 0x8a, 0x36, 0xc0, 0xec, 0x95)]
1179 interface IDirect3DDevice9Video(IDirect3DDevice9VideoVtbl): IUnknown(IUnknownVtbl) {
1180     fn GetContentProtectionCaps(
1181         pCryptoType: *const GUID,
1182         pDecodeProfile: *const GUID,
1183         pCaps: *mut D3DCONTENTPROTECTIONCAPS,
1184     ) -> HRESULT,
1185     fn CreateAuthenticatedChannel(
1186         ChannelType: D3DAUTHENTICATEDCHANNELTYPE,
1187         ppAuthenticatedChannel: *mut *mut IDirect3DAuthenticatedChannel9,
1188         pChannelHandle: *mut HANDLE,
1189     ) -> HRESULT,
1190     fn CreateCryptoSession(
1191         pCryptoType: *const GUID,
1192         pDecodeProfile: *const GUID,
1193         ppCryptoSession: *mut *mut IDirect3DCryptoSession9,
1194         pCryptoHandle: *mut HANDLE,
1195     ) -> HRESULT,
1196 }}
1197 pub type LPDIRECT3DDEVICE9VIDEO = *mut IDirect3DDevice9Video;
1198 pub type PDIRECT3DDEVICE9VIDEO = *mut IDirect3DDevice9Video;
1199 RIDL!{#[uuid(0xff24beee, 0xda21, 0x4beb, 0x98, 0xb5, 0xd2, 0xf8, 0x99, 0xf9, 0x8a, 0xf9)]
1200 interface IDirect3DAuthenticatedChannel9(IDirect3DAuthenticatedChannel9Vtbl):
1201     IUnknown(IUnknownVtbl) {
1202     fn GetCertificateSize(
1203         pCertificateSize: *mut UINT,
1204     ) -> HRESULT,
1205     fn GetCertificate(
1206         CertifacteSize: UINT,
1207         ppCertificate: *mut BYTE,
1208     ) -> HRESULT,
1209     fn NegotiateKeyExchange(
1210         DataSize: UINT,
1211         pData: *mut VOID,
1212     ) -> HRESULT,
1213     fn Query(
1214         InputSize: UINT,
1215         pInput: *const VOID,
1216         OutputSize: UINT,
1217         pOutput: *mut VOID,
1218     ) -> HRESULT,
1219     fn Configure(
1220         InputSize: UINT,
1221         pInput: *const VOID,
1222         pOutput: *mut D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT,
1223     ) -> HRESULT,
1224 }}
1225 pub type LPDIRECT3DAUTHENTICATEDCHANNEL9 = *mut IDirect3DAuthenticatedChannel9;
1226 pub type PDIRECT3DAUTHENTICATEDCHANNEL9 = *mut IDirect3DAuthenticatedChannel9;
1227 RIDL!{#[uuid(0xfa0ab799, 0x7a9c, 0x48ca, 0x8c, 0x5b, 0x23, 0x7e, 0x71, 0xa5, 0x44, 0x34)]
1228 interface IDirect3DCryptoSession9(IDirect3DCryptoSession9Vtbl): IUnknown(IUnknownVtbl) {
1229     fn GetCertificateSize(
1230         pCertificateSize: *mut UINT,
1231     ) -> HRESULT,
1232     fn GetCertificate(
1233         CertifacteSize: UINT,
1234         ppCertificate: *mut BYTE,
1235     ) -> HRESULT,
1236     fn NegotiateKeyExchange(
1237         DataSize: UINT,
1238         pData: *mut VOID,
1239     ) -> HRESULT,
1240     fn EncryptionBlt(
1241         pSrcSurface: *mut IDirect3DSurface9,
1242         pDstSurface: *mut IDirect3DSurface9,
1243         DstSurfaceSize: UINT,
1244         pIV: *mut VOID,
1245     ) -> HRESULT,
1246     fn DecryptionBlt(
1247         pSrcSurface: *mut IDirect3DSurface9,
1248         pDstSurface: *mut IDirect3DSurface9,
1249         SrcSurfaceSize: UINT,
1250         pEncryptedBlockInfo: *mut D3DENCRYPTED_BLOCK_INFO,
1251         pContentKey: *mut VOID,
1252         pIV: *mut VOID,
1253     ) -> HRESULT,
1254     fn GetSurfacePitch(
1255         pSrcSurface: *mut IDirect3DSurface9,
1256         pSurfacePitch: *mut UINT,
1257     ) -> HRESULT,
1258     fn StartSessionKeyRefresh(
1259         pRandomNumber: *mut VOID,
1260         RandomNumberSize: UINT,
1261     ) -> HRESULT,
1262     fn FinishSessionKeyRefresh() -> HRESULT,
1263     fn GetEncryptionBltKey(
1264         pReadbackKey: *mut VOID,
1265         KeySize: UINT,
1266     ) -> HRESULT,
1267 }}
1268 pub type LPDIRECT3DCRYPTOSESSION9 = *mut IDirect3DCryptoSession9;
1269 pub type PDIRECT3DCRYPTOSESSION9 = *mut IDirect3DCryptoSession9;
1270