Assorted spelling, case and grammar fixes.
[wine] / dlls / ddraw / tests / d3d.c
1 /*
2  * Some unit tests for d3d functions
3  *
4  * Copyright (C) 2005 Antoine Chavasse
5  * Copyright (C) 2006 Stefan Dösinger for CodeWeavers
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20  */
21
22 #include <assert.h>
23 #include "wine/test.h"
24 #include "ddraw.h"
25 #include "d3d.h"
26
27 static LPDIRECTDRAW7           lpDD = NULL;
28 static LPDIRECT3D7             lpD3D = NULL;
29 static LPDIRECTDRAWSURFACE7    lpDDS = NULL;
30 static LPDIRECT3DDEVICE7       lpD3DDevice = NULL;
31 static LPDIRECT3DVERTEXBUFFER7 lpVBufSrc = NULL;
32 static LPDIRECT3DVERTEXBUFFER7 lpVBufDest1 = NULL;
33 static LPDIRECT3DVERTEXBUFFER7 lpVBufDest2 = NULL;
34
35 /* To compare bad floating point numbers. Not the ideal way to do it,
36  * but it should be enough for here */
37 #define comparefloat(a, b) ( ((a - b) < 0.0001) && ((a-b) > -0.0001) )
38
39 static HRESULT (WINAPI *pDirectDrawCreateEx)(LPGUID,LPVOID*,REFIID,LPUNKNOWN);
40
41 typedef struct _VERTEX
42 {
43     float x, y, z;  /* position */
44 } VERTEX, *LPVERTEX;
45
46 typedef struct _TVERTEX
47 {
48     float x, y, z;  /* position */
49     float rhw;
50 } TVERTEX, *LPTVERTEX;
51
52
53 static void init_function_pointers(void)
54 {
55     HMODULE hmod = GetModuleHandleA("ddraw.dll");
56
57     if(hmod)
58     {
59         pDirectDrawCreateEx = (void*)GetProcAddress(hmod, "DirectDrawCreateEx");
60     }
61 }
62
63
64 static BOOL CreateDirect3D(void)
65 {
66     HRESULT rc;
67     DDSURFACEDESC2 ddsd;
68
69     rc = pDirectDrawCreateEx(NULL, (void**)&lpDD,
70         &IID_IDirectDraw7, NULL);
71     ok(rc==DD_OK || rc==DDERR_NODIRECTDRAWSUPPORT, "DirectDrawCreateEx returned: %lx\n", rc);
72     if (!lpDD) {
73         trace("DirectDrawCreateEx() failed with an error %lx\n", rc);
74         return FALSE;
75     }
76
77     rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_NORMAL);
78     ok(rc==DD_OK, "SetCooperativeLevel returned: %lx\n", rc);
79
80     rc = IDirectDraw7_QueryInterface(lpDD, &IID_IDirect3D7, (void**) &lpD3D);
81     if (rc == E_NOINTERFACE) return FALSE;
82     ok(rc==DD_OK, "QueryInterface returned: %lx\n", rc);
83
84     memset(&ddsd, 0, sizeof(ddsd));
85     ddsd.dwSize = sizeof(ddsd);
86     ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
87     ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
88     ddsd.dwWidth = 256;
89     ddsd.dwHeight = 256;
90     rc = IDirectDraw7_CreateSurface(lpDD, &ddsd, &lpDDS, NULL);
91     ok(rc==DD_OK, "CreateSurface returned: %lx\n", rc);
92
93     rc = IDirect3D7_CreateDevice(lpD3D, &IID_IDirect3DTnLHalDevice, lpDDS,
94         &lpD3DDevice);
95     ok(rc==D3D_OK || rc==DDERR_NOPALETTEATTACHED || rc==E_OUTOFMEMORY, "CreateDevice returned: %lx\n", rc);
96     if (!lpD3DDevice) {
97         trace("IDirect3D7::CreateDevice() failed with an error %lx\n", rc);
98         return FALSE;
99     }
100
101     return TRUE;
102 }
103
104 static void ReleaseDirect3D(void)
105 {
106     if (lpD3DDevice != NULL)
107     {
108         IDirect3DDevice7_Release(lpD3DDevice);
109         lpD3DDevice = NULL;
110     }
111
112     if (lpDDS != NULL)
113     {
114         IDirectDrawSurface_Release(lpDDS);
115         lpDDS = NULL;
116     }
117
118     if (lpD3D != NULL)
119     {
120         IDirect3D7_Release(lpD3D);
121         lpD3D = NULL;
122     }
123
124     if (lpDD != NULL)
125     {
126         IDirectDraw_Release(lpDD);
127         lpDD = NULL;
128     }
129 }
130
131 static void LightTest(void)
132 {
133     HRESULT rc;
134     D3DLIGHT7 light;
135     D3DLIGHT7 defaultlight;
136     BOOL bEnabled = FALSE;
137
138     /* Set a few lights with funky indices. */
139     memset(&light, 0, sizeof(light));
140     light.dltType = D3DLIGHT_DIRECTIONAL;
141     U1(light.dcvDiffuse).r = 0.5f;
142     U2(light.dcvDiffuse).g = 0.6f;
143     U3(light.dcvDiffuse).b = 0.7f;
144     U2(light.dvDirection).y = 1.f;
145
146     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 5, &light);
147     ok(rc==D3D_OK, "SetLight returned: %lx\n", rc);
148     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 10, &light);
149     ok(rc==D3D_OK, "SetLight returned: %lx\n", rc);
150     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 45, &light);
151     ok(rc==D3D_OK, "SetLight returned: %lx\n", rc);
152
153
154     /* Try to retrieve a light beyond the indices of the lights that have
155        been set. */
156     rc = IDirect3DDevice7_GetLight(lpD3DDevice, 50, &light);
157     ok(rc==DDERR_INVALIDPARAMS, "GetLight returned: %lx\n", rc);
158     rc = IDirect3DDevice7_GetLight(lpD3DDevice, 2, &light);
159     ok(rc==DDERR_INVALIDPARAMS, "GetLight returned: %lx\n", rc);
160
161
162     /* Try to retrieve one of the lights that have been set */
163     rc = IDirect3DDevice7_GetLight(lpD3DDevice, 10, &light);
164     ok(rc==D3D_OK, "GetLight returned: %lx\n", rc);
165
166
167     /* Enable a light that have been previously set. */
168     rc = IDirect3DDevice7_LightEnable(lpD3DDevice, 10, TRUE);
169     ok(rc==D3D_OK, "LightEnable returned: %lx\n", rc);
170
171
172     /* Enable some lights that have not been previously set, and verify that
173        they have been initialized with proper default values. */
174     memset(&defaultlight, 0, sizeof(D3DLIGHT7));
175     defaultlight.dltType = D3DLIGHT_DIRECTIONAL;
176     U1(defaultlight.dcvDiffuse).r = 1.f;
177     U2(defaultlight.dcvDiffuse).g = 1.f;
178     U3(defaultlight.dcvDiffuse).b = 1.f;
179     U3(defaultlight.dvDirection).z = 1.f;
180
181     rc = IDirect3DDevice7_LightEnable(lpD3DDevice, 20, TRUE);
182     ok(rc==D3D_OK, "LightEnable returned: %lx\n", rc);
183     memset(&light, 0, sizeof(D3DLIGHT7));
184     rc = IDirect3DDevice7_GetLight(lpD3DDevice, 20, &light);
185     ok(rc==D3D_OK, "GetLight returned: %lx\n", rc);
186     ok(!memcmp(&light, &defaultlight, sizeof(D3DLIGHT7)),
187         "light data doesn't match expected default values\n" );
188
189     rc = IDirect3DDevice7_LightEnable(lpD3DDevice, 50, TRUE);
190     ok(rc==D3D_OK, "LightEnable returned: %lx\n", rc);
191     memset(&light, 0, sizeof(D3DLIGHT7));
192     rc = IDirect3DDevice7_GetLight(lpD3DDevice, 50, &light);
193     ok(rc==D3D_OK, "GetLight returned: %lx\n", rc);
194     ok(!memcmp(&light, &defaultlight, sizeof(D3DLIGHT7)),
195         "light data doesn't match expected default values\n" );
196
197
198     /* Disable one of the light that have been previously enabled. */
199     rc = IDirect3DDevice7_LightEnable(lpD3DDevice, 20, FALSE);
200     ok(rc==D3D_OK, "LightEnable returned: %lx\n", rc);
201
202     /* Try to retrieve the enable status of some lights */
203     /* Light 20 is supposed to be disabled */
204     rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, 20, &bEnabled );
205     ok(rc==D3D_OK, "GetLightEnable returned: %lx\n", rc);
206     ok(!bEnabled, "GetLightEnable says the light is enabled\n");
207
208     /* Light 10 is supposed to be enabled */
209     bEnabled = FALSE;
210     rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, 10, &bEnabled );
211     ok(rc==D3D_OK, "GetLightEnable returned: %lx\n", rc);
212     ok(bEnabled, "GetLightEnable says the light is disabled\n");
213
214     /* Light 80 has not been set */
215     rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, 80, &bEnabled );
216     ok(rc==DDERR_INVALIDPARAMS, "GetLightEnable returned: %lx\n", rc);
217
218     /* Light 23 has not been set */
219     rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, 23, &bEnabled );
220     ok(rc==DDERR_INVALIDPARAMS, "GetLightEnable returned: %lx\n", rc);
221 }
222
223 static void ProcessVerticesTest()
224 {
225     D3DVERTEXBUFFERDESC desc;
226     HRESULT rc;
227     VERTEX *in;
228     TVERTEX *out;
229     VERTEX *out2;
230     D3DVIEWPORT7 vp;
231     D3DMATRIX view = {  2.0, 0.0, 0.0, 0.0,
232                         0.0, -1.0, 0.0, 0.0,
233                         0.0, 0.0, 1.0, 0.0,
234                         0.0, 0.0, 0.0, 3.0 };
235
236     D3DMATRIX world = { 0.0, 1.0, 0.0, 0.0,
237                         1.0, 0.0, 0.0, 0.0,
238                         0.0, 0.0, 0.0, 1.0,
239                         0.0, 1.0, 1.0, 1.0 };
240
241     D3DMATRIX proj = {  1.0, 0.0, 0.0, 1.0,
242                         0.0, 1.0, 1.0, 0.0,
243                         0.0, 1.0, 1.0, 0.0,
244                         1.0, 0.0, 0.0, 1.0 };
245     /* Create some vertex buffers */
246
247     memset(&desc, 0, sizeof(desc));
248     desc.dwSize = sizeof(desc);
249     desc.dwCaps = 0;
250     desc.dwFVF = D3DFVF_XYZ;
251     desc.dwNumVertices = 16;
252     rc = IDirect3D7_CreateVertexBuffer(lpD3D, &desc, &lpVBufSrc, 0);
253     ok(rc==D3D_OK || rc==E_OUTOFMEMORY, "CreateVertexBuffer returned: %lx\n", rc);
254     if (!lpVBufSrc)
255     {
256         trace("IDirect3D7::CreateVertexBuffer() failed with an error %lx\n", rc);
257         goto out;
258     }
259
260     memset(&desc, 0, sizeof(desc));
261     desc.dwSize = sizeof(desc);
262     desc.dwCaps = 0;
263     desc.dwFVF = D3DFVF_XYZRHW;
264     desc.dwNumVertices = 16;
265     /* Msdn says that the last parameter must be 0 - check that */
266     rc = IDirect3D7_CreateVertexBuffer(lpD3D, &desc, &lpVBufDest1, 4);
267     ok(rc==D3D_OK || rc==E_OUTOFMEMORY, "CreateVertexBuffer returned: %lx\n", rc);
268     if (!lpVBufDest1)
269     {
270         trace("IDirect3D7::CreateVertexBuffer() failed with an error %lx\n", rc);
271         goto out;
272     }
273
274     memset(&desc, 0, sizeof(desc));
275     desc.dwSize = sizeof(desc);
276     desc.dwCaps = 0;
277     desc.dwFVF = D3DFVF_XYZ;
278     desc.dwNumVertices = 16;
279     /* Msdn says that the last parameter must be 0 - check that */
280     rc = IDirect3D7_CreateVertexBuffer(lpD3D, &desc, &lpVBufDest2, 12345678);
281     ok(rc==D3D_OK || rc==E_OUTOFMEMORY, "CreateVertexBuffer returned: %lx\n", rc);
282     if (!lpVBufDest2)
283     {
284         trace("IDirect3D7::CreateVertexBuffer() failed with an error %lx\n", rc);
285         goto out;
286     }
287
288     rc = IDirect3DVertexBuffer7_Lock(lpVBufSrc, 0, (void **) &in, NULL);
289     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %lx\n", rc);
290     if(!in) goto out;
291
292     /* Check basic transformation */
293
294     in[0].x = 0.0;
295     in[0].y = 0.0;
296     in[0].z = 0.0;
297
298     in[1].x = 1.0;
299     in[1].y = 1.0;
300     in[1].z = 1.0;
301
302     in[2].x = -1.0;
303     in[2].y = -1.0;
304     in[2].z = 0.5;
305
306     in[3].x = 0.5;
307     in[3].y = -0.5;
308     in[3].z = 0.25;
309     rc = IDirect3DVertexBuffer7_Unlock(lpVBufSrc);
310     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %lx\n", rc);
311
312     rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest1, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
313     ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %lx\n", rc);
314
315     rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest2, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
316     ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %lx\n", rc);
317
318     rc = IDirect3DVertexBuffer7_Lock(lpVBufDest1, 0, (void **) &out, NULL);
319     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %lx\n", rc);
320     if(!out) goto out;
321
322     /* Check the results */
323     ok( comparefloat(out[0].x, 128.0 ) &&
324         comparefloat(out[0].y, 128.0 ) &&
325         comparefloat(out[0].z, 0.0 ) &&
326         comparefloat(out[0].rhw, 1.0 ),
327         "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
328
329     ok( comparefloat(out[1].x, 256.0 ) &&
330         comparefloat(out[1].y, 0.0 ) &&
331         comparefloat(out[1].z, 1.0 ) &&
332         comparefloat(out[1].rhw, 1.0 ),
333         "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
334
335     ok( comparefloat(out[2].x, 0.0 ) &&
336         comparefloat(out[2].y, 256.0 ) &&
337         comparefloat(out[2].z, 0.5 ) &&
338         comparefloat(out[2].rhw, 1.0 ),
339         "Output 2 vertex is (%f , %f , %f , %f)\n", out[2].x, out[2].y, out[2].z, out[2].rhw);
340
341     ok( comparefloat(out[3].x, 192.0 ) &&
342         comparefloat(out[3].y, 192.0 ) &&
343         comparefloat(out[3].z, 0.25 ) &&
344         comparefloat(out[3].rhw, 1.0 ),
345         "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
346
347     rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest1);
348     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %lx\n", rc);
349     out = NULL;
350
351     rc = IDirect3DVertexBuffer7_Lock(lpVBufDest2, 0, (void **) &out2, NULL);
352     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %lx\n", rc);
353     if(!out2) goto out;
354     /* Small thing without much practial meaning, but I stumbled upon it,
355      * so let's check for it: If the output vertex buffer has to RHW value,
356      * The RHW value of the last vertex is written into the next vertex
357      */
358     ok( comparefloat(out2[4].x, 1.0 ) &&
359         comparefloat(out2[4].y, 0.0 ) &&
360         comparefloat(out2[4].z, 0.0 ),
361         "Output 4 vertex is (%f , %f , %f)\n", out2[4].x, out2[4].y, out2[4].z);
362
363     rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest2);
364     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %lx\n", rc);
365     out = NULL;
366
367     /* Try a more complicated viewport, same vertices */
368     memset(&vp, 0, sizeof(vp));
369     vp.dwX = 10;
370     vp.dwY = 5;
371     vp.dwWidth = 246;
372     vp.dwHeight = 130;
373     vp.dvMinZ = -2.0;
374     vp.dvMaxZ = 4.0;
375     rc = IDirect3DDevice7_SetViewport(lpD3DDevice, &vp);
376     ok(rc==D3D_OK, "IDirect3DDevice7_SetViewport failed with rc=%lx\n", rc);
377
378     /* Process again */
379     rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest1, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
380     ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %lx\n", rc);
381
382     rc = IDirect3DVertexBuffer7_Lock(lpVBufDest1, 0, (void **) &out, NULL);
383     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %lx\n", rc);
384     if(!out) goto out;
385
386     /* Check the results */
387     ok( comparefloat(out[0].x, 133.0 ) &&
388         comparefloat(out[0].y, 70.0 ) &&
389         comparefloat(out[0].z, -2.0 ) &&
390         comparefloat(out[0].rhw, 1.0 ),
391         "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
392
393     ok( comparefloat(out[1].x, 256.0 ) &&
394         comparefloat(out[1].y, 5.0 ) &&
395         comparefloat(out[1].z, 4.0 ) &&
396         comparefloat(out[1].rhw, 1.0 ),
397         "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
398
399     ok( comparefloat(out[2].x, 10.0 ) &&
400         comparefloat(out[2].y, 135.0 ) &&
401         comparefloat(out[2].z, 1.0 ) &&
402         comparefloat(out[2].rhw, 1.0 ),
403         "Output 2 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
404
405     ok( comparefloat(out[3].x, 194.5 ) &&
406         comparefloat(out[3].y, 102.5 ) &&
407         comparefloat(out[3].z, -0.5 ) &&
408         comparefloat(out[3].rhw, 1.0 ),
409         "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
410
411     rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest1);
412     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %lx\n", rc);
413     out = NULL;
414
415     /* Play with some matrices. */
416
417     rc = IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_VIEW, &view);
418     ok(rc==D3D_OK, "IDirect3DDevice7_SetTransform failed\n");
419
420     rc = IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_PROJECTION, &proj);
421     ok(rc==D3D_OK, "IDirect3DDevice7_SetTransform failed\n");
422
423     rc = IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_WORLD, &world);
424     ok(rc==D3D_OK, "IDirect3DDevice7_SetTransform failed\n");
425
426     rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest1, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
427     ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %lx\n", rc);
428
429     rc = IDirect3DVertexBuffer7_Lock(lpVBufDest1, 0, (void **) &out, NULL);
430     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %lx\n", rc);
431     if(!out) goto out;
432
433     /* Keep the viewport simpler, otherwise we get bad numbers to compare */
434     vp.dwX = 0;
435     vp.dwY = 0;
436     vp.dwWidth = 100;
437     vp.dwHeight = 100;
438     vp.dvMinZ = 1.0;
439     vp.dvMaxZ = 0.0;
440     rc = IDirect3DDevice7_SetViewport(lpD3DDevice, &vp);
441     ok(rc==D3D_OK, "IDirect3DDevice7_SetViewport failed\n");
442
443     /* Check the results */
444     ok( comparefloat(out[0].x, 256.0 ) &&    /* X coordinate is cut at the surface edges */
445         comparefloat(out[0].y, 70.0 ) &&
446         comparefloat(out[0].z, -2.0 ) &&
447         comparefloat(out[0].rhw, (1.0 / 3.0)),
448         "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
449
450     ok( comparefloat(out[1].x, 256.0 ) &&
451         comparefloat(out[1].y, 78.125000 ) &&
452         comparefloat(out[1].z, -2.750000 ) &&
453         comparefloat(out[1].rhw, 0.125000 ),
454         "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
455
456     ok( comparefloat(out[2].x, 256.0 ) &&
457         comparefloat(out[2].y, 44.000000 ) &&
458         comparefloat(out[2].z, 0.400000 ) &&
459         comparefloat(out[2].rhw, 0.400000 ),
460         "Output 2 vertex is (%f , %f , %f , %f)\n", out[2].x, out[2].y, out[2].z, out[2].rhw);
461
462     ok( comparefloat(out[3].x, 256.0 ) &&
463         comparefloat(out[3].y, 81.818184 ) &&
464         comparefloat(out[3].z, -3.090909 ) &&
465         comparefloat(out[3].rhw, 0.363636 ),
466         "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
467
468     rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest1);
469     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %lx\n", rc);
470     out = NULL;
471
472 out:
473     IDirect3DVertexBuffer7_Release(lpVBufSrc);
474     IDirect3DVertexBuffer7_Release(lpVBufDest1);
475     IDirect3DVertexBuffer7_Release(lpVBufDest2);
476 }
477
478 START_TEST(d3d)
479 {
480     init_function_pointers();
481     if(!pDirectDrawCreateEx) {
482         trace("function DirectDrawCreateEx not available, skipping tests\n");
483         return;
484     }
485
486     if(!CreateDirect3D()) {
487         trace("Skipping tests\n");
488         return;
489     }
490     LightTest();
491     ProcessVerticesTest();
492     ReleaseDirect3D();
493 }