[wined3d] pixel shader cross compiler [3] resend

Ivan Gyurdiev ivg2 at cornell.edu
Mon Nov 21 16:08:01 CST 2005


> +typedef FLOAT D3DMATRIX44[4][4];
> +typedef FLOAT D3DMATRIX43[4][3];
> +typedef FLOAT D3DMATRIX34[4][4];
> +typedef FLOAT D3DMATRIX33[4][3];
> +typedef FLOAT D3DMATRIX32[4][2];
>   
Are those matrices bigger than they should be, or is this intentional?

Also, all the matrices that have size(x)!=size(y) seem backwards to be - 
maybe I'm misunderstanding, but I think your x and y indices are 
backwards in functions using m2x3, m3x4 and m4x3, and will segfault (but 
then again, I haven't tried it, so I could be wrong).

Additionally:

+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->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;

Wrong index, second row.

+void pshader_m3x3(WINED3DSHADERVECTOR* d, WINED3DSHADERVECTOR* s0, D3DMATRIX33 mat) {
+    d->x = mat[0][0] * s0->x + mat[0][1] * s0->y + mat[2][2] * s0->z;
+    d->y = mat[1][0] * s0->x + mat[1][1] * s0->y + mat[2][2] * s0->z;
+    d->z = mat[2][0] * s0->x + mat[2][1] * s0->y + mat[2][2] * s0->z;
+    d->w = 1.0f;
+    PSTRACE(("executing m3x3(1): mat=(%f, %f, %f)    s0=(%f)     d=(%f) \n", mat[0][0], mat[0][1], mat[0][2], s0->x, d->x));
+    PSTRACE(("executing m3x3(2): mat=(%f, %f, %f)       (%f)       (%f) \n", mat[1][0], mat[1][1], mat[1][2], s0->y, d->y));
+    PSTRACE(("executing m3x3(3): mat=(%f, %f, %f) X     (%f)  =    (%f) \n", mat[2][0], mat[2][1], mat[2][2], s0->z, d->z));
+    PSTRACE(("executing m3x3(4):                                       (%f) \n", d->w));
+}

Wrong index, second row.

In pshader_lrp... I wouldn't know if the 4th row is a bug or not, but I'm suspicious.













More information about the wine-devel mailing list