Direct3D 11 upgrades

In the Direct3D 11 upgrade, we did not have to change a lot. The main change is related to the fact we receive a set of render passes from the main application, and need to change the rendertargets, shaders and state per pass.

One of the more subtle but fairly substantial differences is related to the addition of model matrices. As you might know we skipped adding model matrices initially, but for this more complicated example model matrices have been added as well.

The method of implementation is as follows:

  • Every frame, a buffer is filled with model matrices for all models
  • For every mesh, we determine a batch index
  • Based on this batch index, we map a subsection of the constant buffer
  • We update another buffer with the current batch index
  • We now allow the vertex shader to get the model matrix to obtain the desired matrix based on the batch index

This could have been made more simple by uploading the matrices in every drawcall rather than the index, but this system is mostly made to be similar to the system in Direct3D 12, where the uploading data is a little less simple.