Archived

This topic is now archived and is closed to further replies.

RuneLancer

Locking Surfaces

Recommended Posts

What''s the difference between locking a surface in read only, write only, and both (other than the obvious)? Is there any speed gain when working with the surface or is it just to allow for something such as... if(frame == 1) { lock surface in read only; frame = 2; } else { lock surface in write only; frame = 1; } Read some stuff from the surface and calculate stuff, for instance smooth out the surface. Write the results to the surface. Well, not the best of examples, but you get the idea: do some reading the first time, write the second, all with the same code. Wouldn''t that be inefficient anyways? So is it just a "just in case" thing or a way to make sure the programmer doesn''t screw up when writing to the surface accidently when he or she should be reading from it, or is there any performance gain when reading/writing to a respectively locked surface?

Share this post


Link to post
Share on other sites