   [DX9] Mixing DEFAULT and MANAGED pools.
  Hi,I have a question about the usage of the Direct3D memory pools. Until now, I have used Managed pools for every resource possible, vertices, indices and textures. But recently, I wanted to implement an algorithm on my terrain mesh, which will require reading terrain data(vertex heights, i.e. the y coordinates.) Now I am not sure what to do. Managed resources have a copy in the GPU and one in the system memory, so if I create a graphics system independent copy of terrain data, just for my own usage, there will be three copies of the same data on the system, which I think is very inefficient. Another option is to lock the Managed vertex buffer for reading the needed data, but I am not sure how this will affect the rendering performance. As far as I know, managed resources lock the system memory copy without interrupting the GPU but after unlocking, the system will try to update the copy in the device memory, so this will be another performance hit. Maybe some intelligent use of Lock flags can be useful, like D3DLOCK_NO_DIRTY_UPDATE and D3DLOCK_READONLY. The last option is to create the huge terrain vertex buffer in Default memory pool. I will never modify, read or write, the copy in the device memory and use the second copy in the system memory for my algorithm. But I am not sure how the managed pool resources and the default pool resources get along. For example, will the default pool resources be evicted, if there is not enough device memory for newly created managed ones or will it be guaranteed to stay in the device at the expense of managed resources? Which path should I take in this situation?Thanks in advance.[Edited by - 67rtyus on April 10, 2010 10:55:52 AM]
  Regarding managed memory use, it depends on how you're limited. It'd take some address space, but if you don't lock it it will not require real memory, and will be only on the swap file if the memory is needed for something else.Default pool resource will not be evicted. It's for you to control. If your terrain mesh is in one vertex buffer, then this doesn't matter much, since if it's evicted when in the managed pool then you're in trouble anyway. So the main difference is that managed will be recreated automatically when the device is lost.Regardless of in which pool you store the terrain, I think it's a good idea to keep the heights in CPU memory under your control. That's because you can keep them in the format and organisation that's convenient for you, which is not necessarily the same as for the GPU.   