Jump to content
  • Advertisement
Sign in to follow this  
vajuras

DirectX and Batching Primitives

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

I have this city scene where I have 28 materials. What I used to do was call D3DXMesh->DrawSubset(n) for all 28 materials. This mesh buffer has an attribute, index, & vertex buffer of course. Anyway, last night I get this bright idea to do my own batching. I assumed I'd get much better performance. Problem is- there's nothing to really batch in my scene atm because the mesh data is spread across 28 materials (textures). So thats 28 different primitives thats not taking advantage of DIP I guess. Sizes of each DIP vary anywhere from like 300 vertices to thousands. My coworker recommends I look into texture Atlas to merge all my materials to batch together primitives which sounds good. But I wonder- why is D3DXMesh->DrawSubset() so fast then? Was it because everything was in 1 vertex/index/attribute buffer- not spread out across 28 materials. I 'assumed' they were doing the samething I was doing, calling SetStreamSource, SetIndexBuffer, SetVertexBuffer, and DrawIndexedPrimitive (DIP) using traingle lists. I can post my source code later but as you imagine nothing really wrong with it. But my FPS has took a serious dive. I am baffled how D3DXMesh->DRawSubset() could achieve so much better performance. I am hoping I just need to reboot my computer and run the city scene again but I'm fairly certain thats not it heh.

Share this post


Link to post
Share on other sites
Advertisement
It was probably fast because you were rendering only a few vertices. How many triangles are you rendering per frame?

Dave

Share this post


Link to post
Share on other sites
66,000 triangles is getting fired off to the video card every frame. These triangles are now divided across 28 materials now though. So now I have 28 different vertex/index buffers

Share this post


Link to post
Share on other sites
sorry it was my mistake. Using my own DIP(s) I get good performance now figured it out as soon as I got home. Was stressed out over nothing but oh well at least I learned something new talking to my friend about this

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!