d3d9/tests: Use a custom GUID for the private data tests.
This commit is contained in:
parent
3754cdd793
commit
6ffbfc7c29
|
@ -5082,6 +5082,13 @@ static void test_private_data(void)
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
DWORD size;
|
DWORD size;
|
||||||
DWORD data[4] = {1, 2, 3, 4};
|
DWORD data[4] = {1, 2, 3, 4};
|
||||||
|
static const GUID d3d9_private_data_test_guid =
|
||||||
|
{
|
||||||
|
0xfdb37466,
|
||||||
|
0x428f,
|
||||||
|
0x4edf,
|
||||||
|
{0xa3,0x7f,0x9b,0x1d,0xf4,0x88,0xc5,0xfc}
|
||||||
|
};
|
||||||
|
|
||||||
window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
|
window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
|
||||||
0, 0, 640, 480, 0, 0, 0, 0);
|
0, 0, 640, 480, 0, 0, 0, 0);
|
||||||
|
@ -5099,57 +5106,57 @@ static void test_private_data(void)
|
||||||
D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &surface, NULL);
|
D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &surface, NULL);
|
||||||
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9 /* Abuse this tag */,
|
hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
|
||||||
device, 0, D3DSPD_IUNKNOWN);
|
device, 0, D3DSPD_IUNKNOWN);
|
||||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||||
hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9 /* Abuse this tag */,
|
hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
|
||||||
device, 5, D3DSPD_IUNKNOWN);
|
device, 5, D3DSPD_IUNKNOWN);
|
||||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||||
hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9 /* Abuse this tag */,
|
hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
|
||||||
device, sizeof(IUnknown *) * 2, D3DSPD_IUNKNOWN);
|
device, sizeof(IUnknown *) * 2, D3DSPD_IUNKNOWN);
|
||||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
/* A failing SetPrivateData call does not clear the old data with the same tag. */
|
/* A failing SetPrivateData call does not clear the old data with the same tag. */
|
||||||
hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DVertexBuffer9, device,
|
hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid, device,
|
||||||
sizeof(device), D3DSPD_IUNKNOWN);
|
sizeof(device), D3DSPD_IUNKNOWN);
|
||||||
ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
|
||||||
hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DVertexBuffer9, device,
|
hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid, device,
|
||||||
sizeof(device) * 2, D3DSPD_IUNKNOWN);
|
sizeof(device) * 2, D3DSPD_IUNKNOWN);
|
||||||
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
|
||||||
size = sizeof(ptr);
|
size = sizeof(ptr);
|
||||||
hr = IDirect3DSurface9_GetPrivateData(surface, &IID_IDirect3DVertexBuffer9, &ptr, &size);
|
hr = IDirect3DSurface9_GetPrivateData(surface, &d3d9_private_data_test_guid, &ptr, &size);
|
||||||
ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr);
|
||||||
IUnknown_Release(ptr);
|
IUnknown_Release(ptr);
|
||||||
hr = IDirect3DSurface9_FreePrivateData(surface, &IID_IDirect3DVertexBuffer9);
|
hr = IDirect3DSurface9_FreePrivateData(surface, &d3d9_private_data_test_guid);
|
||||||
ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
|
||||||
|
|
||||||
refcount = get_refcount((IUnknown *)device);
|
refcount = get_refcount((IUnknown *)device);
|
||||||
hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9 /* Abuse this tag */,
|
hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
|
||||||
device, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
|
device, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
|
||||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
expected_refcount = refcount + 1;
|
expected_refcount = refcount + 1;
|
||||||
refcount = get_refcount((IUnknown *)device);
|
refcount = get_refcount((IUnknown *)device);
|
||||||
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
|
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
|
||||||
hr = IDirect3DSurface9_FreePrivateData(surface, &IID_IDirect3DSurface9);
|
hr = IDirect3DSurface9_FreePrivateData(surface, &d3d9_private_data_test_guid);
|
||||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
expected_refcount = refcount - 1;
|
expected_refcount = refcount - 1;
|
||||||
refcount = get_refcount((IUnknown *)device);
|
refcount = get_refcount((IUnknown *)device);
|
||||||
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
|
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
|
||||||
|
|
||||||
hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9,
|
hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
|
||||||
device, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
|
device, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
|
||||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9,
|
hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
|
||||||
surface, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
|
surface, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
|
||||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
refcount = get_refcount((IUnknown *)device);
|
refcount = get_refcount((IUnknown *)device);
|
||||||
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
|
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
|
||||||
|
|
||||||
hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DSurface9,
|
hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid,
|
||||||
device, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
|
device, sizeof(IUnknown *), D3DSPD_IUNKNOWN);
|
||||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
size = sizeof(ptr);
|
size = sizeof(ptr);
|
||||||
hr = IDirect3DSurface9_GetPrivateData(surface, &IID_IDirect3DSurface9, &ptr, &size);
|
hr = IDirect3DSurface9_GetPrivateData(surface, &d3d9_private_data_test_guid, &ptr, &size);
|
||||||
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3D_OK, "Got unexpected hr %#x.\n", hr);
|
||||||
expected_refcount = refcount + 2;
|
expected_refcount = refcount + 2;
|
||||||
refcount = get_refcount((IUnknown *)device);
|
refcount = get_refcount((IUnknown *)device);
|
||||||
|
@ -5171,27 +5178,27 @@ static void test_private_data(void)
|
||||||
hr = IDirect3DTexture9_GetSurfaceLevel(texture, 1, &surface2);
|
hr = IDirect3DTexture9_GetSurfaceLevel(texture, 1, &surface2);
|
||||||
ok(SUCCEEDED(hr), "Failed to get texture level 1, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get texture level 1, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DTexture9_SetPrivateData(texture, &IID_IDirect3DVertexBuffer9, data, sizeof(data), 0);
|
hr = IDirect3DTexture9_SetPrivateData(texture, &d3d9_private_data_test_guid, data, sizeof(data), 0);
|
||||||
ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
|
||||||
|
|
||||||
memset(data, 0, sizeof(data));
|
memset(data, 0, sizeof(data));
|
||||||
size = sizeof(data);
|
size = sizeof(data);
|
||||||
hr = IDirect3DSurface9_GetPrivateData(surface, &IID_IDirect3DVertexBuffer9, data, &size);
|
hr = IDirect3DSurface9_GetPrivateData(surface, &d3d9_private_data_test_guid, data, &size);
|
||||||
ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
||||||
hr = IDirect3DTexture9_GetPrivateData(texture, &IID_IDirect3DVertexBuffer9, data, &size);
|
hr = IDirect3DTexture9_GetPrivateData(texture, &d3d9_private_data_test_guid, data, &size);
|
||||||
ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to get private data, hr %#x.\n", hr);
|
||||||
ok(data[0] == 1 && data[1] == 2 && data[2] == 3 && data[3] == 4,
|
ok(data[0] == 1 && data[1] == 2 && data[2] == 3 && data[3] == 4,
|
||||||
"Got unexpected private data: %u, %u, %u, %u.\n", data[0], data[1], data[2], data[3]);
|
"Got unexpected private data: %u, %u, %u, %u.\n", data[0], data[1], data[2], data[3]);
|
||||||
|
|
||||||
hr = IDirect3DTexture9_FreePrivateData(texture, &IID_IDirect3DVertexBuffer9);
|
hr = IDirect3DTexture9_FreePrivateData(texture, &d3d9_private_data_test_guid);
|
||||||
ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DSurface9_SetPrivateData(surface, &IID_IDirect3DVertexBuffer9, data, sizeof(data), 0);
|
hr = IDirect3DSurface9_SetPrivateData(surface, &d3d9_private_data_test_guid, data, sizeof(data), 0);
|
||||||
ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to set private data, hr %#x.\n", hr);
|
||||||
hr = IDirect3DSurface9_GetPrivateData(surface2, &IID_IDirect3DVertexBuffer9, data, &size);
|
hr = IDirect3DSurface9_GetPrivateData(surface2, &d3d9_private_data_test_guid, data, &size);
|
||||||
ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
ok(hr == D3DERR_NOTFOUND, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
hr = IDirect3DSurface9_FreePrivateData(surface, &IID_IDirect3DVertexBuffer9);
|
hr = IDirect3DSurface9_FreePrivateData(surface, &d3d9_private_data_test_guid);
|
||||||
ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
|
ok(SUCCEEDED(hr), "Failed to free private data, hr %#x.\n", hr);
|
||||||
|
|
||||||
IDirect3DSurface9_Release(surface2);
|
IDirect3DSurface9_Release(surface2);
|
||||||
|
|
Loading…
Reference in New Issue