Skip to main content
gamedev.net
🔒 Locked

Modifying textures

Started by marshdabeachy Feb 26, 2007 at 6:25 PM 0 replies 400+ views
Original Post
marshdabeachy
marshdabeachy
I've got a large texture, and I want to modify a small part of it (the individual pixel data) in realtime. LockRect is too slow. Is there a good way to do this?
Namethatnobodyelsetook
Namethatnobodyelsetook
You may want to look into IDirect3DDevice9::UpdateSurface. It will copy a (part of a) sysmem surface into a pool default surface. The docs don't really describe how it works, so it may be no better, somewhat better, or it may be ideal.

If it copies the texture data into the GPU command stream it will cause no stalls. The sysmem texture will be free to lock again, and the GPU texture will be updated at the appropriate time.

It may insert a sort of copy command into the GPU stream, and keep the sysmem texture marked as in use until the data is copied. This would only stall if you attempted to lock and update the sysmem texture before the copy was actually performed. For occasional surface updates, this is fine. For constant updates, you might need to keep several sysmem textures around to use as sources for UpdateSurface.

On the other hand, it might stall just like lockrect would if the GPU surface is in use in the command queue.

Topic Locked

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

Sign in to reply to this topic.