• Advertisement
Sign in to follow this  

IDirect3DTexture9::LockRect

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

Greetings. I would like to know is there a possibility to lock texture and change it in given rectangle bounds. I know I can lock whole texture with D3DLOCK_DISCARD flag but I would like to lock only a part of the texture. Unfortunately I can't lock only a part of the texture with D3DLOCK_DISCARD flag - that says MSDN. I've tested it and it works on ATI cards anyway;) but doesn't work on nVidia. So.. how to do it? How to lock only a part of the texture specified by pRect and change it? From what I've observed locking a part of the texture is faster than the whole so it would be nice to handle that. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Just don't pass the D3DLOCK_DISCARD flag to it. That flag is a hint to the driver that you're chucking out the entire texture, so it can do some optimisations internally. The ATI driver is probably ignoring the flag completely, although I suspect the debug runtimes (Which you should be using) will spew out some error and cause the call to fail.

Share this post


Link to post
Share on other sites
Pass 0 for flags.

Also, you should note that not discarding the whole texture is often slower than discarding everything and completely rewriting it. It's mainly as issue of the driver having to (maybe) do a readback and (almost certainly) having to unswizzle the data to make it useful to the programmer.

Share this post


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

  • Advertisement