R300 matrix vs dot product performance in shaders

K.I.L.E.R

Retarded moron
Veteran
A matrix is basically a whole slew of dot products bunched together.
My question is, which is faster?

1) 9 seperatre dot products(using the 'dot' function)
2) Using a temporary 3x3 matrix, storing 3 vectors inside the matrix, multiplying it out by a vector*matrix. Doing this 3 times.

IE:

v1, v2 ... v9;
v otherVector;

1) dot(v1 ... v9, otherVector)

mat3 tmp;

2)
tmp[0] = v1;
tmp[1] = v2;
tmp[2] = v3;

vec results3 = tmp * otherVector;

//store results in array[9]

*Repeat step for all vectors until v9.

The reason I'm asking is if ATI's compiler can batch dot products, so they will be more efficient if done all at once rather than many multiple products.
 
I don't really understand what do you want, but vector by matrix multiplication is computed as series of dot products, so

r = v*mat expands as r.x = dot(v, mat[0]); r.y = dot(v, mat[1]); r.z = dot(v, mat[2])

so I guess it doesn't matter at all what you use(matrices are more elegant, though)
 
Thanks. I just wanted to know if Ati had special place within it's hardware to compute batch dot products (Matrices) faster than numerous conventional dot products.
 
Matrix ops are just a series of dot products. There's no special hardware to deal with matrixes.
 
Back
Top