Re: [PATCH 7/8] d3drm: Implement IDirect3DRMDevice::CreateDeviceFromSurface.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 2015-08-06 um 00:49 schrieb Aaryaman Vasishta:
device->d3drm = d3drm; + device->render_target = surface; IDirect3DRM_AddRef(d3drm); device->render_target = surface;
This is redundant.
+ hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); + IDirectDrawSurface_Release(ds); + if (FAILED(hr)) + return hr; + } You've overshot my suggestion for pre-attached depth stencils a bit. Now you no longer detach application-created depth stencils any more in case CreateDevice() fails, but you also don't detach a depth stencil that you attached.
This may even be the correct behavior. If you want you can write a test (e.g. try to pass a color surface without DDSCAPS_3DDEVICE, but *with* a depth stencil attached. See if it is detached. Try to pass a color surface without DDSCAPS_3DDEVICE and see if a depth stencil is attached after the failing CreateDevice call), but I don't think it's worth spending much time on this. My suggestion is to detach if creating the IM device fails, but only if create_z_surface is TRUE. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJVw1yLAAoJEN0/YqbEcdMwyJMP/jsXffvDJlssOGTqhDZvVpl0 WBoSf9mClvG7T5Gqz9Kq8tXXZaETSLPdovHryDn3Ux7kJcJllDfE1C/TqP0jc3X8 weQFMEK49TiNsYBItqgVr7v8YU15GMTqyrhwjIH6zTq9XIx27yhAecKNExb10nfD u32ebnJ//Eh90qkfIe6uvSytFUGmjs0OWZjPlneBbEPOj0jyGMFOyNX3IxN1bB6f czAxJBr6z8EQ0KHRQK9sq98WmIA2najmfakXPzg2fbE+RYRDPnYgcfQ1KmQdtvb1 b9KhIt7FMmL+O1VqgyNsWTUwUin57I0RpyjdBcZ8F48yblUf07a0qiY9udKawKYB xwAmriEMOd37n9Ip6PguawySmdv7a4Jrd8O0Xcu+FRidUMjzq9ZkgvqNht2OaWgv 2dYOCCR6TuA5dYxD3YaqHgJpUB46KS/vE7Nh8EG/Dh2e6paTQoamBUi15WNG/TQB o5Lr2DlJKuXaJnZYoNLDlYgy88P4/JoDvRBLYekbO/fDB1sqMgdBJbRlKGoy72g5 iIrEUbtMpNNLLpxw+ChwH7Gb5U8LZJWMSeyVv8oO/xliir6vF9Dm/sCt4b+bK4uM Y5Q2hC10oEd6jHkbdSKdU6/C8oyKMcfBQJ9adiiQWF+wXQoOPcsaDxwDILVmInGy /3lu18CaUtUdBEhoX/PR =JeVt -----END PGP SIGNATURE-----
I've sent the mail with the changes requested (on this and patch 3), except for:
+ hr = IDirectDrawSurface_AddAttachedSurface(surface, ds);
+ IDirectDrawSurface_Release(ds); + if (FAILED(hr)) + return hr; + } You've overshot my suggestion for pre-attached depth stencils a bit. Now you no longer detach application-created depth stencils any more in case CreateDevice() fails, but you also don't detach a depth stencil that you attached.
This may even be the correct behavior. If you want you can write a test (e.g. try to pass a color surface without DDSCAPS_3DDEVICE, but *with* a depth stencil attached. See if it is detached. Try to pass a color surface without DDSCAPS_3DDEVICE and see if a depth stencil is attached after the failing CreateDevice call), but I don't think it's worth spending much time on this.
My suggestion is to detach if creating the IM device fails, but only if create_z_surface is TRUE.
As discussed, when CreateDeviceFromSurface returns an error (say, on passing a surface without the 3DDEVICE flag) it'll keep the depth surface it created internally attached, without detaching it from the application-created surface. This bug is apparently not mimicked in Wine's ddraw implementation of AddAttachedSurface, where it will return an error if you attach a z-buffer to a surface without the 3DDEVICE flag. This behavior hasn't been tested on windows yet. We'll probably need to fix this in ddraw and also extend the tests accordingly. Cheers, Jam
participants (2)
-
Aaryaman Vasishta -
Stefan Dösinger