I'm currently dealing with some old DirectX code that looks (quite often at very different places) something like this:
LPDIRECT3DVERTEXBUFFER9 buffer;
//create the vertex buffer correctly here ...
buffer->Lock(...);
//loop through the buffer to check something
for(...) {
if(checkPositive) return true;
//some other code still inside the loop
}
buffer->Unlock();
I was just wondering if there is something like a scoped lock in DirectX, that automatically unlocks the buffer at the end of the locks lifetime. I think it will be much easier to use such a lock than manually checking every line of code now and in the future.
So before I start writing my own lock I just wanted to make sure, there's no implementation already available in the depths of the DirectX SDK.
thanks, Lenny