title: Why is this Transpose() required in my WorldViewProj matrix?
body: <p>Given a super-basic vertex shader such as:</p>
  
  <pre><code>output.position = mul(position, _gWorldViewProj);
  </code></pre>
  
  <p>I was having a great deal of trouble because I was setting _gWorldViewProj as follows; I tried both (a bit of flailing) to make sure it wasn't just backwards.</p>
  
  <pre><code>mWorldViewProj = world * view * proj;
  mWorldViewProj = proj * view * world;
  </code></pre>
  
  <p>My solution turned out to be:</p>
  
  <pre><code>mWorldView = mWorld * mView;
  mWorldViewProj = XMMatrixTranspose(worldView * proj);
  </code></pre>
  
  <p>Can someone explain why this XMMatrixTranspose was required?  I know there were matrix differences between XNA and HLSL (I think) but not between vanilla C++ and HLSL, though I could be wrong.</p>
  
  <p>Problem is I don't know if I'm wrong or what I'm wrong about!  So if someone could tell me precisely why the transpose is required, I hopefully won't make the same mistake again.</p>