I have a question about how to optimally draw things in light of how the video driver works. I had a quick poke around and found a few conflicting examples (most are suited to cases where scalability is not a denominating issue) so figured this would be a good place for a definitive answer.
In our game we are using lots of models in the same scene which have large texture files and high poly meshes - enough to fill the texture memory of most cards. Should we draw them like this:
Method A:
Begin()
BeginPass(1)
RenderModelA_TextureA
RenderModelA_TextureB
RenderModelB_TextureA
RenderModelB_TextureB
BeginPass(2)
RenderModelA_TextureA
RenderModelA_TextureB
RenderModelB_TextureA
RenderModelB_TextureB
End()
or Method B:
Begin()
BeginPass(1)
RenderModelA_TextureA
BeginPass(2)
RenderModelA_TextureA
BeginPass(1)
RenderModelA_TextureB
BeginPass(2)
RenderModelA_TextureB
BeginPass(1)
RenderModelB_TextureA
BeginPass(2)
RenderModelB_TextureA
BeginPass(1)
RenderModelB_TextureB
BeginPass(2)
RenderModelB_TextureB
End()
My current feeling is that Method B will be best since seems cheaper to change a pointer in the shaders than it is to hit a cache limit and end up sending another 2048x2048x32x5 texture set to the card. However the other argument is that once it is in memory, we cannot really code for the caching policy and at by changing the texture set we are just effectively swapping pointers and there is no large data transfer going on - this suggests we should avoid the render state switches instead.
Looking forward to hearing what your answers are!
Best,
John