summaryrefslogtreecommitdiffstats
path: root/src/glsl/builtins
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2013-03-25 14:40:53 -0700
committerIan Romanick <[email protected]>2013-03-29 12:01:11 -0700
commit65cc68f4305a675e27feb7aae0d8a66b2710f3e4 (patch)
treed5f856005f3c02e5b20371c59469a70cba3eff8a /src/glsl/builtins
parentdbf94d105a48b7aafb2c8cf64d8b4392d87efea1 (diff)
glsl: Replace open-coded dot-product with dot
Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Cc: Eric Anholt <[email protected]> Cc: Paul Berry <[email protected]>
Diffstat (limited to 'src/glsl/builtins')
-rw-r--r--src/glsl/builtins/glsl/determinant.glsl9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/glsl/builtins/glsl/determinant.glsl b/src/glsl/builtins/glsl/determinant.glsl
index 78751a6dca3..0800d40cff7 100644
--- a/src/glsl/builtins/glsl/determinant.glsl
+++ b/src/glsl/builtins/glsl/determinant.glsl
@@ -22,6 +22,10 @@
*/
#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);
}