sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.69k stars 641 forks source link

EffectMatrixVariable Can't send a Matrix3x3[] to my shader #984

Open SharinganShuriken opened 6 years ago

SharinganShuriken commented 6 years ago

Hello,

like the title say, i want to send my matrix3x3 array to my shader but everytime i get an exception: "ivalid matrix size: Must be 64 bytes, 16 float"

If i understand this right, he wants always a matrix4x4.

Is this a bug or do i make samething wrong?

Heres my code: ` List list = new List(); list.Add(Matrix3x3.Identity); list.Add(Matrix3x3.Identity); list.Add(Matrix3x3.Identity);

        EffectMatrixVariable effectMatrixVariable = this.effect.GetVariableByName(name).AsMatrix();
        effectMatrixVariable.SetMatrix<Matrix3x3>(list.ToArray());`

Greets Benjamin

h1cks commented 6 years ago

These sort of questions are probably best posed on Gamedev.stackexchange.com or gamedev.net.

From what I can see in your code, you're actually setting the matrix with an array of 3x3 identity matrices. Suggestion, test firstly

effectMatrixVariable.SetMatrix(Matrix.Identity);

I believe what you probably need to do is

effectMatrixVariable.SetMatrix(list[0]);`