Jump to content
  • Advertisement
Sign in to follow this  

Large texture LockRect performance

This topic is 4147 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

I noticed that when I try to lock and write pixels to a texture it is quite fast so long as it's 1024x1024 or less. If it's 2048x2048 or larger, the performance is suddenly terrible. Could it be card or driver related? I'm wondering if there's a faster way to update a texture bigger than 1024x1024? Here's what I'm doing right now:
g_proto_textures[obj]->LockRect(0, &lr_a, NULL, NULL);
DWORD *new_pixel = static_cast<DWORD*>(lr_a.pBits);

Any advice or ideas about this are totally welcome. :)

Share this post

Link to post
Share on other sites
a 2048 x 2048 texture needs 4 times the ram of a 1024 x 1024 and therefore should approximately 1/4 the speed. How much of a speed drop are you seeing?

If it's worse than 1/4 then using four 1024 x 1024 textures is an obvious solution.

The best bet is not to lock it at all. If you only need write access then making the texture as a render target and drawing primitives on it should be several times quicker than locking it.

If you can't do that you might want to try using IDirect3DDevice9::UpdateSurface() instead of locking it.

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!