Jump to content
  • Advertisement
Sign in to follow this  
Narf the Mouse

SlimDX - Creating a mesh in system memory and then moving it to graphics card memory

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

Advertisement
This is not at all SlimDX-specific so the tag on your question is likely to cause fewer people to read your thread.

That said, just create the initial resources in system memory pool (or the scratch pool if that is appropriate, although it probably isn't). When you are ready, Clone() the mesh, passing flags to place the buffers in the appropriate pool.

Share this post


Link to post
Share on other sites
Quote:
Original post by jpetrie
This is not at all SlimDX-specific so the tag on your question is likely to cause fewer people to read your thread.

That said, just create the initial resources in system memory pool (or the scratch pool if that is appropriate, although it probably isn't). When you are ready, Clone() the mesh, passing flags to place the buffers in the appropriate pool.

Thanks, that makes sense.

Share this post


Link to post
Share on other sites
Do I have to do this with (native) D3D11 as well? If so, will that speed up my rendering or what? Or does this automatically happen when loading the data into the vertexbuffer?

Share this post


Link to post
Share on other sites
If you do not know that you need to do this, you do not need to do this. Don't optimize prematurely, make sure you have profiled your application and determined that you have some kind of resource bottleneck.

This operation, in fact, is not likely to result in faster rendering. It may even result in slower rendering, because you are performing two copies of the data (once during the initial load from disk, and once to get that data on to and formatted for the GPU). The GPU does not access what is in system memory.

Share this post


Link to post
Share on other sites
Also note that creating them in the managed pool will give you that behaviour - you'll have a system memory copy which will be automatically uploaded to the GPU as needed (and removed from GPU memory again to make room for other managed data if need be).

Share this post


Link to post
Share on other sites
Right; I'm doing this because I've gotten (inconsistently) D3D "Out of memory errors" while creating meshes. Possibly from memory that wasn't cleared yet. As said, premature optimization is a negative factor - That is, it actually tends to degrade your code.

(And yes, I will be trying to make sure the memory is cleared properly).

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!