1 module directx.d3d7;
2 
3 version(Windows):
4 
5 import directx.win32;
6 import directx.com;
7 import directx.d3dcommon;
8 
9 enum DD_ROP_SPACE = 256 / 32;
10 
11 struct DDSCAPS {
12     DWORD dwCaps;         // capabilities of surface wanted
13 }
14 alias LPDDSCAPS = DDSCAPS*;
15 
16 enum {
17     DDSD_CAPS              = 0x00000001,
18     DDSD_HEIGHT            = 0x00000002,
19     DDSD_WIDTH             = 0x00000004,
20     DDSD_PITCH             = 0x00000008,
21     DDSD_BACKBUFFERCOUNT   = 0x00000020,
22     DDSD_ZBUFFERBITDEPTH   = 0x00000040,
23     DDSD_ALPHABITDEPTH     = 0x00000080,
24     DDSD_LPSURFACE         = 0x00000800,
25     DDSD_PIXELFORMAT       = 0x00001000,
26     DDSD_CKDESTOVERLAY     = 0x00002000,
27     DDSD_CKDESTBLT         = 0x00004000,
28     DDSD_CKSRCOVERLAY      = 0x00008000,
29     DDSD_CKSRCBLT          = 0x00010000,
30     DDSD_MIPMAPCOUNT       = 0x00020000,
31     DDSD_REFRESHRATE       = 0x00040000,
32     DDSD_LINEARSIZE        = 0x00080000,
33     DDSD_TEXTURESTAGE      = 0x00100000,
34     DDSD_FVF               = 0x00200000,
35     DDSD_SRCVBHANDLE       = 0x00400000,
36     DDSD_DEPTH             = 0x00800000,
37     DDSD_ALL               = 0x00fff9ee
38 }
39 
40 enum {
41     DDSCAPS_RESERVED1                      = 0x00000001,
42     DDSCAPS_ALPHA                          = 0x00000002,
43     DDSCAPS_BACKBUFFER                     = 0x00000004,
44     DDSCAPS_COMPLEX                        = 0x00000008,
45     DDSCAPS_FLIP                           = 0x00000010,
46     DDSCAPS_FRONTBUFFER                    = 0x00000020,
47     DDSCAPS_OFFSCREENPLAIN                 = 0x00000040,
48     DDSCAPS_OVERLAY                        = 0x00000080,
49     DDSCAPS_PALETTE                        = 0x00000100,
50     DDSCAPS_PRIMARYSURFACE                 = 0x00000200,
51     DDSCAPS_RESERVED3                      = 0x00000400,
52     DDSCAPS_PRIMARYSURFACELEFT             = 0x00000000,
53     DDSCAPS_SYSTEMMEMORY                   = 0x00000800,
54     DDSCAPS_TEXTURE                        = 0x00001000,
55     DDSCAPS_3DDEVICE                       = 0x00002000,
56     DDSCAPS_VIDEOMEMORY                    = 0x00004000,
57     DDSCAPS_VISIBLE                        = 0x00008000,
58     DDSCAPS_WRITEONLY                      = 0x00010000,
59     DDSCAPS_ZBUFFER                        = 0x00020000,
60     DDSCAPS_OWNDC                          = 0x00040000,
61     DDSCAPS_LIVEVIDEO                      = 0x00080000,
62     DDSCAPS_HWCODEC                        = 0x00100000,
63     DDSCAPS_MODEX                          = 0x00200000,
64     DDSCAPS_MIPMAP                         = 0x00400000,
65     DDSCAPS_RESERVED2                      = 0x00800000,
66     DDSCAPS_ALLOCONLOAD                    = 0x04000000,
67     DDSCAPS_VIDEOPORT                      = 0x08000000,
68     DDSCAPS_LOCALVIDMEM                    = 0x10000000,
69     DDSCAPS_NONLOCALVIDMEM                 = 0x20000000,
70     DDSCAPS_STANDARDVGAMODE                = 0x40000000,
71     DDSCAPS_OPTIMIZED                      = 0x80000000,
72     DDSCAPS2_RESERVED4                     = 0x00000002,
73     DDSCAPS2_HARDWAREDEINTERLACE           = 0x00000000,
74     DDSCAPS2_HINTDYNAMIC                   = 0x00000004,
75     DDSCAPS2_HINTSTATIC                    = 0x00000008,
76     DDSCAPS2_TEXTUREMANAGE                 = 0x00000010,
77     DDSCAPS2_RESERVED1                     = 0x00000020,
78     DDSCAPS2_RESERVED2                     = 0x00000040,
79     DDSCAPS2_OPAQUE                        = 0x00000080,
80     DDSCAPS2_HINTANTIALIASING              = 0x00000100,
81     DDSCAPS2_CUBEMAP                       = 0x00000200,
82     DDSCAPS2_CUBEMAP_POSITIVEX             = 0x00000400,
83     DDSCAPS2_CUBEMAP_NEGATIVEX             = 0x00000800,
84     DDSCAPS2_CUBEMAP_POSITIVEY             = 0x00001000,
85     DDSCAPS2_CUBEMAP_NEGATIVEY             = 0x00002000,
86     DDSCAPS2_CUBEMAP_POSITIVEZ             = 0x00004000,
87     DDSCAPS2_CUBEMAP_NEGATIVEZ             = 0x00008000,
88     DDSCAPS2_CUBEMAP_ALLFACES = DDSCAPS2_CUBEMAP_POSITIVEX |
89         DDSCAPS2_CUBEMAP_NEGATIVEX |
90         DDSCAPS2_CUBEMAP_POSITIVEY |
91         DDSCAPS2_CUBEMAP_NEGATIVEY |
92         DDSCAPS2_CUBEMAP_POSITIVEZ |
93         DDSCAPS2_CUBEMAP_NEGATIVEZ,
94     DDSCAPS2_MIPMAPSUBLEVEL                = 0x00010000,
95     DDSCAPS2_D3DTEXTUREMANAGE              = 0x00020000,
96     DDSCAPS2_DONOTPERSIST                  = 0x00040000,
97     DDSCAPS2_STEREOSURFACELEFT             = 0x00080000,
98     DDSCAPS2_VOLUME                        = 0x00200000,
99     DDSCAPS2_NOTUSERLOCKABLE               = 0x00400000,
100     DDSCAPS2_POINTS                        = 0x00800000,
101     DDSCAPS2_RTPATCHES                     = 0x01000000,
102     DDSCAPS2_NPATCHES                      = 0x02000000,
103     DDSCAPS2_RESERVED3                     = 0x04000000,
104     DDSCAPS2_DISCARDBACKBUFFER             = 0x10000000,
105     DDSCAPS2_ENABLEALPHACHANNEL            = 0x20000000,
106     DDSCAPS2_EXTENDEDFORMATPRIMARY         = 0x40000000,
107     DDSCAPS2_ADDITIONALPRIMARY             = 0x80000000,
108     DDSCAPS3_MULTISAMPLE_MASK              = 0x0000001F,
109     DDSCAPS3_MULTISAMPLE_QUALITY_MASK      = 0x000000E0,
110     DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT     = 5,
111     DDSCAPS3_RESERVED1                     = 0x00000100,
112     DDSCAPS3_RESERVED2                     = 0x00000200,
113     DDSCAPS3_LIGHTWEIGHTMIPMAP             = 0x00000400,
114     DDSCAPS3_AUTOGENMIPMAP                 = 0x00000800,
115     DDSCAPS3_DMAP                          = 0x00001000,
116 
117     /* D3D9Ex only -- */
118     DDSCAPS3_CREATESHAREDRESOURCE          = 0x00002000,
119     DDSCAPS3_READONLYRESOURCE              = 0x00004000,
120     DDSCAPS3_OPENSHAREDRESOURCE            = 0x00008000
121 }
122 
123 struct DDCAPS_DX7 {
124     /*  0*/ DWORD   dwSize;                 // size of the DDDRIVERCAPS structure
125     /*  4*/ DWORD   dwCaps;                 // driver specific capabilities
126     /*  8*/ DWORD   dwCaps2;                // more driver specific capabilites
127     /*  c*/ DWORD   dwCKeyCaps;             // color key capabilities of the surface
128     /* 10*/ DWORD   dwFXCaps;               // driver specific stretching and effects capabilites
129     /* 14*/ DWORD   dwFXAlphaCaps;          // alpha driver specific capabilities
130     /* 18*/ DWORD   dwPalCaps;              // palette capabilities
131     /* 1c*/ DWORD   dwSVCaps;               // stereo vision capabilities
132     /* 20*/ DWORD   dwAlphaBltConstBitDepths;       // DDBD_2,4,8
133     /* 24*/ DWORD   dwAlphaBltPixelBitDepths;       // DDBD_1,2,4,8
134     /* 28*/ DWORD   dwAlphaBltSurfaceBitDepths;     // DDBD_1,2,4,8
135     /* 2c*/ DWORD   dwAlphaOverlayConstBitDepths;   // DDBD_2,4,8
136     /* 30*/ DWORD   dwAlphaOverlayPixelBitDepths;   // DDBD_1,2,4,8
137     /* 34*/ DWORD   dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8
138     /* 38*/ DWORD   dwZBufferBitDepths;             // DDBD_8,16,24,32
139     /* 3c*/ DWORD   dwVidMemTotal;          // total amount of video memory
140     /* 40*/ DWORD   dwVidMemFree;           // amount of free video memory
141     /* 44*/ DWORD   dwMaxVisibleOverlays;   // maximum number of visible overlays
142     /* 48*/ DWORD   dwCurrVisibleOverlays;  // current number of visible overlays
143     /* 4c*/ DWORD   dwNumFourCCCodes;       // number of four cc codes
144     /* 50*/ DWORD   dwAlignBoundarySrc;     // source rectangle alignment
145     /* 54*/ DWORD   dwAlignSizeSrc;         // source rectangle byte size
146     /* 58*/ DWORD   dwAlignBoundaryDest;    // dest rectangle alignment
147     /* 5c*/ DWORD   dwAlignSizeDest;        // dest rectangle byte size
148     /* 60*/ DWORD   dwAlignStrideAlign;     // stride alignment
149     /* 64*/ DWORD[DD_ROP_SPACE]   dwRops;   // ROPS supported
150     /* 84*/ DDSCAPS ddsOldCaps;             // Was DDSCAPS  ddsCaps. ddsCaps is of type DDSCAPS2 for DX6
151     /* 88*/ DWORD   dwMinOverlayStretch;    // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
152     /* 8c*/ DWORD   dwMaxOverlayStretch;    // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
153     /* 90*/ DWORD   dwMinLiveVideoStretch;  // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
154     /* 94*/ DWORD   dwMaxLiveVideoStretch;  // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
155     /* 98*/ DWORD   dwMinHwCodecStretch;    // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
156     /* 9c*/ DWORD   dwMaxHwCodecStretch;    // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3
157     /* a0*/ DWORD   dwReserved1;            // reserved
158     /* a4*/ DWORD   dwReserved2;            // reserved
159     /* a8*/ DWORD   dwReserved3;            // reserved
160     /* ac*/ DWORD   dwSVBCaps;              // driver specific capabilities for System->Vmem blts
161     /* b0*/ DWORD   dwSVBCKeyCaps;          // driver color key capabilities for System->Vmem blts
162     /* b4*/ DWORD   dwSVBFXCaps;            // driver FX capabilities for System->Vmem blts
163     /* b8*/ DWORD[DD_ROP_SPACE]   dwSVBRops;// ROPS supported for System->Vmem blts
164     /* d8*/ DWORD   dwVSBCaps;              // driver specific capabilities for Vmem->System blts
165     /* dc*/ DWORD   dwVSBCKeyCaps;          // driver color key capabilities for Vmem->System blts
166     /* e0*/ DWORD   dwVSBFXCaps;            // driver FX capabilities for Vmem->System blts
167     /* e4*/ DWORD[DD_ROP_SPACE]   dwVSBRops;// ROPS supported for Vmem->System blts
168     /*104*/ DWORD   dwSSBCaps;              // driver specific capabilities for System->System blts
169     /*108*/ DWORD   dwSSBCKeyCaps;          // driver color key capabilities for System->System blts
170     /*10c*/ DWORD   dwSSBFXCaps;            // driver FX capabilities for System->System blts
171     /*110*/ DWORD[DD_ROP_SPACE]   dwSSBRops;// ROPS supported for System->System blts
172     /*130*/ DWORD   dwMaxVideoPorts;        // maximum number of usable video ports
173     /*134*/ DWORD   dwCurrVideoPorts;       // current number of video ports used
174     /*138*/ DWORD   dwSVBCaps2;             // more driver specific capabilities for System->Vmem blts
175     /*13c*/ DWORD   dwNLVBCaps;               // driver specific capabilities for non-local->local vidmem blts
176     /*140*/ DWORD   dwNLVBCaps2;              // more driver specific capabilities non-local->local vidmem blts
177     /*144*/ DWORD   dwNLVBCKeyCaps;           // driver color key capabilities for non-local->local vidmem blts
178     /*148*/ DWORD   dwNLVBFXCaps;             // driver FX capabilities for non-local->local blts
179     /*14c*/ DWORD[DD_ROP_SPACE]   dwNLVBRops; // ROPS supported for non-local->local blts
180     // Members added for DX6 release
181     /*16c*/ DDSCAPS2 ddsCaps;               // Surface Caps
182 }
183 alias LPDDCAPS_DX7 = DDCAPS_DX7*;
184 
185 alias DDCAPS   = DDCAPS_DX7;
186 alias LPDDCAPS = LPDDCAPS_DX7;
187 
188 struct DDCOLORKEY {
189     DWORD       dwColorSpaceLowValue;   // low boundary of color space that is to
190     // be treated as Color Key, inclusive
191     DWORD       dwColorSpaceHighValue;  // high boundary of color space that is
192     // to be treated as Color Key, inclusive
193 }
194 alias LPDDCOLORKEY = DDCOLORKEY*;
195 
196 enum MAX_DDDEVICEID_STRING = 512;
197 
198 struct DDDEVICEIDENTIFIER2 {
199     /*
200     * These elements are for presentation to the user only. They should not be used to identify particular
201     * drivers, since this is unreliable and many different strings may be associated with the same
202     * device, and the same driver from different vendors.
203     */
204     char[MAX_DDDEVICEID_STRING]    szDriver;
205     char[MAX_DDDEVICEID_STRING]    szDescription;
206 
207     /*
208     * This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
209     * on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
210     * drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
211     *
212     * This version has the form:
213     *  wProduct = HIWORD(liDriverVersion.HighPart)
214     *  wVersion = LOWORD(liDriverVersion.HighPart)
215     *  wSubVersion = HIWORD(liDriverVersion.LowPart)
216     *  wBuild = LOWORD(liDriverVersion.LowPart)
217     */
218     //    #ifdef _WIN32
219     LARGE_INTEGER liDriverVersion;      /* Defined for applications and other 32 bit components */
220     //    #else
221     //        DWORD   dwDriverVersionLowPart;     /* Defined for 16 bit driver components */
222     //        DWORD   dwDriverVersionHighPart;
223     //    #endif
224 
225 
226     /*
227     * These elements can be used to identify particular chipsets. Use with extreme caution.
228     *   dwVendorId     Identifies the manufacturer. May be zero if unknown.
229     *   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
230     *   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
231     *   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
232     */
233     DWORD   dwVendorId;
234     DWORD   dwDeviceId;
235     DWORD   dwSubSysId;
236     DWORD   dwRevision;
237 
238     /*
239     * This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
240     * driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
241     * reprofile the graphics subsystem.
242     * This element can also be used to identify particular problematic drivers.
243     */
244     GUID    guidDeviceIdentifier;
245 
246     /*
247     * This element is used to determine the Windows Hardware Quality Lab (WHQL)
248     * certification level for this driver/device pair.
249     */
250     DWORD   dwWHQLLevel;
251 }
252 alias LPDDDEVICEIDENTIFIER2 = DDDEVICEIDENTIFIER2*;
253 
254 struct DDPIXELFORMAT {
255     DWORD       dwSize;                 // size of structure
256     DWORD       dwFlags;                // pixel format flags
257     DWORD       dwFourCC;               // (FOURCC code)
258     union {
259         DWORD   dwRGBBitCount;          // how many bits per pixel
260         DWORD   dwYUVBitCount;          // how many bits per pixel
261         DWORD   dwZBufferBitDepth;      // how many total bits/pixel in z buffer (including any stencil bits)
262         DWORD   dwAlphaBitDepth;        // how many bits for alpha channels
263         DWORD   dwLuminanceBitCount;    // how many bits per pixel
264         DWORD   dwBumpBitCount;         // how many bits per "buxel", total
265         DWORD   dwPrivateFormatBitCount;// Bits per pixel of private driver formats. Only valid in texture
266         // format list and if DDPF_D3DFORMAT is set
267     }
268     union {
269         DWORD   dwRBitMask;             // mask for red bit
270         DWORD   dwYBitMask;             // mask for Y bits
271         DWORD   dwStencilBitDepth;      // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits)
272         DWORD   dwLuminanceBitMask;     // mask for luminance bits
273         DWORD   dwBumpDuBitMask;        // mask for bump map U delta bits
274         DWORD   dwOperations;           // DDPF_D3DFORMAT Operations
275     }
276     union {
277         DWORD   dwGBitMask;             // mask for green bits
278         DWORD   dwUBitMask;             // mask for U bits
279         DWORD   dwZBitMask;             // mask for Z bits
280         DWORD   dwBumpDvBitMask;        // mask for bump map V delta bits
281         struct {
282             WORD    wFlipMSTypes;       // Multisample methods supported via flip for this D3DFORMAT
283             WORD    wBltMSTypes;        // Multisample methods supported via blt for this D3DFORMAT
284         }
285 
286     }
287     union {
288         DWORD   dwBBitMask;             // mask for blue bits
289         DWORD   dwVBitMask;             // mask for V bits
290         DWORD   dwStencilBitMask;       // mask for stencil bits
291         DWORD   dwBumpLuminanceBitMask; // mask for luminance in bump map
292     }
293     union {
294         DWORD   dwRGBAlphaBitMask;      // mask for alpha channel
295         DWORD   dwYUVAlphaBitMask;      // mask for alpha channel
296         DWORD   dwLuminanceAlphaBitMask;// mask for alpha channel
297         DWORD   dwRGBZBitMask;          // mask for Z channel
298         DWORD   dwYUVZBitMask;          // mask for Z channel
299     }
300 }
301 alias LPDDPIXELFORMAT = DDPIXELFORMAT*;
302 
303 struct DDSCAPS2 {
304     DWORD       dwCaps;         // capabilities of surface wanted
305     DWORD       dwCaps2;
306     DWORD       dwCaps3;
307     union {
308         DWORD       dwCaps4;
309         DWORD       dwVolumeDepth;
310     }
311 }
312 alias LPDDSCAPS2 = DDSCAPS2*;
313 
314 struct DDSURFACEDESC2 {
315     DWORD               dwSize;                 // size of the DDSURFACEDESC structure
316     DWORD               dwFlags;                // determines what fields are valid
317     DWORD               dwHeight;               // height of surface to be created
318     DWORD               dwWidth;                // width of input surface
319     union {
320         LONG            lPitch;                 // distance to start of next line (return value only)
321         DWORD           dwLinearSize;           // Formless late-allocated optimized surface size
322     }
323     union {
324         DWORD           dwBackBufferCount;      // number of back buffers requested
325         DWORD           dwDepth;                // the depth if this is a volume texture
326     }
327     union {
328         DWORD           dwMipMapCount;          // number of mip-map levels requestde
329         // dwZBufferBitDepth removed, use ddpfPixelFormat one instead
330         DWORD           dwRefreshRate;          // refresh rate (used when display mode is described)
331         DWORD           dwSrcVBHandle;          // The source used in VB::Optimize
332     }
333     DWORD               dwAlphaBitDepth;        // depth of alpha buffer requested
334     DWORD               dwReserved;             // reserved
335     LPVOID              lpSurface;              // pointer to the associated surface memory
336     union {
337         DDCOLORKEY      ddckCKDestOverlay;      // color key for destination overlay use
338         DWORD           dwEmptyFaceColor;       // Physical color for empty cubemap faces
339     }
340     DDCOLORKEY          ddckCKDestBlt;          // color key for destination blt use
341     DDCOLORKEY          ddckCKSrcOverlay;       // color key for source overlay use
342     DDCOLORKEY          ddckCKSrcBlt;           // color key for source blt use
343     union {
344         DDPIXELFORMAT   ddpfPixelFormat;        // pixel format description of the surface
345         DWORD           dwFVF;                  // vertex format description of vertex buffers
346     }
347     DDSCAPS2            ddsCaps;                // direct draw surface capabilities
348     DWORD               dwTextureStage;         // stage in multitexture cascade
349 }
350 alias LPDDSURFACEDESC2 = DDSURFACEDESC2*;
351 
352 mixin(uuid!(IDirectDraw7, "15e65ec0-3b9c-11d2-b92f-00609797ea5b"));
353 extern (C++) interface IDirectDraw7 : IUnknown {
354     HRESULT Compact();
355     HRESULT CreateClipper(DWORD, LPDIRECTDRAWCLIPPER*, IUnknown);
356     HRESULT CreatePalette(DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE*, IUnknown);
357     HRESULT CreateSurface(LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE7*, IUnknown);
358     HRESULT DuplicateSurface(LPDIRECTDRAWSURFACE7, LPDIRECTDRAWSURFACE7*);
359     HRESULT EnumDisplayModes(DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2);
360     HRESULT EnumSurfaces(DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMSURFACESCALLBACK7);
361     HRESULT FlipToGDISurface();
362     HRESULT GetCaps(LPDDCAPS, LPDDCAPS);
363     HRESULT GetDisplayMode(LPDDSURFACEDESC2);
364     HRESULT GetFourCCCodes(LPDWORD, LPDWORD );
365     HRESULT GetGDISurface(LPDIRECTDRAWSURFACE7*);
366     HRESULT GetMonitorFrequency(LPDWORD);
367     HRESULT GetScanLine(LPDWORD);
368     HRESULT GetVerticalBlankStatus(LPBOOL);
369     HRESULT Initialize(GUID*);
370     HRESULT RestoreDisplayMode();
371     HRESULT SetCooperativeLevel(HWND, DWORD);
372     HRESULT SetDisplayMode(DWORD, DWORD, DWORD, DWORD, DWORD);
373     HRESULT WaitForVerticalBlank(DWORD, HANDLE);
374     /*** Added in the v2 interface ***/
375     HRESULT GetAvailableVidMem(LPDDSCAPS2, LPDWORD, LPDWORD);
376     /*** Added in the V4 Interface ***/
377     HRESULT GetSurfaceFromDC(HDC, LPDIRECTDRAWSURFACE7*);
378     HRESULT RestoreAllSurfaces();
379     HRESULT TestCooperativeLevel();
380     HRESULT GetDeviceIdentifier(LPDDDEVICEIDENTIFIER2, DWORD);
381     HRESULT StartModeTest(LPSIZE, DWORD, DWORD);
382     HRESULT EvaluateMode(DWORD, DWORD*);
383 }
384 
385 extern (C++) interface IDirectDrawClipper : IUnknown {
386 
387 }
388 alias LPDIRECTDRAWCLIPPER = IDirectDrawClipper;
389 
390 extern (C++) interface IDirectDrawPalette : IUnknown {
391 
392 }
393 alias LPDIRECTDRAWPALETTE = IDirectDrawPalette;
394 
395 extern (C++) interface IDirectDrawSurface7 : IUnknown {
396 
397 }
398 alias LPDIRECTDRAWSURFACE7 = IDirectDrawSurface7;
399 
400 extern (Windows) {
401     alias LPD3DVALIDATECALLBACK = HRESULT function(LPVOID lpUserArg, DWORD dwOffset);
402     //alias LPD3DENUMTEXTUREFORMATSCALLBACK = HRESULT function(LPDDSURFACEDESC lpDdsd, LPVOID lpContext);
403     alias LPD3DENUMPIXELFORMATSCALLBACK = HRESULT function(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext);
404 
405     alias LPD3DENUMDEVICESCALLBACK7 = HRESULT function
406         (LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC7, LPVOID);
407 }
408 
409 struct D3DVERTEXBUFFERDESC {
410     DWORD dwSize;
411     DWORD dwCaps;
412     DWORD dwFVF;
413     DWORD dwNumVertices;
414 }
415 alias LPD3DVERTEXBUFFERDESC = D3DVERTEXBUFFERDESC*;
416 
417 alias D3DVALUE   = float;
418 alias LPD3DVALUE = D3DVALUE*;
419 
420 struct D3DPRIMCAPS {
421     DWORD dwSize;
422     DWORD dwMiscCaps;                 /* Capability flags */
423     DWORD dwRasterCaps;
424     DWORD dwZCmpCaps;
425     DWORD dwSrcBlendCaps;
426     DWORD dwDestBlendCaps;
427     DWORD dwAlphaCmpCaps;
428     DWORD dwShadeCaps;
429     DWORD dwTextureCaps;
430     DWORD dwTextureFilterCaps;
431     DWORD dwTextureBlendCaps;
432     DWORD dwTextureAddressCaps;
433     DWORD dwStippleWidth;             /* maximum width and height of */
434     DWORD dwStippleHeight;            /* of supported stipple (up to 32x32) */
435 }
436 alias LPD3DPRIMCAPS = D3DPRIMCAPS*;
437 
438 struct D3DDEVICEDESC7 {
439     DWORD            dwDevCaps;              /* Capabilities of device */
440     D3DPRIMCAPS      dpcLineCaps;
441     D3DPRIMCAPS      dpcTriCaps;
442     DWORD            dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */
443     DWORD            dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */
444 
445     DWORD       dwMinTextureWidth, dwMinTextureHeight;
446     DWORD       dwMaxTextureWidth, dwMaxTextureHeight;
447 
448     DWORD       dwMaxTextureRepeat;
449     DWORD       dwMaxTextureAspectRatio;
450     DWORD       dwMaxAnisotropy;
451 
452     D3DVALUE    dvGuardBandLeft;
453     D3DVALUE    dvGuardBandTop;
454     D3DVALUE    dvGuardBandRight;
455     D3DVALUE    dvGuardBandBottom;
456 
457     D3DVALUE    dvExtentsAdjust;
458     DWORD       dwStencilCaps;
459 
460     DWORD       dwFVFCaps;
461     DWORD       dwTextureOpCaps;
462     WORD        wMaxTextureBlendStages;
463     WORD        wMaxSimultaneousTextures;
464 
465     DWORD       dwMaxActiveLights;
466     D3DVALUE    dvMaxVertexW;
467     GUID        deviceGUID;
468 
469     WORD        wMaxUserClipPlanes;
470     WORD        wMaxVertexBlendMatrices;
471 
472     DWORD       dwVertexProcessingCaps;
473 
474     DWORD       dwReserved1;
475     DWORD       dwReserved2;
476     DWORD       dwReserved3;
477     DWORD       dwReserved4;
478 }
479 alias LPD3DDEVICEDESC7 = D3DDEVICEDESC7*;
480 
481 mixin(uuid!(IDirect3D7, "f5049e77-4861-11d2-a407-00a0c90629a8"));
482 extern (C++) interface IDirect3D7 : IUnknown {
483     HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK7,LPVOID);
484     HRESULT CreateDevice(REFCLSID,LPDIRECTDRAWSURFACE7,LPDIRECT3DDEVICE7*);
485     HRESULT CreateVertexBuffer(LPD3DVERTEXBUFFERDESC,LPDIRECT3DVERTEXBUFFER7*,DWORD);
486     HRESULT EnumZBufferFormats(REFCLSID,LPD3DENUMPIXELFORMATSCALLBACK,LPVOID);
487     HRESULT EvictManagedTextures();
488 }
489 alias LPDIRECT3D7 = IDirect3D7;
490 
491 struct D3DCLIPSTATUS {
492     DWORD dwFlags; /* Do we set 2d extents, 3D extents or status */
493     DWORD dwStatus; /* Clip status */
494     float minx, maxx; /* X extents */
495     float miny, maxy; /* Y extents */
496     float minz, maxz; /* Z extents */
497 }
498 alias LPD3DCLIPSTATUS = D3DCLIPSTATUS*;
499 
500 enum {
501     D3DCLIPSTATUS_STATUS       = 0x00000001,
502     D3DCLIPSTATUS_EXTENTS2     = 0x00000002,
503     D3DCLIPSTATUS_EXTENTS3     = 0x00000004
504 }
505 
506 struct D3DVIEWPORT7 {
507     DWORD       dwX;
508     DWORD       dwY;            /* Viewport Top left */
509     DWORD       dwWidth;
510     DWORD       dwHeight;       /* Viewport Dimensions */
511     D3DVALUE    dvMinZ;         /* Min/max of clip Volume */
512     D3DVALUE    dvMaxZ;
513 }
514 alias LPD3DVIEWPORT7 = D3DVIEWPORT7*;
515 
516 struct D3DMATERIAL7 {
517     union {
518         D3DCOLORVALUE   diffuse;        /* Diffuse color RGBA */
519         D3DCOLORVALUE   dcvDiffuse;
520     }
521     union {
522         D3DCOLORVALUE   ambient;        /* Ambient color RGB */
523         D3DCOLORVALUE   dcvAmbient;
524     }
525     union {
526         D3DCOLORVALUE   specular;       /* Specular 'shininess' */
527         D3DCOLORVALUE   dcvSpecular;
528     }
529     union {
530         D3DCOLORVALUE   emissive;       /* Emissive color RGB */
531         D3DCOLORVALUE   dcvEmissive;
532     }
533     union {
534         D3DVALUE        power;          /* Sharpness if specular highlight */
535         D3DVALUE        dvPower;
536     }
537 }
538 alias LPD3DMATERIAL7 = D3DMATERIAL7*;
539 
540 struct D3DLIGHT7 {
541     D3DLIGHTTYPE    dltType;            /* Type of light source */
542     D3DCOLORVALUE   dcvDiffuse;         /* Diffuse color of light */
543     D3DCOLORVALUE   dcvSpecular;        /* Specular color of light */
544     D3DCOLORVALUE   dcvAmbient;         /* Ambient color of light */
545     D3DVECTOR       dvPosition;         /* Position in world space */
546     D3DVECTOR       dvDirection;        /* Direction in world space */
547     D3DVALUE        dvRange;            /* Cutoff range */
548     D3DVALUE        dvFalloff;          /* Falloff */
549     D3DVALUE        dvAttenuation0;     /* Constant attenuation */
550     D3DVALUE        dvAttenuation1;     /* Linear attenuation */
551     D3DVALUE        dvAttenuation2;     /* Quadratic attenuation */
552     D3DVALUE        dvTheta;            /* Inner angle of spotlight cone */
553     D3DVALUE        dvPhi;              /* Outer angle of spotlight cone */
554 }
555 alias LPD3DLIGHT7 = D3DLIGHT7*;
556 
557 struct D3DDP_PTRSTRIDE {
558     LPVOID lpvData;
559     DWORD  dwStride;
560 }
561 
562 enum D3DDP_MAXTEXCOORD = 8;
563 
564 struct D3DDRAWPRIMITIVESTRIDEDDATA {
565     D3DDP_PTRSTRIDE position;
566     D3DDP_PTRSTRIDE normal;
567     D3DDP_PTRSTRIDE diffuse;
568     D3DDP_PTRSTRIDE specular;
569     D3DDP_PTRSTRIDE[D3DDP_MAXTEXCOORD] textureCoords;
570 }
571 alias LPD3DDRAWPRIMITIVESTRIDEDDATA = D3DDRAWPRIMITIVESTRIDEDDATA*;
572 
573 mixin(uuid!(IDirect3DDevice7, "f5049e79-4861-11d2-a407-00a0c90629a8"));
574 extern (C++) interface IDirect3DDevice7 : IUnknown {
575     HRESULT GetCaps(LPD3DDEVICEDESC7);
576     HRESULT EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK,LPVOID);
577     HRESULT BeginScene();
578     HRESULT EndScene();
579     HRESULT GetDirect3D(LPDIRECT3D7*);
580     HRESULT SetRenderTarget(LPDIRECTDRAWSURFACE7,DWORD);
581     HRESULT GetRenderTarget(LPDIRECTDRAWSURFACE7 *);
582     HRESULT Clear(DWORD,LPD3DRECT,DWORD,D3DCOLOR,D3DVALUE,DWORD);
583     HRESULT SetTransform(D3DTRANSFORMSTATETYPE,LPD3DMATRIX);
584     HRESULT GetTransform(D3DTRANSFORMSTATETYPE,LPD3DMATRIX);
585     HRESULT SetViewport(LPD3DVIEWPORT7);
586     HRESULT MultiplyTransform(D3DTRANSFORMSTATETYPE,LPD3DMATRIX);
587     HRESULT GetViewport(LPD3DVIEWPORT7);
588     HRESULT SetMaterial(LPD3DMATERIAL7);
589     HRESULT GetMaterial(LPD3DMATERIAL7);
590     HRESULT SetLight(DWORD,LPD3DLIGHT7);
591     HRESULT GetLight(DWORD,LPD3DLIGHT7);
592     HRESULT SetRenderState(D3DRENDERSTATETYPE,DWORD);
593     HRESULT GetRenderState(D3DRENDERSTATETYPE,LPDWORD);
594     HRESULT BeginStateBlock();
595     HRESULT EndStateBlock(LPDWORD);
596     HRESULT PreLoad(LPDIRECTDRAWSURFACE7);
597     HRESULT DrawPrimitive(D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,DWORD);
598     HRESULT DrawIndexedPrimitive(D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,LPWORD,DWORD,DWORD);
599     HRESULT SetClipStatus(LPD3DCLIPSTATUS);
600     HRESULT GetClipStatus(LPD3DCLIPSTATUS);
601     HRESULT DrawPrimitiveStrided(D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,DWORD);
602     HRESULT DrawIndexedPrimitiveStrided(D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPWORD,DWORD,DWORD);
603     HRESULT DrawPrimitiveVB(D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER7,DWORD,DWORD,DWORD);
604     HRESULT DrawIndexedPrimitiveVB(D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER7,DWORD,DWORD,LPWORD,DWORD,DWORD);
605     HRESULT ComputeSphereVisibility(LPD3DVECTOR,LPD3DVALUE,DWORD,DWORD,LPDWORD);
606     HRESULT GetTexture(DWORD,LPDIRECTDRAWSURFACE7 *);
607     HRESULT SetTexture(DWORD,LPDIRECTDRAWSURFACE7);
608     HRESULT GetTextureStageState(DWORD,D3DTEXTURESTAGESTATETYPE,LPDWORD);
609     HRESULT SetTextureStageState(DWORD,D3DTEXTURESTAGESTATETYPE,DWORD);
610     HRESULT ValidateDevice(LPDWORD);
611     HRESULT ApplyStateBlock(DWORD);
612     HRESULT CaptureStateBlock(DWORD);
613     HRESULT DeleteStateBlock(DWORD);
614     HRESULT CreateStateBlock(D3DSTATEBLOCKTYPE,LPDWORD);
615     HRESULT Load(LPDIRECTDRAWSURFACE7,LPPOINT,LPDIRECTDRAWSURFACE7,LPRECT,DWORD);
616     HRESULT LightEnable(DWORD,BOOL);
617     HRESULT GetLightEnable(DWORD,BOOL*);
618     HRESULT SetClipPlane(DWORD,D3DVALUE*);
619     HRESULT GetClipPlane(DWORD,D3DVALUE*);
620     HRESULT GetInfo(DWORD,LPVOID,DWORD);
621 }
622 alias LPDIRECT3DDEVICE7 = IDirect3DDevice7;
623 
624 extern (C++) interface IDirect3DVertexBuffer7 : IUnknown {
625     HRESULT Lock(DWORD,LPVOID*,LPDWORD);
626     HRESULT Unlock();
627     HRESULT ProcessVertices(DWORD,DWORD,DWORD,LPDIRECT3DVERTEXBUFFER7,DWORD,LPDIRECT3DDEVICE7,DWORD);
628     HRESULT GetVertexBufferDesc(LPD3DVERTEXBUFFERDESC);
629     HRESULT Optimize(LPDIRECT3DDEVICE7,DWORD);
630     HRESULT ProcessVerticesStrided(DWORD,DWORD,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPDIRECT3DDEVICE7,DWORD);
631 };
632 alias LPDIRECT3DVERTEXBUFFER7 = IDirect3DVertexBuffer7;
633 
634 __gshared LPDIRECTDRAWCREATEEX     DirectDrawCreateEx;
635 __gshared LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExA;
636 
637 extern (Windows) {
638     //alias LPDDENUMMODESCALLBACK = HRESULT function(LPDDSURFACEDESC, LPVOID);
639     alias LPDDENUMMODESCALLBACK2 = HRESULT function(LPDDSURFACEDESC2, LPVOID);
640     //alias LPDDENUMSURFACESCALLBACK = HRESULT function(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID);
641     //alias LPDDENUMSURFACESCALLBACK2 = HRESULT function(LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID);
642     alias LPDDENUMSURFACESCALLBACK7 = HRESULT function(LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID);
643 
644     alias LPCLIPPERCALLBACK = DWORD function(LPDIRECTDRAWCLIPPER lpDDClipper, HWND hWnd, DWORD code,
645                                              LPVOID lpContext);
646 
647     enum {
648         DDCREATE_HARDWAREONLY  = 0x00000001,
649         DDCREATE_EMULATIONONLY = 0x00000002
650     }
651 
652     alias LPDIRECTDRAWCREATEEX = HRESULT function(GUID* lpGUID,
653                                                   LPVOID* lplpDD,
654                                                   REFIID iid,
655                                                   IUnknown* pUnkOuter);
656 
657     enum {
658         DDENUM_ATTACHEDSECONDARYDEVICES = 0x00000001
659     }
660 
661     alias LPDDENUMCALLBACKEXA = BOOL function(GUID*, LPSTR, LPSTR,
662                                               LPVOID, HMONITOR);
663 
664     alias LPDIRECTDRAWENUMERATEEXA =
665         HRESULT function(LPDDENUMCALLBACKEXA lpCallback,
666                          LPVOID              lpContext,
667                          DWORD               dwFlags);
668 }