Move implementations of matrix functions into driver/runtime.

Move the implementation of rsExtractFrustumPlanes and
rsIsSphereInFrustum from rs_math.rsh into driver/runtime. The old
implementation remains in place for older versions, and the move
occurs only for API level 24 and up.

Change-Id: I7661e71eb5d344e39fa84e0aa502c621936e68a0
Signed-off-by: Verena Beckham <verena@codeplay.com>
diff --git a/scriptc/rs_matrix.rsh b/scriptc/rs_matrix.rsh
index 9f9cf56..758d17b 100644
--- a/scriptc/rs_matrix.rsh
+++ b/scriptc/rs_matrix.rsh
@@ -64,6 +64,7 @@
  *   near: Near plane.
  *   far: Far plane.
  */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
 static inline void __attribute__((overloadable))
     rsExtractFrustumPlanes(const rs_matrix4x4* viewProj, float4* left, float4* right, float4* top,
                            float4* bottom, float4* near, float4* far) {
@@ -111,6 +112,13 @@
     len = length(far->xyz);
     *far /= len;
 }
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+    rsExtractFrustumPlanes(const rs_matrix4x4* viewProj, float4* left, float4* righ, float4* top,
+                           float4* bottom, float4* near, float4* far);
+#endif
 
 /*
  * rsIsSphereInFrustum: Checks if a sphere is within the frustum planes
@@ -126,7 +134,8 @@
  *   near: Near plane.
  *   far: Far plane.
  */
-static inline bool __attribute__((overloadable))
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+static inline bool __attribute__((always_inline, overloadable))
     rsIsSphereInFrustum(float4* sphere, float4* left, float4* right, float4* top, float4* bottom,
                         float4* near, float4* far) {
     float distToCenter = dot(left->xyz, sphere->xyz) + left->w;
@@ -155,6 +164,13 @@
     }
     return true;
 }
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern bool __attribute__((overloadable))
+    rsIsSphereInFrustum(float4* sphere, float4* left, float4* right, float4* top, float4* bottom,
+                        float4* near, float4* far);
+#endif
 
 /*
  * rsMatrixGet: Get one element