Various trace fixes.
[wine/multimedia.git] / dlls / ddraw / tests / d3d.c
blob7ad03d7edd7134bea0246dcd97b64702f5afd270
1 /*
2 * Some unit tests for d3d functions
4 * Copyright (C) 2005 Antoine Chavasse
5 * Copyright (C) 2006 Stefan Dösinger for CodeWeavers
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <assert.h>
23 #include "wine/test.h"
24 #include "ddraw.h"
25 #include "d3d.h"
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;
35 /* To compare bad floating point numbers. Not the ideal way to do it,
36 * but it should be enought for here */
37 #define comparefloat(a, b) ( ((a - b) < 0.0001) && ((a-b) > -0.0001) )
39 static HRESULT (WINAPI *pDirectDrawCreateEx)(LPGUID,LPVOID*,REFIID,LPUNKNOWN);
41 typedef struct _VERTEX
43 float x, y, z; /* position */
44 } VERTEX, *LPVERTEX;
46 typedef struct _TVERTEX
48 float x, y, z; /* position */
49 float rhw;
50 } TVERTEX, *LPTVERTEX;
53 static void init_function_pointers(void)
55 HMODULE hmod = GetModuleHandleA("ddraw.dll");
57 if(hmod)
59 pDirectDrawCreateEx = (void*)GetProcAddress(hmod, "DirectDrawCreateEx");
64 static BOOL CreateDirect3D(void)
66 HRESULT rc;
67 DDSURFACEDESC2 ddsd;
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;
77 rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_NORMAL);
78 ok(rc==DD_OK, "SetCooperativeLevel returned: %lx\n", rc);
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);
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);
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;
101 return TRUE;
104 static void ReleaseDirect3D(void)
106 if (lpD3DDevice != NULL)
108 IDirect3DDevice7_Release(lpD3DDevice);
109 lpD3DDevice = NULL;
112 if (lpDDS != NULL)
114 IDirectDrawSurface_Release(lpDDS);
115 lpDDS = NULL;
118 if (lpD3D != NULL)
120 IDirect3D7_Release(lpD3D);
121 lpD3D = NULL;
124 if (lpDD != NULL)
126 IDirectDraw_Release(lpDD);
127 lpDD = NULL;
131 static void LightTest(void)
133 HRESULT rc;
134 D3DLIGHT7 light;
135 D3DLIGHT7 defaultlight;
136 BOOL bEnabled = FALSE;
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;
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);
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);
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);
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);
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;
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" );
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" );
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);
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");
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");
214 /* Light 80 has not been set */
215 rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, 80, &bEnabled );
216 ok(rc==DDERR_INVALIDPARAMS, "GetLightEnable returned: %lx\n", rc);
218 /* Light 23 has not been set */
219 rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, 23, &bEnabled );
220 ok(rc==DDERR_INVALIDPARAMS, "GetLightEnable returned: %lx\n", rc);
223 static void ProcessVerticesTest()
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 };
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 };
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 */
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)
256 trace("IDirect3D7::CreateVertexBuffer() failed with an error %lx\n", rc);
257 goto out;
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)
270 trace("IDirect3D7::CreateVertexBuffer() failed with an error %lx\n", rc);
271 goto out;
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)
284 trace("IDirect3D7::CreateVertexBuffer() failed with an error %lx\n", rc);
285 goto out;
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;
292 /* Check basic transformation */
294 in[0].x = 0.0;
295 in[0].y = 0.0;
296 in[0].z = 0.0;
298 in[1].x = 1.0;
299 in[1].y = 1.0;
300 in[1].z = 1.0;
302 in[2].x = -1.0;
303 in[2].y = -1.0;
304 in[2].z = 0.5;
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);
312 rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest1, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
313 ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %lx\n", rc);
315 rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest2, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
316 ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %lx\n", rc);
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;
322 /* Check the results */
323 if( !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 ))
328 todo_wine ok(FALSE, "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
330 else
332 todo_wine ok(TRUE, "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
335 if( !comparefloat(out[1].x, 256.0 ) ||
336 !comparefloat(out[1].y, 0.0 ) ||
337 !comparefloat(out[1].z, 1.0 ) ||
338 !comparefloat(out[1].rhw, 1.0 ))
340 todo_wine ok(FALSE, "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
342 else
344 todo_wine ok(TRUE, "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
347 if( !comparefloat(out[2].x, 0.0 ) ||
348 !comparefloat(out[2].y, 256.0 ) ||
349 !comparefloat(out[2].z, 0.5 ) ||
350 !comparefloat(out[2].rhw, 1.0 ))
352 todo_wine ok(FALSE, "Output 2 vertex is (%f , %f , %f , %f)\n", out[2].x, out[2].y, out[2].z, out[2].rhw);
354 else
356 todo_wine ok(TRUE, "Output 2 vertex is (%f , %f , %f , %f)\n", out[2].x, out[2].y, out[2].z, out[2].rhw);
359 if( !comparefloat(out[3].x, 192.0 ) ||
360 !comparefloat(out[3].y, 192.0 ) ||
361 !comparefloat(out[3].z, 0.25 ) ||
362 !comparefloat(out[3].rhw, 1.0 ))
364 todo_wine ok(FALSE, "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
366 else
368 todo_wine ok(TRUE, "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
371 rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest1);
372 ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %lx\n", rc);
373 out = NULL;
375 rc = IDirect3DVertexBuffer7_Lock(lpVBufDest2, 0, (void **) &out2, NULL);
376 ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %lx\n", rc);
377 if(!out2) goto out;
378 /* Small thing without much practial meaning, but I stumbled upon it,
379 * so let's check for it: If the output vertex buffer has to RHW value,
380 * The RHW value of the last vertex is written into the next vertex
382 if( !comparefloat(out2[4].x, 1.0 ) ||
383 !comparefloat(out2[4].y, 0.0 ) ||
384 !comparefloat(out2[4].z, 0.0 ) )
386 todo_wine ok(FALSE, "Output 4 vertex is (%f , %f , %f)\n", out2[4].x, out2[4].y, out2[4].z);
388 else
390 todo_wine ok(TRUE, "Output 4 vertex is (%f , %f , %f)\n", out2[4].x, out2[4].y, out2[4].z);
393 rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest2);
394 ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %lx\n", rc);
395 out = NULL;
397 /* Try a more complicated viewport, same vertices */
398 memset(&vp, 0, sizeof(vp));
399 vp.dwX = 10;
400 vp.dwY = 5;
401 vp.dwWidth = 246;
402 vp.dwHeight = 130;
403 vp.dvMinZ = -2.0;
404 vp.dvMaxZ = 4.0;
405 rc = IDirect3DDevice7_SetViewport(lpD3DDevice, &vp);
406 ok(rc==D3D_OK, "IDirect3DDevice7_SetViewport failed with rc=%lx\n", rc);
408 /* Process again */
409 rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest1, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
410 ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %lx\n", rc);
412 rc = IDirect3DVertexBuffer7_Lock(lpVBufDest1, 0, (void **) &out, NULL);
413 ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %lx\n", rc);
414 if(!out) goto out;
416 /* Check the results */
417 if( !comparefloat(out[0].x, 133.0 ) ||
418 !comparefloat(out[0].y, 70.0 ) ||
419 !comparefloat(out[0].z, -2.0 ) ||
420 !comparefloat(out[0].rhw, 1.0 ))
422 todo_wine ok(FALSE, "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
424 else
426 todo_wine ok(TRUE, "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
429 if( !comparefloat(out[1].x, 256.0 ) ||
430 !comparefloat(out[1].y, 5.0 ) ||
431 !comparefloat(out[1].z, 4.0 ) ||
432 !comparefloat(out[1].rhw, 1.0 ))
434 todo_wine ok(FALSE, "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
436 else
438 todo_wine ok(TRUE, "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
441 if( !comparefloat(out[2].x, 10.0 ) ||
442 !comparefloat(out[2].y, 135.0 ) ||
443 !comparefloat(out[2].z, 1.0 ) ||
444 !comparefloat(out[2].rhw, 1.0 ))
446 todo_wine ok(FALSE, "Output 2 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
448 else
450 todo_wine ok(TRUE, "Output 2 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
453 if( !comparefloat(out[3].x, 194.5 ) ||
454 !comparefloat(out[3].y, 102.5 ) ||
455 !comparefloat(out[3].z, -0.5 ) ||
456 !comparefloat(out[3].rhw, 1.0 ))
458 todo_wine ok(FALSE, "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
460 else
462 todo_wine ok(TRUE, "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
465 rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest1);
466 ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %lx\n", rc);
467 out = NULL;
469 /* Play with some matrices. */
471 rc = IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_VIEW, &view);
472 ok(rc==D3D_OK, "IDirect3DDevice7_SetTransform failed\n");
474 rc = IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_PROJECTION, &proj);
475 ok(rc==D3D_OK, "IDirect3DDevice7_SetTransform failed\n");
477 rc = IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_WORLD, &world);
478 ok(rc==D3D_OK, "IDirect3DDevice7_SetTransform failed\n");
480 rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest1, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
481 ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %lx\n", rc);
483 rc = IDirect3DVertexBuffer7_Lock(lpVBufDest1, 0, (void **) &out, NULL);
484 ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %lx\n", rc);
485 if(!out) goto out;
487 /* Keep the viewport simpler, otherwise we get bad numbers to compare */
488 vp.dwX = 0;
489 vp.dwY = 0;
490 vp.dwWidth = 100;
491 vp.dwHeight = 100;
492 vp.dvMinZ = 1.0;
493 vp.dvMaxZ = 0.0;
494 rc = IDirect3DDevice7_SetViewport(lpD3DDevice, &vp);
495 ok(rc==D3D_OK, "IDirect3DDevice7_SetViewport failed\n");
497 /* Check the results */
498 if( !comparefloat(out[0].x, 256.0 ) || /* X coordinate is cut at the surface edges */
499 !comparefloat(out[0].y, 70.0 ) ||
500 !comparefloat(out[0].z, -2.0 ) ||
501 !comparefloat(out[0].rhw, (1.0 / 3.0)))
503 todo_wine ok(FALSE, "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
505 else
507 todo_wine ok(TRUE, "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
510 if( !comparefloat(out[1].x, 256.0 ) ||
511 !comparefloat(out[1].y, 78.125000 ) ||
512 !comparefloat(out[1].z, -2.750000 ) ||
513 !comparefloat(out[1].rhw, 0.125000 ))
515 todo_wine ok(FALSE, "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
517 else
519 todo_wine ok(TRUE, "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
522 if( !comparefloat(out[2].x, 256.0 ) ||
523 !comparefloat(out[2].y, 44.000000 ) ||
524 !comparefloat(out[2].z, 0.400000 ) ||
525 !comparefloat(out[2].rhw, 0.400000 ))
527 todo_wine ok(FALSE, "Output 2 vertex is (%f , %f , %f , %f)\n", out[2].x, out[2].y, out[2].z, out[2].rhw);
529 else
531 todo_wine ok(TRUE, "Output 2 vertex is (%f , %f , %f , %f)\n", out[2].x, out[2].y, out[2].z, out[2].rhw);
534 if( !comparefloat(out[3].x, 256.0 ) ||
535 !comparefloat(out[3].y, 81.818184 ) ||
536 !comparefloat(out[3].z, -3.090909 ) ||
537 !comparefloat(out[3].rhw, 0.363636 ))
539 todo_wine ok(FALSE, "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
541 else
543 todo_wine ok(TRUE, "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
546 rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest1);
547 ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %lx\n", rc);
548 out = NULL;
550 out:
551 IDirect3DVertexBuffer7_Release(lpVBufSrc);
552 IDirect3DVertexBuffer7_Release(lpVBufDest1);
553 IDirect3DVertexBuffer7_Release(lpVBufDest2);
556 START_TEST(d3d)
558 init_function_pointers();
559 if(!pDirectDrawCreateEx) {
560 trace("function DirectDrawCreateEx not available, skipping tests\n");
561 return;
564 if(!CreateDirect3D()) {
565 trace("Skipping tests\n");
566 return;
568 LightTest();
569 ProcessVerticesTest();
570 ReleaseDirect3D();