Skip to main content
gamedev.net
🔒 Locked

Lock texture

Started by Hiyar 1 reply 750+ views
Original Post
Hiyar
Hiyar
Hi, Is there a considerable performance difference, to lock part of the texture or the whole texture? Or is it the same thing?
Rattenhirn
Rattenhirn
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.
Evil Steve
Evil Steve
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.

Topic Locked

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

Sign in to reply to this topic.