Jump to content
  • Advertisement
Sign in to follow this  

Geometry loading?

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

Hi! I have made a memorypool mechanism with vertex buffers. It works ok so far. But I have a couple of questions: In my memorypool I have one static VertexBuffer for EACH type of vertex: Eg. //Standard textured object Position, Normal, TextureCoord1 //Standart textured objec with bumpmap Position, Normal, TextureCoord1, BumpTextureCoord1 //This one is used for additional data, like an additional //texture or a specular map TextureCoordX etc... for all types of stream setup So far I'm trying to have statistics on how much each of the Buffers are used, and if my VRAM ends for some more important needs I destroy the least used Buffer and recreate a smaller one of the same type - which will free some space. Oh... and the memorypool which contains these Buffers, acts like a cache. And is used like this:
IShader shader = some_shader;
if(!mempool.IsCached(geometry)) {   
   int size = geometry.VertexCount;

   //streams contain data about what type of streams are needed
   //Position, Normal, etc...
   memslot = mempool.RequestMemory(size, streams);
   //Upload the data to the memslot

Well, anyway... I was hoping if someone else could give me some insight on how to handle the Buffers? I'm afraid that I will be having a lot of VertexBuffers eating my VRAM while still only beeing used sparsly. Thats why I have the delete option... But I'm afraid that it will be very expensive to recreate a buffer and fill it with the vertices again. And another thing I'm confused about is what to do with the vertices once they are uploaded to the cache. Now I just happily delete them :) But the problem arrives when I need to refill the cache with some geometry. I then need to basically recreate the whole geometry. Or I could just store them in RAM... but that will end eventually as well. So do I need some caching mechanism there to? Where I spatially anticipate which geometry might be comming on screen soon and ask another Thread to load that geometry from disk and put it in the RAM cache? I find it hard to really describe my problems here, but would really like to hear how you guys solved this? Thx !

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!