~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/ddraw/tests/d3d.c

Version: ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  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  * Copyright (C) 2008 Alexander Dorofeyev
  7  *
  8  * This library is free software; you can redistribute it and/or
  9  * modify it under the terms of the GNU Lesser General Public
 10  * License as published by the Free Software Foundation; either
 11  * version 2.1 of the License, or (at your option) any later version.
 12  *
 13  * This library is distributed in the hope that it will be useful,
 14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16  * Lesser General Public License for more details.
 17  *
 18  * You should have received a copy of the GNU Lesser General Public
 19  * License along with this library; if not, write to the Free Software
 20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 21  */
 22 
 23 #include <assert.h>
 24 #include "wine/test.h"
 25 #include "initguid.h"
 26 #include "ddraw.h"
 27 #include "d3d.h"
 28 
 29 static LPDIRECTDRAW7           lpDD = NULL;
 30 static LPDIRECT3D7             lpD3D = NULL;
 31 static LPDIRECTDRAWSURFACE7    lpDDS = NULL;
 32 static LPDIRECTDRAWSURFACE7    lpDDSdepth = NULL;
 33 static LPDIRECT3DDEVICE7       lpD3DDevice = NULL;
 34 static LPDIRECT3DVERTEXBUFFER7 lpVBufSrc = NULL;
 35 static LPDIRECT3DVERTEXBUFFER7 lpVBufDest1 = NULL;
 36 static LPDIRECT3DVERTEXBUFFER7 lpVBufDest2 = NULL;
 37 
 38 static IDirectDraw *DirectDraw1 = NULL;
 39 static IDirectDrawSurface *Surface1 = NULL;
 40 static IDirect3D *Direct3D1 = NULL;
 41 static IDirect3DDevice *Direct3DDevice1 = NULL;
 42 static IDirect3DExecuteBuffer *ExecuteBuffer = NULL;
 43 static IDirect3DViewport *Viewport = NULL;
 44 
 45 typedef struct {
 46     int total;
 47     int rgb;
 48     int hal;
 49     int tnlhal;
 50     int unk;
 51 } D3D7ETest;
 52 
 53 /* To compare bad floating point numbers. Not the ideal way to do it,
 54  * but it should be enough for here */
 55 #define comparefloat(a, b) ( (((a) - (b)) < 0.0001) && (((a) - (b)) > -0.0001) )
 56 
 57 static HRESULT (WINAPI *pDirectDrawCreateEx)(LPGUID,LPVOID*,REFIID,LPUNKNOWN);
 58 
 59 typedef struct _VERTEX
 60 {
 61     float x, y, z;  /* position */
 62 } VERTEX, *LPVERTEX;
 63 
 64 typedef struct _TVERTEX
 65 {
 66     float x, y, z;  /* position */
 67     float rhw;
 68 } TVERTEX, *LPTVERTEX;
 69 
 70 
 71 static void init_function_pointers(void)
 72 {
 73     HMODULE hmod = GetModuleHandleA("ddraw.dll");
 74     pDirectDrawCreateEx = (void*)GetProcAddress(hmod, "DirectDrawCreateEx");
 75 }
 76 
 77 
 78 static BOOL CreateDirect3D(void)
 79 {
 80     HRESULT rc;
 81     DDSURFACEDESC2 ddsd;
 82 
 83     rc = pDirectDrawCreateEx(NULL, (void**)&lpDD,
 84         &IID_IDirectDraw7, NULL);
 85     ok(rc==DD_OK || rc==DDERR_NODIRECTDRAWSUPPORT, "DirectDrawCreateEx returned: %x\n", rc);
 86     if (!lpDD) {
 87         trace("DirectDrawCreateEx() failed with an error %x\n", rc);
 88         return FALSE;
 89     }
 90 
 91     rc = IDirectDraw_SetCooperativeLevel(lpDD, NULL, DDSCL_NORMAL);
 92     ok(rc==DD_OK, "SetCooperativeLevel returned: %x\n", rc);
 93 
 94     rc = IDirectDraw7_QueryInterface(lpDD, &IID_IDirect3D7, (void**) &lpD3D);
 95     if (rc == E_NOINTERFACE) return FALSE;
 96     ok(rc==DD_OK, "QueryInterface returned: %x\n", rc);
 97 
 98     memset(&ddsd, 0, sizeof(ddsd));
 99     ddsd.dwSize = sizeof(ddsd);
100     ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
101     ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
102     ddsd.dwWidth = 256;
103     ddsd.dwHeight = 256;
104     rc = IDirectDraw7_CreateSurface(lpDD, &ddsd, &lpDDS, NULL);
105     if (!SUCCEEDED(rc))
106         return FALSE;
107 
108     memset(&ddsd, 0, sizeof(ddsd));
109     ddsd.dwSize = sizeof(ddsd);
110     ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
111     ddsd.ddsCaps.dwCaps = DDSCAPS_ZBUFFER;
112     U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
113     U4(ddsd).ddpfPixelFormat.dwFlags = DDPF_ZBUFFER;
114     U1(U4(ddsd).ddpfPixelFormat).dwZBufferBitDepth = 16;
115     U3(U4(ddsd).ddpfPixelFormat).dwZBitMask = 0x0000FFFF;
116     ddsd.dwWidth = 256;
117     ddsd.dwHeight = 256;
118     rc = IDirectDraw7_CreateSurface(lpDD, &ddsd, &lpDDSdepth, NULL);
119     ok(rc==DD_OK, "CreateSurface returned: %x\n", rc);
120     if (!SUCCEEDED(rc)) {
121         lpDDSdepth = NULL;
122     } else {
123         rc = IDirectDrawSurface_AddAttachedSurface(lpDDS, lpDDSdepth);
124         ok(rc == DD_OK, "IDirectDrawSurface_AddAttachedSurface returned %x\n", rc);
125         if (!SUCCEEDED(rc))
126             return FALSE;
127     }
128 
129     rc = IDirect3D7_CreateDevice(lpD3D, &IID_IDirect3DTnLHalDevice, lpDDS,
130         &lpD3DDevice);
131     ok(rc==D3D_OK || rc==DDERR_NOPALETTEATTACHED || rc==E_OUTOFMEMORY, "CreateDevice returned: %x\n", rc);
132     if (!lpD3DDevice) {
133         trace("IDirect3D7::CreateDevice() for a TnL Hal device failed with an error %x, trying HAL\n", rc);
134         rc = IDirect3D7_CreateDevice(lpD3D, &IID_IDirect3DHALDevice, lpDDS,
135             &lpD3DDevice);
136         if (!lpD3DDevice) {
137             trace("IDirect3D7::CreateDevice() for a HAL device failed with an error %x, trying RGB\n", rc);
138             rc = IDirect3D7_CreateDevice(lpD3D, &IID_IDirect3DRGBDevice, lpDDS,
139                 &lpD3DDevice);
140             if (!lpD3DDevice) {
141                 trace("IDirect3D7::CreateDevice() for a RGB device failed with an error %x, giving up\n", rc);
142                 return FALSE;
143             }
144         }
145     }
146 
147     return TRUE;
148 }
149 
150 static void ReleaseDirect3D(void)
151 {
152     if (lpD3DDevice != NULL)
153     {
154         IDirect3DDevice7_Release(lpD3DDevice);
155         lpD3DDevice = NULL;
156     }
157 
158     if (lpDDSdepth != NULL)
159     {
160         IDirectDrawSurface_Release(lpDDSdepth);
161         lpDDSdepth = NULL;
162     }
163 
164     if (lpDDS != NULL)
165     {
166         IDirectDrawSurface_Release(lpDDS);
167         lpDDS = NULL;
168     }
169 
170     if (lpD3D != NULL)
171     {
172         IDirect3D7_Release(lpD3D);
173         lpD3D = NULL;
174     }
175 
176     if (lpDD != NULL)
177     {
178         IDirectDraw_Release(lpDD);
179         lpDD = NULL;
180     }
181 }
182 
183 static void LightTest(void)
184 {
185     HRESULT rc;
186     D3DLIGHT7 light;
187     D3DLIGHT7 defaultlight;
188     BOOL bEnabled = FALSE;
189     float one = 1.0f;
190     float zero= 0.0f;
191     D3DMATERIAL7 mat;
192     BOOL enabled;
193     unsigned int i;
194     D3DDEVICEDESC7 caps;
195 
196     /* Set a few lights with funky indices. */
197     memset(&light, 0, sizeof(light));
198     light.dltType = D3DLIGHT_DIRECTIONAL;
199     U1(light.dcvDiffuse).r = 0.5f;
200     U2(light.dcvDiffuse).g = 0.6f;
201     U3(light.dcvDiffuse).b = 0.7f;
202     U2(light.dvDirection).y = 1.f;
203 
204     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 5, &light);
205     ok(rc==D3D_OK, "SetLight returned: %x\n", rc);
206     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 10, &light);
207     ok(rc==D3D_OK, "SetLight returned: %x\n", rc);
208     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 45, &light);
209     ok(rc==D3D_OK, "SetLight returned: %x\n", rc);
210 
211 
212     /* Try to retrieve a light beyond the indices of the lights that have
213        been set. */
214     rc = IDirect3DDevice7_GetLight(lpD3DDevice, 50, &light);
215     ok(rc==DDERR_INVALIDPARAMS, "GetLight returned: %x\n", rc);
216     rc = IDirect3DDevice7_GetLight(lpD3DDevice, 2, &light);
217     ok(rc==DDERR_INVALIDPARAMS, "GetLight returned: %x\n", rc);
218 
219 
220     /* Try to retrieve one of the lights that have been set */
221     rc = IDirect3DDevice7_GetLight(lpD3DDevice, 10, &light);
222     ok(rc==D3D_OK, "GetLight returned: %x\n", rc);
223 
224 
225     /* Enable a light that have been previously set. */
226     rc = IDirect3DDevice7_LightEnable(lpD3DDevice, 10, TRUE);
227     ok(rc==D3D_OK, "LightEnable returned: %x\n", rc);
228 
229 
230     /* Enable some lights that have not been previously set, and verify that
231        they have been initialized with proper default values. */
232     memset(&defaultlight, 0, sizeof(D3DLIGHT7));
233     defaultlight.dltType = D3DLIGHT_DIRECTIONAL;
234     U1(defaultlight.dcvDiffuse).r = 1.f;
235     U2(defaultlight.dcvDiffuse).g = 1.f;
236     U3(defaultlight.dcvDiffuse).b = 1.f;
237     U3(defaultlight.dvDirection).z = 1.f;
238 
239     rc = IDirect3DDevice7_LightEnable(lpD3DDevice, 20, TRUE);
240     ok(rc==D3D_OK, "LightEnable returned: %x\n", rc);
241     memset(&light, 0, sizeof(D3DLIGHT7));
242     rc = IDirect3DDevice7_GetLight(lpD3DDevice, 20, &light);
243     ok(rc==D3D_OK, "GetLight returned: %x\n", rc);
244     ok(!memcmp(&light, &defaultlight, sizeof(D3DLIGHT7)),
245         "light data doesn't match expected default values\n" );
246 
247     rc = IDirect3DDevice7_LightEnable(lpD3DDevice, 50, TRUE);
248     ok(rc==D3D_OK, "LightEnable returned: %x\n", rc);
249     memset(&light, 0, sizeof(D3DLIGHT7));
250     rc = IDirect3DDevice7_GetLight(lpD3DDevice, 50, &light);
251     ok(rc==D3D_OK, "GetLight returned: %x\n", rc);
252     ok(!memcmp(&light, &defaultlight, sizeof(D3DLIGHT7)),
253         "light data doesn't match expected default values\n" );
254 
255 
256     /* Disable one of the light that have been previously enabled. */
257     rc = IDirect3DDevice7_LightEnable(lpD3DDevice, 20, FALSE);
258     ok(rc==D3D_OK, "LightEnable returned: %x\n", rc);
259 
260     /* Try to retrieve the enable status of some lights */
261     /* Light 20 is supposed to be disabled */
262     rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, 20, &bEnabled );
263     ok(rc==D3D_OK, "GetLightEnable returned: %x\n", rc);
264     ok(!bEnabled, "GetLightEnable says the light is enabled\n");
265 
266     /* Light 10 is supposed to be enabled */
267     bEnabled = FALSE;
268     rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, 10, &bEnabled );
269     ok(rc==D3D_OK, "GetLightEnable returned: %x\n", rc);
270     ok(bEnabled, "GetLightEnable says the light is disabled\n");
271 
272     /* Light 80 has not been set */
273     rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, 80, &bEnabled );
274     ok(rc==DDERR_INVALIDPARAMS, "GetLightEnable returned: %x\n", rc);
275 
276     /* Light 23 has not been set */
277     rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, 23, &bEnabled );
278     ok(rc==DDERR_INVALIDPARAMS, "GetLightEnable returned: %x\n", rc);
279 
280     /* Set some lights with invalid parameters */
281     memset(&light, 0, sizeof(D3DLIGHT7));
282     light.dltType = 0;
283     U1(light.dcvDiffuse).r = 1.f;
284     U2(light.dcvDiffuse).g = 1.f;
285     U3(light.dcvDiffuse).b = 1.f;
286     U3(light.dvDirection).z = 1.f;
287     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 100, &light);
288     ok(rc==DDERR_INVALIDPARAMS, "SetLight returned: %x\n", rc);
289 
290     memset(&light, 0, sizeof(D3DLIGHT7));
291     light.dltType = 12345;
292     U1(light.dcvDiffuse).r = 1.f;
293     U2(light.dcvDiffuse).g = 1.f;
294     U3(light.dcvDiffuse).b = 1.f;
295     U3(light.dvDirection).z = 1.f;
296     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 101, &light);
297     ok(rc==DDERR_INVALIDPARAMS, "SetLight returned: %x\n", rc);
298 
299     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 102, NULL);
300     ok(rc==DDERR_INVALIDPARAMS, "SetLight returned: %x\n", rc);
301 
302     memset(&light, 0, sizeof(D3DLIGHT7));
303     light.dltType = D3DLIGHT_SPOT;
304     U1(light.dcvDiffuse).r = 1.f;
305     U2(light.dcvDiffuse).g = 1.f;
306     U3(light.dcvDiffuse).b = 1.f;
307     U3(light.dvDirection).z = 1.f;
308 
309     light.dvAttenuation0 = -one / zero; /* -INFINITY */
310     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 103, &light);
311     ok(rc==DDERR_INVALIDPARAMS, "SetLight returned: %x\n", rc);
312 
313     light.dvAttenuation0 = -1.0;
314     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 103, &light);
315     ok(rc==DDERR_INVALIDPARAMS, "SetLight returned: %x\n", rc);
316 
317     light.dvAttenuation0 = 0.0;
318     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 103, &light);
319     ok(rc==D3D_OK, "SetLight returned: %x\n", rc);
320 
321     light.dvAttenuation0 = 1.0;
322     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 103, &light);
323     ok(rc==D3D_OK, "SetLight returned: %x\n", rc);
324 
325     light.dvAttenuation0 = one / zero; /* +INFINITY */
326     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 103, &light);
327     ok(rc==D3D_OK, "SetLight returned: %x\n", rc);
328 
329     light.dvAttenuation0 = zero / zero; /* NaN */
330     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 103, &light);
331     ok(rc==D3D_OK ||
332        broken(rc==DDERR_INVALIDPARAMS), "SetLight returned: %x\n", rc);
333 
334     /* Directional light ignores attenuation */
335     light.dltType = D3DLIGHT_DIRECTIONAL;
336     light.dvAttenuation0 = -1.0;
337     rc = IDirect3DDevice7_SetLight(lpD3DDevice, 103, &light);
338     ok(rc==D3D_OK, "SetLight returned: %x\n", rc);
339 
340     memset(&mat, 0, sizeof(mat));
341     rc = IDirect3DDevice7_SetMaterial(lpD3DDevice, &mat);
342     ok(rc == D3D_OK, "IDirect3DDevice7_SetMaterial returned: %x\n", rc);
343 
344     U4(mat).power = 129.0;
345     rc = IDirect3DDevice7_SetMaterial(lpD3DDevice, &mat);
346     ok(rc == D3D_OK, "IDirect3DDevice7_SetMaterial(power = 129.0) returned: %x\n", rc);
347     memset(&mat, 0, sizeof(mat));
348     rc = IDirect3DDevice7_GetMaterial(lpD3DDevice, &mat);
349     ok(rc == D3D_OK, "IDirect3DDevice7_GetMaterial returned: %x\n", rc);
350     ok(U4(mat).power == 129, "Returned power is %f\n", U4(mat).power);
351 
352     U4(mat).power = -1.0;
353     rc = IDirect3DDevice7_SetMaterial(lpD3DDevice, &mat);
354     ok(rc == D3D_OK, "IDirect3DDevice7_SetMaterial(power = -1.0) returned: %x\n", rc);
355     memset(&mat, 0, sizeof(mat));
356     rc = IDirect3DDevice7_GetMaterial(lpD3DDevice, &mat);
357     ok(rc == D3D_OK, "IDirect3DDevice7_GetMaterial returned: %x\n", rc);
358     ok(U4(mat).power == -1, "Returned power is %f\n", U4(mat).power);
359 
360     memset(&caps, 0, sizeof(caps));
361     rc = IDirect3DDevice7_GetCaps(lpD3DDevice, &caps);
362     ok(rc == D3D_OK, "IDirect3DDevice7_GetCaps failed with %x\n", rc);
363 
364     if ( caps.dwMaxActiveLights == (DWORD) -1) {
365         /* Some cards without T&L Support return -1 (Examples: Voodoo Banshee, RivaTNT / NV4) */
366         skip("T&L not supported\n");
367         return;
368     }
369 
370     for(i = 1; i <= caps.dwMaxActiveLights; i++) {
371         rc = IDirect3DDevice7_LightEnable(lpD3DDevice, i, TRUE);
372         ok(rc == D3D_OK, "Enabling light %u failed with %x\n", i, rc);
373         rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, i, &enabled);
374         ok(rc == D3D_OK, "GetLightEnable on light %u failed with %x\n", i, rc);
375         ok(enabled, "Light %d is %s\n", i, enabled ? "enabled" : "disabled");
376     }
377 
378     /* TODO: Test the rendering results in this situation */
379     rc = IDirect3DDevice7_LightEnable(lpD3DDevice, i + 1, TRUE);
380     ok(rc == D3D_OK, "Enabling one light more than supported returned %x\n", rc);
381     rc = IDirect3DDevice7_GetLightEnable(lpD3DDevice, i + 1, &enabled);
382     ok(rc == D3D_OK, "GetLightEnable on light %u failed with %x\n", i + 1,  rc);
383     ok(enabled, "Light %d is %s\n", i + 1, enabled ? "enabled" : "disabled");
384     rc = IDirect3DDevice7_LightEnable(lpD3DDevice, i + 1, FALSE);
385     ok(rc == D3D_OK, "Disabling the additional returned %x\n", rc);
386 
387     for(i = 1; i <= caps.dwMaxActiveLights; i++) {
388         rc = IDirect3DDevice7_LightEnable(lpD3DDevice, i, FALSE);
389         ok(rc == D3D_OK, "Disabling light %u failed with %x\n", i, rc);
390     }
391 }
392 
393 static void ProcessVerticesTest(void)
394 {
395     D3DVERTEXBUFFERDESC desc;
396     HRESULT rc;
397     VERTEX *in;
398     TVERTEX *out;
399     VERTEX *out2;
400     D3DVIEWPORT7 vp;
401     D3DMATRIX view = {  2.0, 0.0, 0.0, 0.0,
402                         0.0, -1.0, 0.0, 0.0,
403                         0.0, 0.0, 1.0, 0.0,
404                         0.0, 0.0, 0.0, 3.0 };
405 
406     D3DMATRIX world = { 0.0, 1.0, 0.0, 0.0,
407                         1.0, 0.0, 0.0, 0.0,
408                         0.0, 0.0, 0.0, 1.0,
409                         0.0, 1.0, 1.0, 1.0 };
410 
411     D3DMATRIX proj = {  1.0, 0.0, 0.0, 1.0,
412                         0.0, 1.0, 1.0, 0.0,
413                         0.0, 1.0, 1.0, 0.0,
414                         1.0, 0.0, 0.0, 1.0 };
415     /* Create some vertex buffers */
416 
417     memset(&desc, 0, sizeof(desc));
418     desc.dwSize = sizeof(desc);
419     desc.dwCaps = 0;
420     desc.dwFVF = D3DFVF_XYZ;
421     desc.dwNumVertices = 16;
422     rc = IDirect3D7_CreateVertexBuffer(lpD3D, &desc, &lpVBufSrc, 0);
423     ok(rc==D3D_OK || rc==E_OUTOFMEMORY, "CreateVertexBuffer returned: %x\n", rc);
424     if (!lpVBufSrc)
425     {
426         trace("IDirect3D7::CreateVertexBuffer() failed with an error %x\n", rc);
427         goto out;
428     }
429 
430     memset(&desc, 0, sizeof(desc));
431     desc.dwSize = sizeof(desc);
432     desc.dwCaps = 0;
433     desc.dwFVF = D3DFVF_XYZRHW;
434     desc.dwNumVertices = 16;
435     /* Msdn says that the last parameter must be 0 - check that */
436     rc = IDirect3D7_CreateVertexBuffer(lpD3D, &desc, &lpVBufDest1, 4);
437     ok(rc==D3D_OK || rc==E_OUTOFMEMORY, "CreateVertexBuffer returned: %x\n", rc);
438     if (!lpVBufDest1)
439     {
440         trace("IDirect3D7::CreateVertexBuffer() failed with an error %x\n", rc);
441         goto out;
442     }
443 
444     memset(&desc, 0, sizeof(desc));
445     desc.dwSize = sizeof(desc);
446     desc.dwCaps = 0;
447     desc.dwFVF = D3DFVF_XYZ;
448     desc.dwNumVertices = 16;
449     /* Msdn says that the last parameter must be 0 - check that */
450     rc = IDirect3D7_CreateVertexBuffer(lpD3D, &desc, &lpVBufDest2, 12345678);
451     ok(rc==D3D_OK || rc==E_OUTOFMEMORY, "CreateVertexBuffer returned: %x\n", rc);
452     if (!lpVBufDest2)
453     {
454         trace("IDirect3D7::CreateVertexBuffer() failed with an error %x\n", rc);
455         goto out;
456     }
457 
458     rc = IDirect3DVertexBuffer7_Lock(lpVBufSrc, 0, (void **) &in, NULL);
459     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %x\n", rc);
460     if(!in) goto out;
461 
462     /* Check basic transformation */
463 
464     in[0].x = 0.0;
465     in[0].y = 0.0;
466     in[0].z = 0.0;
467 
468     in[1].x = 1.0;
469     in[1].y = 1.0;
470     in[1].z = 1.0;
471 
472     in[2].x = -1.0;
473     in[2].y = -1.0;
474     in[2].z = 0.5;
475 
476     in[3].x = 0.5;
477     in[3].y = -0.5;
478     in[3].z = 0.25;
479     rc = IDirect3DVertexBuffer7_Unlock(lpVBufSrc);
480     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %x\n", rc);
481 
482     rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest1, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
483     ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %x\n", rc);
484 
485     rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest2, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
486     ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %x\n", rc);
487 
488     rc = IDirect3DVertexBuffer7_Lock(lpVBufDest1, 0, (void **) &out, NULL);
489     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %x\n", rc);
490     if(!out) goto out;
491 
492     /* Check the results */
493     ok( comparefloat(out[0].x, 128.0 ) &&
494         comparefloat(out[0].y, 128.0 ) &&
495         comparefloat(out[0].z, 0.0 ) &&
496         comparefloat(out[0].rhw, 1.0 ),
497         "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
498 
499     ok( comparefloat(out[1].x, 256.0 ) &&
500         comparefloat(out[1].y, 0.0 ) &&
501         comparefloat(out[1].z, 1.0 ) &&
502         comparefloat(out[1].rhw, 1.0 ),
503         "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
504 
505     ok( comparefloat(out[2].x, 0.0 ) &&
506         comparefloat(out[2].y, 256.0 ) &&
507         comparefloat(out[2].z, 0.5 ) &&
508         comparefloat(out[2].rhw, 1.0 ),
509         "Output 2 vertex is (%f , %f , %f , %f)\n", out[2].x, out[2].y, out[2].z, out[2].rhw);
510 
511     ok( comparefloat(out[3].x, 192.0 ) &&
512         comparefloat(out[3].y, 192.0 ) &&
513         comparefloat(out[3].z, 0.25 ) &&
514         comparefloat(out[3].rhw, 1.0 ),
515         "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
516 
517     rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest1);
518     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %x\n", rc);
519     out = NULL;
520 
521     rc = IDirect3DVertexBuffer7_Lock(lpVBufDest2, 0, (void **) &out2, NULL);
522     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %x\n", rc);
523     if(!out2) goto out;
524     /* Small thing without much practical meaning, but I stumbled upon it,
525      * so let's check for it: If the output vertex buffer has to RHW value,
526      * The RHW value of the last vertex is written into the next vertex
527      */
528     ok( comparefloat(out2[4].x, 1.0 ) &&
529         comparefloat(out2[4].y, 0.0 ) &&
530         comparefloat(out2[4].z, 0.0 ),
531         "Output 4 vertex is (%f , %f , %f)\n", out2[4].x, out2[4].y, out2[4].z);
532 
533     rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest2);
534     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %x\n", rc);
535     out = NULL;
536 
537     /* Try a more complicated viewport, same vertices */
538     memset(&vp, 0, sizeof(vp));
539     vp.dwX = 10;
540     vp.dwY = 5;
541     vp.dwWidth = 246;
542     vp.dwHeight = 130;
543     vp.dvMinZ = -2.0;
544     vp.dvMaxZ = 4.0;
545     rc = IDirect3DDevice7_SetViewport(lpD3DDevice, &vp);
546     ok(rc==D3D_OK, "IDirect3DDevice7_SetViewport failed with rc=%x\n", rc);
547 
548     /* Process again */
549     rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest1, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
550     ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %x\n", rc);
551 
552     rc = IDirect3DVertexBuffer7_Lock(lpVBufDest1, 0, (void **) &out, NULL);
553     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %x\n", rc);
554     if(!out) goto out;
555 
556     /* Check the results */
557     ok( comparefloat(out[0].x, 133.0 ) &&
558         comparefloat(out[0].y, 70.0 ) &&
559         comparefloat(out[0].z, -2.0 ) &&
560         comparefloat(out[0].rhw, 1.0 ),
561         "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
562 
563     ok( comparefloat(out[1].x, 256.0 ) &&
564         comparefloat(out[1].y, 5.0 ) &&
565         comparefloat(out[1].z, 4.0 ) &&
566         comparefloat(out[1].rhw, 1.0 ),
567         "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
568 
569     ok( comparefloat(out[2].x, 10.0 ) &&
570         comparefloat(out[2].y, 135.0 ) &&
571         comparefloat(out[2].z, 1.0 ) &&
572         comparefloat(out[2].rhw, 1.0 ),
573         "Output 2 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
574 
575     ok( comparefloat(out[3].x, 194.5 ) &&
576         comparefloat(out[3].y, 102.5 ) &&
577         comparefloat(out[3].z, -0.5 ) &&
578         comparefloat(out[3].rhw, 1.0 ),
579         "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
580 
581     rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest1);
582     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %x\n", rc);
583     out = NULL;
584 
585     /* Play with some matrices. */
586 
587     rc = IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_VIEW, &view);
588     ok(rc==D3D_OK, "IDirect3DDevice7_SetTransform failed\n");
589 
590     rc = IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_PROJECTION, &proj);
591     ok(rc==D3D_OK, "IDirect3DDevice7_SetTransform failed\n");
592 
593     rc = IDirect3DDevice7_SetTransform(lpD3DDevice, D3DTRANSFORMSTATE_WORLD, &world);
594     ok(rc==D3D_OK, "IDirect3DDevice7_SetTransform failed\n");
595 
596     rc = IDirect3DVertexBuffer7_ProcessVertices(lpVBufDest1, D3DVOP_TRANSFORM, 0, 4, lpVBufSrc, 0, lpD3DDevice, 0);
597     ok(rc==D3D_OK , "IDirect3DVertexBuffer::ProcessVertices returned: %x\n", rc);
598 
599     rc = IDirect3DVertexBuffer7_Lock(lpVBufDest1, 0, (void **) &out, NULL);
600     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Lock returned: %x\n", rc);
601     if(!out) goto out;
602 
603     /* Keep the viewport simpler, otherwise we get bad numbers to compare */
604     vp.dwX = 0;
605     vp.dwY = 0;
606     vp.dwWidth = 100;
607     vp.dwHeight = 100;
608     vp.dvMinZ = 1.0;
609     vp.dvMaxZ = 0.0;
610     rc = IDirect3DDevice7_SetViewport(lpD3DDevice, &vp);
611     ok(rc==D3D_OK, "IDirect3DDevice7_SetViewport failed\n");
612 
613     /* Check the results */
614     ok( comparefloat(out[0].x, 256.0 ) &&    /* X coordinate is cut at the surface edges */
615         comparefloat(out[0].y, 70.0 ) &&
616         comparefloat(out[0].z, -2.0 ) &&
617         comparefloat(out[0].rhw, (1.0 / 3.0)),
618         "Output 0 vertex is (%f , %f , %f , %f)\n", out[0].x, out[0].y, out[0].z, out[0].rhw);
619 
620     ok( comparefloat(out[1].x, 256.0 ) &&
621         comparefloat(out[1].y, 78.125000 ) &&
622         comparefloat(out[1].z, -2.750000 ) &&
623         comparefloat(out[1].rhw, 0.125000 ),
624         "Output 1 vertex is (%f , %f , %f , %f)\n", out[1].x, out[1].y, out[1].z, out[1].rhw);
625 
626     ok( comparefloat(out[2].x, 256.0 ) &&
627         comparefloat(out[2].y, 44.000000 ) &&
628         comparefloat(out[2].z, 0.400000 ) &&
629         comparefloat(out[2].rhw, 0.400000 ),
630         "Output 2 vertex is (%f , %f , %f , %f)\n", out[2].x, out[2].y, out[2].z, out[2].rhw);
631 
632     ok( comparefloat(out[3].x, 256.0 ) &&
633         comparefloat(out[3].y, 81.818184 ) &&
634         comparefloat(out[3].z, -3.090909 ) &&
635         comparefloat(out[3].rhw, 0.363636 ),
636         "Output 3 vertex is (%f , %f , %f , %f)\n", out[3].x, out[3].y, out[3].z, out[3].rhw);
637 
638     rc = IDirect3DVertexBuffer7_Unlock(lpVBufDest1);
639     ok(rc==D3D_OK , "IDirect3DVertexBuffer::Unlock returned: %x\n", rc);
640     out = NULL;
641 
642 out:
643     IDirect3DVertexBuffer7_Release(lpVBufSrc);
644     IDirect3DVertexBuffer7_Release(lpVBufDest1);
645     IDirect3DVertexBuffer7_Release(lpVBufDest2);
646 }
647 
648 static void StateTest( void )
649 {
650     HRESULT rc;
651 
652     /* The msdn says its undocumented, does it return an error too? */
653     rc = IDirect3DDevice7_SetRenderState(lpD3DDevice, D3DRENDERSTATE_ZVISIBLE, TRUE);
654     ok(rc == D3D_OK, "IDirect3DDevice7_SetRenderState(D3DRENDERSTATE_ZVISIBLE, TRUE) returned %08x\n", rc);
655     rc = IDirect3DDevice7_SetRenderState(lpD3DDevice, D3DRENDERSTATE_ZVISIBLE, FALSE);
656     ok(rc == D3D_OK, "IDirect3DDevice7_SetRenderState(D3DRENDERSTATE_ZVISIBLE, FALSE) returned %08x\n", rc);
657 }
658 
659 
660 static void SceneTest(void)
661 {
662     HRESULT                      hr;
663 
664     /* Test an EndScene without beginscene. Should return an error */
665     hr = IDirect3DDevice7_EndScene(lpD3DDevice);
666     ok(hr == D3DERR_SCENE_NOT_IN_SCENE, "IDirect3DDevice7_EndScene returned %08x\n", hr);
667 
668     /* Test a normal BeginScene / EndScene pair, this should work */
669     hr = IDirect3DDevice7_BeginScene(lpD3DDevice);
670     ok(hr == D3D_OK, "IDirect3DDevice7_BeginScene failed with %08x\n", hr);
671     if(SUCCEEDED(hr))
672     {
673         DDBLTFX fx;
674         memset(&fx, 0, sizeof(fx));
675         fx.dwSize = sizeof(fx);
676 
677         if(lpDDSdepth) {
678             hr = IDirectDrawSurface7_Blt(lpDDSdepth, NULL, NULL, NULL, DDBLT_DEPTHFILL, &fx);
679             ok(hr == D3D_OK, "Depthfill failed in a BeginScene / EndScene pair\n");
680         } else {
681             skip("Depth stencil creation failed at startup, skipping\n");
682         }
683         hr = IDirect3DDevice7_EndScene(lpD3DDevice);
684         ok(hr == D3D_OK, "IDirect3DDevice7_EndScene failed with %08x\n", hr);
685     }
686 
687     /* Test another EndScene without having begun a new scene. Should return an error */
688     hr = IDirect3DDevice7_EndScene(lpD3DDevice);
689     ok(hr == D3DERR_SCENE_NOT_IN_SCENE, "IDirect3DDevice7_EndScene returned %08x\n", hr);
690 
691     /* Two nested BeginScene and EndScene calls */
692     hr = IDirect3DDevice7_BeginScene(lpD3DDevice);
693     ok(hr == D3D_OK, "IDirect3DDevice7_BeginScene failed with %08x\n", hr);
694     hr = IDirect3DDevice7_BeginScene(lpD3DDevice);
695     ok(hr == D3DERR_SCENE_IN_SCENE, "IDirect3DDevice7_BeginScene returned %08x\n", hr);
696     hr = IDirect3DDevice7_EndScene(lpD3DDevice);
697     ok(hr == D3D_OK, "IDirect3DDevice7_EndScene failed with %08x\n", hr);
698     hr = IDirect3DDevice7_EndScene(lpD3DDevice);
699     ok(hr == D3DERR_SCENE_NOT_IN_SCENE, "IDirect3DDevice7_EndScene returned %08x\n", hr);
700 
701     /* TODO: Verify that blitting works in the same way as in d3d9 */
702 }
703 
704 static void LimitTest(void)
705 {
706     IDirectDrawSurface7 *pTexture = NULL;
707     HRESULT hr;
708     int i;
709     DDSURFACEDESC2 ddsd;
710 
711     memset(&ddsd, 0, sizeof(ddsd));
712     ddsd.dwSize = sizeof(ddsd);
713     ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
714     ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE;
715     ddsd.dwWidth = 16;
716     ddsd.dwHeight = 16;
717     hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &pTexture, NULL);
718     ok(hr==DD_OK,"CreateSurface returned: %x\n",hr);
719     if(!pTexture) return;
720 
721     for(i = 0; i < 8; i++) {
722         hr = IDirect3DDevice7_SetTexture(lpD3DDevice, i, pTexture);
723         ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %08x\n", i, hr);
724         hr = IDirect3DDevice7_SetTexture(lpD3DDevice, i, NULL);
725         ok(hr == D3D_OK, "IDirect3DDevice8_SetTexture for sampler %d failed with %08x\n", i, hr);
726         hr = IDirect3DDevice7_SetTextureStageState(lpD3DDevice, i, D3DTSS_COLOROP, D3DTOP_ADD);
727         ok(hr == D3D_OK, "IDirect3DDevice8_SetTextureStageState for texture %d failed with %08x\n", i, hr);
728     }
729 
730     IDirectDrawSurface7_Release(pTexture);
731 }
732 
733 static HRESULT WINAPI enumDevicesCallback(GUID *Guid,LPSTR DeviceDescription,LPSTR DeviceName, D3DDEVICEDESC *hal, D3DDEVICEDESC *hel, VOID *ctx)
734 {
735     UINT ver = *((UINT *) ctx);
736     if(IsEqualGUID(&IID_IDirect3DRGBDevice, Guid))
737     {
738         ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0,
739            "RGB Device %d hal line caps has D3DPTEXTURECAPS_POW2 flag set\n", ver);
740         ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0,
741            "RGB Device %d hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n", ver);
742         ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2,
743            "RGB Device %d hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver);
744         ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2,
745            "RGB Device %d hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver);
746 
747         ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0,
748            "RGB Device %d hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
749         ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0,
750            "RGB Device %d hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
751         ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE,
752            "RGB Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
753         ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE,
754            "RGB Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
755     }
756     else if(IsEqualGUID(&IID_IDirect3DHALDevice, Guid))
757     {
758         /* pow2 is hardware dependent */
759 
760         ok(hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE,
761            "HAL Device %d hal line caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
762         ok(hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE,
763            "HAL Device %d hal tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
764         ok((hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0,
765            "HAL Device %d hel line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
766         ok((hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0,
767            "HAL Device %d hel tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
768     }
769     else if(IsEqualGUID(&IID_IDirect3DRefDevice, Guid))
770     {
771         ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0,
772            "REF Device %d hal line caps has D3DPTEXTURECAPS_POW2 flag set\n", ver);
773         ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0,
774            "REF Device %d hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n", ver);
775         ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2,
776            "REF Device %d hel line caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver);
777         ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2,
778            "REF Device %d hel tri caps does not have D3DPTEXTURECAPS_POW2 flag set\n", ver);
779 
780         ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0,
781            "REF Device %d hal line caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
782         ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE) == 0,
783            "REF Device %d hal tri caps has D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
784         ok(hel->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE,
785            "REF Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
786         ok(hel->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_PERSPECTIVE,
787            "REF Device %d hel tri caps does not have D3DPTEXTURECAPS_PERSPECTIVE set\n", ver);
788     }
789     else if(IsEqualGUID(&IID_IDirect3DRampDevice, Guid))
790     {
791         ok((hal->dpcLineCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0,
792            "Ramp Device %d hal line caps has D3DPTEXTURECAPS_POW2 flag set\n", ver);
793         ok((hal->dpcTriCaps.dwTextureCaps & D3DPTEXTURECAPS_POW2) == 0,
794            "Ramp Device %d hal tri caps has D3DPTEXTURECAPS_POW2 flag set\n", ver);
795         ok(hel->dpcLineCaps.dwTextureCaps &