Module: wine Branch: master Commit: eb9227015ad639a1fbdb15eeb212d25c0bdc083c URL: http://source.winehq.org/git/wine.git/?a=commit;h=eb9227015ad639a1fbdb15eeb2...
Author: Andrew Nguyen anguyen@codeweavers.com Date: Mon Jun 21 10:15:05 2010 -0500
ddraw: Allow the ddraw RGB device to be enumerated in IDirect3D3::FindDevice.
Partially based on a patch by David Adam.
---
dlls/ddraw/direct3d.c | 5 ++- dlls/ddraw/tests/d3d.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/direct3d.c b/dlls/ddraw/direct3d.c index f919860..edbcc28 100644 --- a/dlls/ddraw/direct3d.c +++ b/dlls/ddraw/direct3d.c @@ -684,10 +684,11 @@ IDirect3DImpl_3_FindDevice(IDirect3D3 *iface, TRACE(" trying to match guid %s.\n", debugstr_guid(&(D3DDFS->guid))); if ((IsEqualGUID(&IID_D3DDEVICE_WineD3D, &(D3DDFS->guid)) == 0) && (IsEqualGUID(&IID_IDirect3DHALDevice, &(D3DDFS->guid)) == 0) && - (IsEqualGUID(&IID_IDirect3DRefDevice, &(D3DDFS->guid)) == 0)) + (IsEqualGUID(&IID_IDirect3DRefDevice, &(D3DDFS->guid)) == 0) && + (IsEqualGUID(&IID_IDirect3DRGBDevice, &(D3DDFS->guid)) == 0)) { TRACE(" no match for this GUID.\n"); - return DDERR_INVALIDPARAMS; + return DDERR_NOTFOUND; } }
diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index e74fb79..7f47d20 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -3393,9 +3393,20 @@ static void VertexBufferLockRest(void)
static void FindDevice(void) { + static const struct + { + const GUID *guid; + int todo; + } deviceGUIDs[] = + { + {&IID_IDirect3DRampDevice, 1}, + {&IID_IDirect3DRGBDevice}, + }; + D3DFINDDEVICESEARCH search = {0}; D3DFINDDEVICERESULT result = {0}; HRESULT hr; + int i;
/* Test invalid parameters. */ hr = IDirect3D_FindDevice(Direct3D1, NULL, NULL); @@ -3423,6 +3434,59 @@ static void FindDevice(void) hr = IDirect3D_FindDevice(Direct3D1, &search, &result); ok(hr == DDERR_INVALIDPARAMS, "Expected IDirect3D1::FindDevice to return DDERR_INVALIDPARAMS, got 0x%08x\n", hr); + + /* Specifying no flags is permitted. */ + search.dwSize = sizeof(search); + search.dwFlags = 0; + result.dwSize = sizeof(result); + + hr = IDirect3D_FindDevice(Direct3D1, &search, &result); + ok(hr == D3D_OK, + "Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", hr); + + /* Try an arbitrary non-device GUID. */ + search.dwSize = sizeof(search); + search.dwFlags = D3DFDS_GUID; + search.guid = IID_IDirect3D; + result.dwSize = sizeof(result); + + hr = IDirect3D_FindDevice(Direct3D1, &search, &result); + ok(hr == DDERR_NOTFOUND, + "Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", hr); + + /* The reference device GUID can't be enumerated. */ + search.dwSize = sizeof(search); + search.dwFlags = D3DFDS_GUID; + search.guid = IID_IDirect3DRefDevice; + result.dwSize = sizeof(result); + + hr = IDirect3D_FindDevice(Direct3D1, &search, &result); + todo_wine + ok(hr == DDERR_NOTFOUND, + "Expected IDirect3D1::FindDevice to return DDERR_NOTFOUND, got 0x%08x\n", hr); + + /* These GUIDs appear to be always present. */ + for (i = 0; i < sizeof(deviceGUIDs)/sizeof(deviceGUIDs[0]); i++) + { + search.dwSize = sizeof(search); + search.dwFlags = D3DFDS_GUID; + search.guid = *deviceGUIDs[i].guid; + result.dwSize = sizeof(result); + + hr = IDirect3D_FindDevice(Direct3D1, &search, &result); + + if (deviceGUIDs[i].todo) + { + todo_wine + ok(hr == D3D_OK, + "[%d] Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", i, hr); + } + else + { + ok(hr == D3D_OK, + "[%d] Expected IDirect3D1::FindDevice to return D3D_OK, got 0x%08x\n", i, hr); + } + } }
START_TEST(d3d)