Skip to main content
gamedev.net
🔒 Locked

updatesurface

Started by TechnoCore 0 replies 1.3k views
Original Post
TechnoCore
TechnoCore
Hi im creating a texture dynamically, as a POOL_SYSTEMMEM texture. Im locking it with LockRect(0,▭,0,0); writing some pixels to it and the unlock it. Then i get its surface, and copy this surface with UpdateSurface to a POOL_DEFAULT surface, which i then draw as a sprite. However since i have done this my program slows down every now and then.. like it is waiting maybe.. Is there any special considerations with updateSurface, or lockrect? what flags should the textures/surfaces have ? To me it seems as since the POOL_SYSTEMMEM texture is in systemmem... there should never be anything to wait for there? this is how i create the textures: result=D3DXCreateTexture(m_pd3dDevice, 256, 256, 1, 0, A8R8G8B8, D3DPOOL_SYSTEMMEM, &m_pSysmemTexture); result=D3DXCreateTexture(m_pd3dDevice, 256, 256, 1, 0, A8R8G8B8, D3DPOOL_DEFAULT, &m_pDefaultTexture); Thanks for any help !!
//TechnoCore
cheez_keeper
cheez_keeper
since the texture is in system memory, it is possible that it actually takes longer to copy and change things on it if those things are located on the hardware device. this is especially true if your processor is busy calculating other things (music, AI, input messages) and you will have to wait to get time to do the memory swaps. also, it definitly takes longer to copy it up to the hardware device. i usually keep my scratchbuffers as D3DPOOL_DEFAULT unless they are a scratch buffer to a scaratch buffer (it happens) or if you are running low on vid card resources. also, you may just want to set the resources as D3DPOOL_MANAGED to make it easier on yourself for capturing state changes (ie. ALT-TAB).
Brett Lynnescheez_keeper@hotmail.com

Topic Locked

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

Sign in to reply to this topic.