I am learning directx. It provides a huge amount of freedom in how to do things, but presumably different stategies perform differently and it provides little guidance as to what well performing usage patterns might be.

When using directx is it typical to have to swap in a bunch of new data multiple times on each render?

The most obvious, and probably really inefficient, way to use it would be like this.

Stragety 1

On every single render

  1. Load everything for model 0 (textures included) and render it (IASetVertexBuffers, VSSetShader, PSSetShader, PSSetShaderResources, PSSetConstantBuffers, VSSetConstantBuffers, Draw)

  2. Load everything for model 1 (textures included) and render it (IASetVertexBuffers, VSSetShader, PSSetShader, PSSetShaderResources, PSSetConstantBuffers, VSSetConstantBuffers, Draw)

  3. etc...

I am guessing you can make this more efficient partly if the biggest things to load are given dedicated slots, e.g. if the texture for model 0 is really complicated, don't reload it on each step, just load it into slot 1 and leave it there. Of course since I'm not sure how many registers there are certain to be of each type in DX11 this is complicated (can anyone point to docuemntation on that?)

Stragety 2

Choose some texture slots for loading and others for perpetual storage of your most complex textures.

Once only

Load most complicated models, shaders and textures into slots dedicated for perpetual storage

On every single render

  1. Load everything not already present for model 0 using slots you set aside for loading and render it (IASetVertexBuffers, VSSetShader, PSSetShader, PSSetShaderResources, PSSetConstantBuffers, VSSetConstantBuffers, Draw)

  2. Load everything not already present for model 1 using slots you set aside for loading and re

Edit
Report