glsl: Replace open-coded dot-product with dot
authorIan Romanick <ian.d.romanick@intel.com>
Mon, 25 Mar 2013 21:40:53 +0000 (14:40 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Fri, 29 Mar 2013 19:01:11 +0000 (12:01 -0700)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Paul Berry <stereotype441@gmail.com>
src/glsl/builtins/glsl/determinant.glsl

index 78751a6dca35f3b1b586c369940a1aac13ba1364..0800d40cff782cfac955e974bad91df4e182511c 100644 (file)
  */
 
 #version 120
+
+// Forward declaration because builtins don't know about other builtins.
+float dot(vec4, vec4);
+
 float determinant(mat2 m)
 {
    return m[0].x * m[1].y - m[1].x * m[0].y;
@@ -63,8 +67,5 @@ float determinant(mat4 m)
    adj_0.z = + (m[1].x * SubFactor01 - m[1].y * SubFactor03 + m[1].w * SubFactor05);
    adj_0.w = - (m[1].x * SubFactor02 - m[1].y * SubFactor04 + m[1].z * SubFactor05);
 
-   return (+ m[0].x * adj_0.x
-           + m[0].y * adj_0.y
-           + m[0].z * adj_0.z
-           + m[0].w * adj_0.w);
+   return dot(m[0], adj_0);
 }