-----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-----