-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Am 19.08.2011 um 14:04 schrieb Michael Mc Donnell: > Ok I see that in dlls/d3d9/tests/buffers.c. So it will fail to lock on > Win7 if D3DLOCK_DISCARD is specified and the vertex buffer wasn't > created with D3DUSAGE_DYNAMIC? Yes, unless Microsoft changed this again. > Am I correct in D3DLOCK_DISCARD makes a copy of the vertex buffer so > that the video card can keep reading the old one, and the old vertex > buffer memory is released after the video card releases its lock [1]? Sort of. It doesn't copy the old data, it just gives you a fresh, uninitialized block of memory. So if you read from the pointer you get from a DISCARD lock you'll get garbage. > In that case it does not make sense to use D3DLOCK_DISCARD at all in > CloneMesh, as the video card has not begun to use the new vertex > buffer, and it will just add memory overhead. The easiest fix would be > to just pass 0 instead of D3DLOCK_DISCARD. I've done that in the > updated patch. Right, the buffer is newly created in CloneMesh. Just not using DISCARD is the best fix then. >> I noticed a few more D3DLOCK_DISCARD locks in the mesh.c code. > > I guess the other methods should check the mesh options for > D3DXMESH_DYNAMIC, D3DXMESH_VB_DYNAMIC, and D3DXMESH_IB_DYNAMIC [2] > before using D3DLOCK_DISCARD? I'll write patches for those. Most likely yes. I haven't looked at the details. If the buffer is new in those situations as well just don't pass any flags, otherwise pass DISCARD if you lock a dynamic buffer and are going to rewrite the entire buffer contents. -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) iQIcBAEBAgAGBQJOTlUYAAoJEN0/YqbEcdMwi3kP/AwlIBwuD8XpvAnpVJMmFyM8 lZCJ5zrEbBypYPSin3lEv7yiA+tw2YQwD4ODoZHRZCLKi7Gy07EI2FLAX34KAhxa ESNXanQuMWaglkj2QfV7aJan8plHdKhTA6HZl3VFCGSLHNjbGWzDXpO60TKTJU3F jU0Iqnyxq2KSdDU0R6gMsIHKF6wLBkVMOheGTXO2Mc2VwBMt85js+T9+tSUKvKTR ncVhvnygGLhyB0QfprFvN70If+BKQIicseJm6zO9nIt8/qqmtd6t9QYneEY+HIJI rZMpHCwxRKmGnCJuJfXnZDtRqUTsT2S7iZuIDUi7xH+It79uWvFEP+Cs/bB2ssqF kyw1kmTVSi99vbmiQRn4wBGv9C32L9C64SUwNH/nQg7E0iO9zdQxLE3oU64v4lVs OaTYuIghLxrDaR9+28yLjt97oBvxPLvrhuve2ASpevz+6Fa3n40o1OTBi3ch+Q70 xOBe1Qh9lX40C56b2XVx+j5XfqrNFl1BS/Tluvcs66mgcdTKeZp4ATjx5Js9c1eT /JsfBiARrGEZ1pVYLRbUY1oky+sq64/sSFsjs8QMerfhms1kTk8oziTTvSw0uT5H UCF3MadXFwrFnif/kPQ4hfBKr29E28lB/JSp/tb7Rxtim7Se2F8a6I5kmrIwjRoQ nWko6eM0FzSMR+OiZbsz =SQxW -----END PGP SIGNATURE-----