No need for a temporary buffer. The pointer that you pointed out from Lockis essentially a temporary buffer. A driver can really really start any meaningful operations on it as soon as you unlock the buffer.
If you are using D3DLOCK_DISCARD, then the driver is not required to follow checks with any reasonable data. This way, the implementation can return perfectly malloc(size).
If you are not using D3DLOCK_DISCARD, then, well, this is actually a separate issue.
Puppy source
share