Skip to main content
GameDev.net gamedev.net
🔒 Locked

Lock And Flush

Started by Woodchuck Jan 22, 2007 at 4:01 AM 1 replies 500+ views
Original Post
Woodchuck
Woodchuck
Hello, Happy New Year ! The - vertex and index buffer - lock function seems to have a very aggressive GPU flushing behavior. Can you tell me more about that ? Where to place locking operation in a common 3D engine ? Just after the present ? Thank you.
S1CA
S1CA
Flushes due to locking happen when the GPU is still using the resource that you're locking.

However, the exact behaviour is dependent on: the GPU architechture, the device driver, the memory pool your buffer lives in, the creation flags for the buffer, and the flags passed to Lock().

Because of that, "use the most appropriate flags" is MUCH more important than where the lock is done in relation to other D3D calls.


For dynamic vertex and index buffers (really the only thing you should ever need to lock on a regular basis), I'd recommend reading the "What's a good usage pattern for vertex buffers if I'm generating dynamic data?" section of the DirectX FAQ in the SDK documentation or at http://msdn2.microsoft.com/en-us/library/bb219721.aspx
Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site
Woodchuck
Woodchuck
Hi,

Thanks for the reply, it really help me, first to understand locking operations, second to accelerate a bit the locking operations by using the good flag.

I'm now in front of a similar problem. The Unlock method. For the moment, I'm juste using dynamic resources for bounding box I need to draw. Just 8 vertex then. The Unlock method take sometimes 3*10-4 secondes instead of 3*10-6. That is a long time.

Any idea of what happen ? Are the d3d methods really benchable (because maybe of threading causes) ?

EDIT: I'm updating only 22 boxes, and it take 2.2*10-3 secondes. Is this normal ?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.