[wined3d] shaders matrix sizes lrp

Ivan Gyurdiev ivg2 at cornell.edu
Wed Nov 23 07:37:08 CST 2005


Oliver Stieber wrote:
> Hi,    
>    This patch fixes the allocation size of some matrix, matrix multiplication
> errors and and error in lrp for software shaders.
>   
That seems fine, but... what I don't understand is:

+typedef FLOAT D3DMATRIX34[3][4];

Dimension 1 is of size 3, Dimension 2 is of size 4

 void pshader_m3x4(WINED3DSHADERVECTOR* d, WINED3DSHADERVECTOR* s0, 
D3DMATRIX34 mat) {
     d->x = mat[0][0] * s0->x + mat[0][1] * s0->y + mat[0][2] * s0->z;
-    d->y = mat[2][0] * s0->x + mat[1][1] * s0->y + mat[1][2] * s0->z;
+    d->y = mat[1][0] * s0->x + mat[1][1] * s0->y + mat[1][2] * s0->z;
     d->z = mat[2][0] * s0->x + mat[2][1] * s0->y + mat[2][2] * s0->z;
     d->w = mat[3][0] * s0->x + mat[3][1] * s0->y + mat[3][2] * s0->z;

...and here you're writing to a matrix that has 4 rows and 3 columns... 
(as opposed to 3 rows and 4 columns).

It's the same for 3x2, 3x4, and 4x3.
============

Another comment: What's s3 in lrp, and why isn't it used?



More information about the wine-devel mailing list