Re: [PATCH] ddraw: add dsurface dimension tests, try 8
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2014-04-04 13:57, schrieb Patrick Rudolph:
+ static struct + { + const char *name; + DDPIXELFORMAT fmt; + } + formats[] = You can make this const.
+ /* 6: Test maximum surface height */ + {DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT, DDSCAPS_OFFSCREENPLAIN, 1, 0x10000, DDERR_INVALIDPARAMS}, + /* 7: Test maximum surface width */ + {DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT, DDSCAPS_OFFSCREENPLAIN, 0x10000, 1, DDERR_INVALIDPARAMS}, These tests fail on Wine. Please include your patch that introduces the size check in this patch or in a separate patch to apply before this one, or mark them todo_wine.
+ /* 8: Test OUTOFVIDEOMEMORY */ + {DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_VIDEOMEMORY, + 0xffff, 0xffff, DDERR_OUTOFVIDEOMEMORY}, This also fails on Wine. You'll have to move the adapter_adjust_memory() call in dlls/wined3d/resource.c, resource_init() ahead of the memory allocation call.
+ /* 9: Test OUTOFMEMORY */ + {DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT, DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY, + 0xffff, 0xffff, DDERR_OUTOFMEMORY}, This test still fails in 64 bit on my Windows 7 test machine with D3DFMT_P8. The failure happens because CreateSurface succeeds although the test expects it to fail. I'd suggest to remove this test for the same reason as test 10.
+ /* does the hardware support videomemory ? */ + if (!(ddcaps.ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY)) + { + tests[8].hr = DDERR_NODIRECTDRAWHW; + } You can remove the curly brackets here.
+ for (i = 0; i < sizeof(tests) / sizeof(*tests); i ++) + { + if (surface) + { + IDirectDrawSurface_Release(surface); + surface = NULL; + } + + memset(&surfacedesc, 0, sizeof(surfacedesc)); + surfacedesc.dwSize = sizeof(surfacedesc); + surfacedesc.dwFlags = tests[i].dwFlags | DDSD_PIXELFORMAT; + surfacedesc.ddsCaps.dwCaps = tests[i].dwCaps; + surfacedesc.dwWidth = tests[i].dwWidth; + surfacedesc.dwHeight = tests[i].dwHeight; + surfacedesc.ddpfPixelFormat = formats[j].fmt; + + hr = IDirectDraw_CreateSurface(ddraw, &surfacedesc, &surface, NULL); + ok(hr == tests[i].hr, "Pixelformat %s, test %d returned %08x\n", formats[j].name, i, hr); + } Why is the surface release before the create call? You're potentially leaking surfaces here.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIcBAEBAgAGBQJTQdGlAAoJEN0/YqbEcdMwvikP/RT9mO2pARAAfY7DIRuOns3R 8rYw7skxAOwKU12NK42gaSqTjZKoRglpXyYJwD1keq9uRZnk8oAy4yQN7axg3/wq OI8gF6VN9Dlqofq6l4FD8rNC0yBFxxehZkOJXpzGXGisDau3C+pK007+fnwb0zQI IOJ+M/ok+cOvmymbktmrRryVtrttG5Z0EYqpBQw53+ZTKUyu6AhcuoXV5Sf04Jkx SnCHhRn3RLKEMTwc/XT6O5+in89CgIcrMmNWnCk0JrgywNhqOxX4A9HzkHTL3h/n OHR1fJW4SmRDwT4r+nQmOBjIY7tCipv0xK5LTOqbaNCDxTIyZL2AOji5PeR4mZWH iHPOb6826iouxE8P12cLfgueBebhY/lVCmiWwV67K7koFSmYs4MhtR/jdeiuZ8rI jYgta2gNvP8Nk+R+HGxhGg6rrykNBb+lWTI5Ua+QAa7DBdW9uldLH4U+bf6mti90 171NAQA0VTrxV/dnkAxOmZ4jXogWhShrIyElD3PG6ZCxZ6W85/tdLReAyy/+feoQ OS+QdlYDrnYJlW0Bko254YAWJHk5hViy7feDFCHl+FuI/7hN3+UmKvpVloWkD7sh EpRqmAm8GtxAyaPsJtJVkWQ6s3YTkoYIZOSVUbItRWJbQvEfB/DDIYG6lTkGAxS5 cEUsoGMsqQbBK9QZf/s2 =TT3X -----END PGP SIGNATURE-----
participants (1)
-
Stefan Dösinger