bubu

Question about dot prod intrinsic

Discussion created by bubu on Jun 16, 2011
Latest reply on Jun 18, 2011 by katayama

Does the "dot" intrinsic take into cosideration the .w component of a float4 register?

 

For example,

 

const float4 a = (float4)(1.0f,2.0f,3.0f,4.0f);

const float4 b = (float4)(1.0f,1.0f,1.0f,1.0f);

what's the result of dot(a,b)? 10 or 6?

 

And what's more efficient?

1. const float k = dot(a,b)

or

2. const float k = a.x*b.x + a.y*b.y + a.z*b.z

 

thx

Outcomes