The tests also pass when the frame is created via IDirect3DRM_CreateFrame and IDirect3DRM2_CreateFrame.
On Tue, Mar 31, 2015 at 1:36 AM, Aaryaman Vasishta < jem456.vasishta@gmail.com> wrote:
dlls/d3drm/tests/d3drm.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 515aace..6029b1a 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -1841,6 +1841,104 @@ static void test_d3drm_qi(void) IDirect3DRM_Release(d3drm); }
+static void test_frame_qi(void) +{
- static const struct qi_test tests[] =
- {
{ &IID_IDirect3DRMFrame3, &IID_IDirect3DRMFrame3, S_OK, FALSE },
{ &IID_IDirect3DRMFrame2, &IID_IDirect3DRMFrame3, S_OK, FALSE },
{ &IID_IDirect3DRMFrame, &IID_IDirect3DRMFrame3, S_OK, FALSE },
{ &IID_IDirect3DRM, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMDevice, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMObject, &IID_IDirect3DRMFrame3, S_OK, FALSE },
{ &IID_IDirect3DRMDevice2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMDevice3, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMViewport, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMViewport2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRM3, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRM2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMVisual, &IID_IDirect3DRMFrame3, S_OK, FALSE },
{ &IID_IDirect3DRMMesh, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMMeshBuilder, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMMeshBuilder2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMMeshBuilder3, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMFace, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMFace2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMLight, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMTexture, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMTexture2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMTexture3, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMWrap, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMMaterial, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMMaterial2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMAnimation, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMAnimation2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMAnimationSet, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMAnimationSet2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMObjectArray, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMDeviceArray, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMViewportArray, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMFrameArray, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMVisualArray, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMLightArray, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMPickedArray, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMFaceArray, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMAnimationArray, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMUserVisual, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMShadow, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMShadow2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMInterpolator, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMProgressiveMesh, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMPicked2Array, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DRMClippedVisual, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDrawClipper, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDrawSurface7, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDrawSurface4, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDrawSurface3, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDrawSurface2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDrawSurface, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DDevice7, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DDevice3, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DDevice2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DDevice, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3D7, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3D3, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3D2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3D, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDraw7, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDraw4, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDraw3, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDraw2, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirectDraw, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IDirect3DLight, NULL,
CLASS_E_CLASSNOTAVAILABLE, FALSE },
{ &IID_IUnknown, &IID_IDirect3DRMFrame3, S_OK, FALSE },
- };
- HRESULT hr;
- IDirect3DRM *d3drm;
- IDirect3DRM3 *d3drm3;
- IDirect3DRMFrame3 *frame3;
- hr = Direct3DRMCreate(&d3drm);
- ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n",
hr);
- if (FAILED(hr = IDirect3DRM_QueryInterface(d3drm, &IID_IDirect3DRM3,
(void **)&d3drm3)))
- {
win_skip("Cannot get IDirect3DRM3 interface (hr = %x), skipping
tests\n", hr);
IDirect3DRM_Release(d3drm);
return;
- }
- hr = IDirect3DRM3_CreateFrame(d3drm3, NULL, &frame3);
- ok(hr == D3DRM_OK, "Cannot get IDirect3DRMFrame3 interface (hr =
%x)\n", hr);
- CHECK_REFCOUNT(frame3, 1);
- test_qi("frame_qi", (IUnknown *)frame3, &IID_IDirect3DRMFrame3,
tests, sizeof(tests) / sizeof(*tests));
- IDirect3DRMFrame3_Release(frame3);
- IDirect3DRM3_Release(d3drm3);
- IDirect3DRM_Release(d3drm);
+}
START_TEST(d3drm) { test_MeshBuilder(); @@ -1857,4 +1955,5 @@ START_TEST(d3drm) test_d3drm_load(); test_frame_mesh_materials(); test_d3drm_qi();
- test_frame_qi();
}
1.9.3 (Apple Git-50)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
Am 2015-03-31 um 20:24 schrieb Aaryaman Vasishta:
The tests also pass when the frame is created via IDirect3DRM_CreateFrame and IDirect3DRM2_CreateFrame.
I'll do a few experiments with these interfaces myself. I am still a bit puzzled by IDirect3DRMObject(2), and in particular the Clone method, which apparently allows these objects to be aggregated.
The different interface pointers are more important than I originally thought, especially the separate IUnknown interface (necessary for aggregation). I think it'd be a good idea to behave in the same way, and have tests for it.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi again,
Am 2015-03-31 um 23:44 schrieb Stefan Dösinger:
I'll do a few experiments with these interfaces myself. I am still a bit puzzled by IDirect3DRMObject(2), and in particular the Clone method, which apparently allows these objects to be aggregated.
I've satisfied my curiosity for now. It seems that IDirect3DRMObject::Clone always returns a new object. When the UnkOuter parameter is NULL this is relatively straightforward. It gets funny when aggregation is used: The only way the caller can get his hands on the inner IUnknown is to pass IID_IUnknown as iid parameter. If the caller passes anything else there's no way he can release the inner object once his outer object is destroyed.
I checked the theory that the inner object destroys itself when the outer unknown's Release method returns 0. This is not the case. It would be a fairly shaky setup after all - maybe the final Release call is called on one of the outer object's vtables directly, rather than through an inner vtable.
Finding out whether the clone is a deep copy or not is left as your exercise. Also, no guarantees that my findings are complete or free of errors.
What does this mean for your patches? Since you're not implementing Clone() for now not too much. Please port the tests to d3drm1 and 2 and add tests for which interface pointer is returned when IDirect3DRMObject, IDirect3DRMVisual and IUnknown are queried. Properly testing all the details of Clone and aggregation is something that can be done later.