• Advertisement
Sign in to follow this  

Large texture LockRect performance

This topic is 3905 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:
D3DLOCKED_RECT lr_a;
g_proto_textures[obj]->LockRect(0, &lr_a, NULL, NULL);
DWORD *new_pixel = static_cast<DWORD*>(lr_a.pBits);
new_pixel[pixel_offset]=0xffff0000;
g_proto_textures[obj]->UnlockRect(0);

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

Share this post


Link to post
Share on other sites
Advertisement
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