Jump to content
  • Advertisement
Sign in to follow this  
Hiyar

Lock texture

This topic is 3425 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Is there a considerable performance difference, to lock part of the texture or the whole texture? Or is it the same thing?

Share this post


Link to post
Share on other sites
Advertisement
That depends on a lot of things, mostly size of the texture vs. size of the rectangle you'd lock.

There should be no disadvantages if you only lock only as much as you need, so always do that.

Share this post


Link to post
Share on other sites
Depends on the driver.

What's most likely is that if you have a 256x256 texture, and you lock the top left 64x64 portion, you'll get given back a locked rect with a pitch of 256 pixels (I.e. the driver will give you back a pointer to the full texture rather than copying a region to a temporary buffer), but when you unlock that texture, the driver will only copy 64 pixels from each scanline.

So short answer is that yes, it's likely that locking only the region you need is faster, but it ultimately depends on the driver.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!