[SlimDX] Regression in BaseEffect.SetValue?

Started by
1 comment, last by bakery2k1 15 years, 4 months ago
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);
Advertisement
It seems like our choice to unify the functionality of SetValue has met with nothing but trouble so far. I had expected that the generic SetValue exposed by Direct3D would work for all inputs, but apparently not.

Seeing as how SetValue for arrays is already checking the type underneath, I may as well do that for single parameter SetValue as well. Also, your use of vectors as matrix rows made me think to add some construction methods to Matrix to build matrices from vectors.

If you would be so kind as to file an issue on our issues page, I'll be sure to get a look at it soon.
Mike Popoloski | Journal | SlimDX
Quote:Original post by Mike.Popoloski
If you would be so kind as to file an issue on our issues page, I'll be sure to get a look at it soon.


Done (#382).

Quote:
Also, your use of vectors as matrix rows made me think to add some construction methods to Matrix to build matrices from vectors.


I've also added an issue for this (#383), including a suggestion to add methods for the reverse (Matrix => Vector) conversion as well.

Thanks very much for your help; keep up the good work!

This topic is closed to new replies.

Advertisement