You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
float4x3 in HLSL is row-major while MSL layouts are column-major. This is all expected. HLSL compilers to SPIR-V will implicitly transpose and reverse multiplication orders to make this work.
For instance, an identity matrix ends up in MSL as:
Are you sure? How did you generate that identity matrix?
Hello. Thank you for your reply ! I am aware of the row/column layout difference between the languages. But in this case, I was wondering if there wasn't a bug because the matrix is not squared. In my case, the identity data came from an array like this {1,0,0,0, 0,1,0,0, 0,0,1,0}. would that be possible (and because we are going from 4x3 to a 3x4) that the data gets offsetted ?
It depends. If it's an inline array in the shader it's the shader compiler's job to deal with it. You'll have to provide the input HLSL, output SPIR-V and output MSL.
the following matrix in HLSL:
Gets translated to MSL as:
Although the matrix dimensions are correct, the data does not seem to be copied correctly. For instance, an identity matrix ends up in MSL as:
It looks like we are properly generating a float3x4 matrix but with column-major data layout.
The text was updated successfully, but these errors were encountered: