Chapter 4, Page 65 – HLSL mul()
In the discussion concerning the HLSL mul() function I state that the row-major/column-major format of the matrix is dependent upon the order of the arguments. That is incorrect. As stated in the text, if the first argument to mul() is a vector, it’s treated as a row vector. Conversely, if the second argument is a vector, it’s treated as a column vector. However, this has no impact on the format of the matrix used as the opposite function argument.
The row-major/column-major format of a matrix is determined by the (optional) modifier for the matrix/float4x4 variable declaration. For example, in the HLSL declaration:
WorldViewProjection is treated as a column-major matrix. To make this a row-major matrix, use the “row_major” modifier during the declaration. For example:
row_major float4x4 WorldViewProjection;
There is also a “column_major” modifier, but that’s the default format and need not be explicitly specified. The format of the matrix has implications for how you store and transmit the data from your CPU-side application. The DirectXMath library stores matrices in row-major order (which is also the format of multidimensional arrays in C). Thus, you must transpose the matrix, before you send it to the GPU, if you’re using column-major matrices within your shader.
Chapter 12, Page 246 – FpsComponent, Utility.h, and Shlwapi
In Listing 12.10, the Utility.h header is included within the FpsComponent class implementation. This header is only briefly mentioned in the paragraph after the listing, and that you can find the file on the companion website. What’s not mentioned is that the Utility.h file requires that you link in Shlwapi.lib. That library is located under the Windows SDK library path.
Have you found incorrect information in the book? In the comments field below, please tell me the page number, location of the error on the page, and a description of the error. Thank you!