I'm updating a DX9 project of mine which was originally built against the November 2007 version of SlimDX to use the latest (November 2008) release. I was pleased with how straightforward it was to obtain a successful build, however once that was achieved the graphics displayed were clearly incorrect.
My code uses a "float3x3" variable in an effect and sets its value by calling BaseEffect.SetValue, passing in an instance of Matrix. With the older SlimDX, the variable in the effect received the upper-left 3x3 section of the matrix. Using the latest SlimDX, the variable in the effect is different.
I believe this stems from svn revision 686, where the function called on the underlying pointer when passing a Matrix to BaseEffect::SetValue changed from ID3DXBaseEffect::SetMatrix to ID3DXBaseEffect::SetValue.
Are these new semantics a bug in SlimDX, or by design? Should I be able to set a float3x3 by passing a Matrix, or should I replace this
effect.SetValue("matrix", matrix);
with something like this?
Vector3[] matrixRows =
{
new Vector3(matrix.M11, matrix.M12, matrix.M13),
new Vector3(matrix.M21, matrix.M22, matrix.M23),
new Vector3(matrix.M31, matrix.M32, matrix.M33)
};
effect.SetValue("matrix", matrixRows);