am 97b4abf2: Merge "Adjust bit rate based on resolution" into jb-mr2-dev
* commit '97b4abf2f0521a72db7b01de3a88d43be249d611':
Adjust bit rate based on resolution
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java
index da1ee88..4909497 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java
@@ -155,6 +155,12 @@
@Override
public void pass() {
log("OK!\n", Color.GREEN);
+ try {
+ Thread.sleep(2000);
+ log("(Sleep 2 second) \n", Color.GREEN);
+ } catch (InterruptedException e) {
+ fail("unexpected InterruptedException when sleep");
+ }
mLocationVerifier = null;
nextTest();
}
diff --git a/tests/core/ctscore.mk b/tests/core/ctscore.mk
index 1e4e017..95f4634 100644
--- a/tests/core/ctscore.mk
+++ b/tests/core/ctscore.mk
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle
+LOCAL_JAVA_LIBRARIES := android.test.runner bouncycastle conscrypt
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_DEX_PREOPT := false
diff --git a/tests/src/android/renderscript/cts/acos_f32.rs b/tests/src/android/renderscript/cts/acos_f32.rs
new file mode 100644
index 0000000..8e46d0a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acos_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = acos(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acos_f32_2.rs b/tests/src/android/renderscript/cts/acos_f32_2.rs
new file mode 100644
index 0000000..43fe3ee
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acos_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = acos(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acos_f32_3.rs b/tests/src/android/renderscript/cts/acos_f32_3.rs
new file mode 100644
index 0000000..a29a2f1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acos_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = acos(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acos_f32_4.rs b/tests/src/android/renderscript/cts/acos_f32_4.rs
new file mode 100644
index 0000000..331bd72
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acos_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in , float4* out) {
+ *out = acos(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acosh_f32.rs b/tests/src/android/renderscript/cts/acosh_f32.rs
new file mode 100644
index 0000000..86ff46f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acosh_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = acosh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acosh_f32_2.rs b/tests/src/android/renderscript/cts/acosh_f32_2.rs
new file mode 100644
index 0000000..7a0678b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acosh_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = acosh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acosh_f32_3.rs b/tests/src/android/renderscript/cts/acosh_f32_3.rs
new file mode 100644
index 0000000..cd88c2d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acosh_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = acosh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acosh_f32_4.rs b/tests/src/android/renderscript/cts/acosh_f32_4.rs
new file mode 100644
index 0000000..7965df2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acosh_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in , float4* out) {
+ *out = acosh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acospi_f32.rs b/tests/src/android/renderscript/cts/acospi_f32.rs
new file mode 100644
index 0000000..5cffe48
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acospi_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = acospi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acospi_f32_2.rs b/tests/src/android/renderscript/cts/acospi_f32_2.rs
new file mode 100644
index 0000000..138766f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acospi_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = acospi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acospi_f32_3.rs b/tests/src/android/renderscript/cts/acospi_f32_3.rs
new file mode 100644
index 0000000..db5f7fb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acospi_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = acospi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/acospi_f32_4.rs b/tests/src/android/renderscript/cts/acospi_f32_4.rs
new file mode 100644
index 0000000..bbbda16
--- /dev/null
+++ b/tests/src/android/renderscript/cts/acospi_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = acospi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/allocationCopy2DRange.rs b/tests/src/android/renderscript/cts/allocationCopy2DRange.rs
new file mode 100644
index 0000000..79aa552
--- /dev/null
+++ b/tests/src/android/renderscript/cts/allocationCopy2DRange.rs
@@ -0,0 +1,14 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+uint32_t width;
+uint32_t height;
+
+rs_allocation mIn;
+rs_allocation mOut;
+
+void testAllocationCopy2DRange() {
+ rsAllocationCopy2DRange(mOut, 0, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X,
+ width, height, mIn, 0, 0, 0,
+ RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X);
+}
diff --git a/tests/src/android/renderscript/cts/allocation_resize.rs b/tests/src/android/renderscript/cts/allocation_resize.rs
new file mode 100644
index 0000000..0c85d9d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/allocation_resize.rs
@@ -0,0 +1,7 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+
+void root(const int *in, int *out) {
+ *out = *in;
+}
diff --git a/tests/src/android/renderscript/cts/asin_f32.rs b/tests/src/android/renderscript/cts/asin_f32.rs
new file mode 100644
index 0000000..eea1d6e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asin_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = asin(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asin_f32_2.rs b/tests/src/android/renderscript/cts/asin_f32_2.rs
new file mode 100644
index 0000000..c9f632a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asin_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = asin(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asin_f32_3.rs b/tests/src/android/renderscript/cts/asin_f32_3.rs
new file mode 100644
index 0000000..6b6f34d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asin_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = asin(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asin_f32_4.rs b/tests/src/android/renderscript/cts/asin_f32_4.rs
new file mode 100644
index 0000000..5c22e49
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asin_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in , float4* out) {
+ *out = asin (*in) ;
+}
diff --git a/tests/src/android/renderscript/cts/asinh_f32.rs b/tests/src/android/renderscript/cts/asinh_f32.rs
new file mode 100644
index 0000000..2d72492
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asinh_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = asinh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asinh_f32_2.rs b/tests/src/android/renderscript/cts/asinh_f32_2.rs
new file mode 100644
index 0000000..d0f7a32
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asinh_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = asinh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asinh_f32_3.rs b/tests/src/android/renderscript/cts/asinh_f32_3.rs
new file mode 100644
index 0000000..9bff654
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asinh_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = asinh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asinh_f32_4.rs b/tests/src/android/renderscript/cts/asinh_f32_4.rs
new file mode 100644
index 0000000..a43458d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asinh_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = asinh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asinpi_f32.rs b/tests/src/android/renderscript/cts/asinpi_f32.rs
new file mode 100644
index 0000000..69ad081
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asinpi_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = asinpi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asinpi_f32_2.rs b/tests/src/android/renderscript/cts/asinpi_f32_2.rs
new file mode 100644
index 0000000..f679019
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asinpi_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = asinpi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asinpi_f32_3.rs b/tests/src/android/renderscript/cts/asinpi_f32_3.rs
new file mode 100644
index 0000000..1ad08ce
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asinpi_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = asinpi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/asinpi_f32_4.rs b/tests/src/android/renderscript/cts/asinpi_f32_4.rs
new file mode 100644
index 0000000..cf9978a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/asinpi_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = asinpi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atan2_f32.rs b/tests/src/android/renderscript/cts/atan2_f32.rs
new file mode 100644
index 0000000..eda410f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan2_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct atan2_f32_in {
+ float first;
+ float second;
+} input;
+
+void root(const input* in, float* out){
+ *out = atan2(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/atan2_f32_2.rs b/tests/src/android/renderscript/cts/atan2_f32_2.rs
new file mode 100644
index 0000000..9bb495b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan2_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct atan2_f32_2_in {
+ float2 first;
+ float2 second;
+} input;
+
+void root(const input* in, float2* out){
+ *out = atan2(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/atan2_f32_3.rs b/tests/src/android/renderscript/cts/atan2_f32_3.rs
new file mode 100644
index 0000000..713e823
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan2_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct atan2_f32_3_in {
+ float3 first;
+ float3 second;
+} input;
+
+void root(const input* in, float3* out){
+ *out = atan2(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/atan2_f32_4.rs b/tests/src/android/renderscript/cts/atan2_f32_4.rs
new file mode 100644
index 0000000..cd4690c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan2_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct atan2_f32_4_in {
+ float4 first;
+ float4 second;
+} input;
+
+void root(const input* in, float4* out){
+ *out = atan2(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/atan2pi_f32.rs b/tests/src/android/renderscript/cts/atan2pi_f32.rs
new file mode 100644
index 0000000..2743e57
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan2pi_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct atan2pi_float_input {
+ float x;
+ float y;
+};
+
+void root (const struct atan2pi_float_input* in, float* out) {
+ *out = atan2pi(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/atan2pi_f32_2.rs b/tests/src/android/renderscript/cts/atan2pi_f32_2.rs
new file mode 100644
index 0000000..73db6d1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan2pi_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct atan2pi_float2_input {
+ float2 x;
+ float2 y;
+};
+
+void root (const struct atan2pi_float2_input* in, float2* out) {
+ *out = atan2pi(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/atan2pi_f32_3.rs b/tests/src/android/renderscript/cts/atan2pi_f32_3.rs
new file mode 100644
index 0000000..2b060bb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan2pi_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct atan2pi_float3_input {
+ float3 x;
+ float3 y;
+};
+
+void root (const struct atan2pi_float3_input* in, float3* out) {
+ *out = atan2pi(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/atan2pi_f32_4.rs b/tests/src/android/renderscript/cts/atan2pi_f32_4.rs
new file mode 100644
index 0000000..9e7e125
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan2pi_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct atan2pi_float4_input {
+ float4 x;
+ float4 y;
+};
+
+void root (const struct atan2pi_float4_input* in, float4* out) {
+ *out = atan2pi(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/atan_f32.rs b/tests/src/android/renderscript/cts/atan_f32.rs
new file mode 100644
index 0000000..c5050c8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = atan(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atan_f32_2.rs b/tests/src/android/renderscript/cts/atan_f32_2.rs
new file mode 100644
index 0000000..4fc7e26
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = atan(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atan_f32_3.rs b/tests/src/android/renderscript/cts/atan_f32_3.rs
new file mode 100644
index 0000000..1e49e86
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = atan(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atan_f32_4.rs b/tests/src/android/renderscript/cts/atan_f32_4.rs
new file mode 100644
index 0000000..d808a83
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atan_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out =atan(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atanh_f32.rs b/tests/src/android/renderscript/cts/atanh_f32.rs
new file mode 100644
index 0000000..65c53a6
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atanh_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = atanh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atanh_f32_2.rs b/tests/src/android/renderscript/cts/atanh_f32_2.rs
new file mode 100644
index 0000000..387b464
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atanh_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = atanh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atanh_f32_3.rs b/tests/src/android/renderscript/cts/atanh_f32_3.rs
new file mode 100644
index 0000000..3d35057
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atanh_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = atanh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atanh_f32_4.rs b/tests/src/android/renderscript/cts/atanh_f32_4.rs
new file mode 100644
index 0000000..6ae342e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atanh_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = atanh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atanpi_f32.rs b/tests/src/android/renderscript/cts/atanpi_f32.rs
new file mode 100644
index 0000000..4a79b36
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atanpi_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = atanpi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atanpi_f32_2.rs b/tests/src/android/renderscript/cts/atanpi_f32_2.rs
new file mode 100644
index 0000000..0a9226c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atanpi_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = atanpi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atanpi_f32_3.rs b/tests/src/android/renderscript/cts/atanpi_f32_3.rs
new file mode 100644
index 0000000..8d96d22
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atanpi_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = atanpi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/atanpi_f32_4.rs b/tests/src/android/renderscript/cts/atanpi_f32_4.rs
new file mode 100644
index 0000000..c1e4e87
--- /dev/null
+++ b/tests/src/android/renderscript/cts/atanpi_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = atanpi(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cbrt_f32.rs b/tests/src/android/renderscript/cts/cbrt_f32.rs
new file mode 100644
index 0000000..e175286
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cbrt_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = cbrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cbrt_f32_2.rs b/tests/src/android/renderscript/cts/cbrt_f32_2.rs
new file mode 100644
index 0000000..6f9f303
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cbrt_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float2 *in, float2 *out) {
+ *out = cbrt(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/cbrt_f32_3.rs b/tests/src/android/renderscript/cts/cbrt_f32_3.rs
new file mode 100644
index 0000000..1472fb3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cbrt_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3 *in, float3 *out) {
+ *out = cbrt(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/cbrt_f32_4.rs b/tests/src/android/renderscript/cts/cbrt_f32_4.rs
new file mode 100644
index 0000000..b07c681
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cbrt_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4 *in, float4 *out) {
+ *out = cbrt(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/ceil_f32.rs b/tests/src/android/renderscript/cts/ceil_f32.rs
new file mode 100644
index 0000000..2aac482
--- /dev/null
+++ b/tests/src/android/renderscript/cts/ceil_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = ceil(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/ceil_f32_2.rs b/tests/src/android/renderscript/cts/ceil_f32_2.rs
new file mode 100644
index 0000000..e05e5aa
--- /dev/null
+++ b/tests/src/android/renderscript/cts/ceil_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float2 *in, float2 *out) {
+ *out = ceil(*in);
+}
diff --git a/tests/src/android/renderscript/cts/ceil_f32_3.rs b/tests/src/android/renderscript/cts/ceil_f32_3.rs
new file mode 100644
index 0000000..397a921
--- /dev/null
+++ b/tests/src/android/renderscript/cts/ceil_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3 *in, float3 *out) {
+ *out = ceil(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/ceil_f32_4.rs b/tests/src/android/renderscript/cts/ceil_f32_4.rs
new file mode 100644
index 0000000..41cad2b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/ceil_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4 *in, float4 *out) {
+ *out = ceil(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/clear_object_allocation.rs b/tests/src/android/renderscript/cts/clear_object_allocation.rs
new file mode 100644
index 0000000..7bfe64d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/clear_object_allocation.rs
@@ -0,0 +1,10 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation allocation;
+
+void root( int *out)
+{
+ rsClearObject( &allocation );
+ *out = ( NULL == allocation.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/clear_object_element.rs b/tests/src/android/renderscript/cts/clear_object_element.rs
new file mode 100644
index 0000000..abf3f89
--- /dev/null
+++ b/tests/src/android/renderscript/cts/clear_object_element.rs
@@ -0,0 +1,10 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_element element;
+
+void root( int *out)
+{
+ rsClearObject( &element );
+ *out = ( NULL == element.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/clear_object_mesh.rs b/tests/src/android/renderscript/cts/clear_object_mesh.rs
new file mode 100644
index 0000000..41daf1f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/clear_object_mesh.rs
@@ -0,0 +1,10 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_mesh mesh;
+
+void root(int *out)
+{
+ rsClearObject( &mesh );
+ *out = ( NULL == mesh.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/clear_object_sampler.rs b/tests/src/android/renderscript/cts/clear_object_sampler.rs
new file mode 100644
index 0000000..b29d853
--- /dev/null
+++ b/tests/src/android/renderscript/cts/clear_object_sampler.rs
@@ -0,0 +1,10 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_sampler sampler;
+
+void root(int *out)
+{
+ rsClearObject( &sampler );
+ *out = ( NULL == sampler.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/clear_object_script.rs b/tests/src/android/renderscript/cts/clear_object_script.rs
new file mode 100644
index 0000000..5a0139f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/clear_object_script.rs
@@ -0,0 +1,10 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_script script;
+
+void root( int *out)
+{
+ rsClearObject( &script );
+ *out = ( NULL == script.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/clear_object_type.rs b/tests/src/android/renderscript/cts/clear_object_type.rs
new file mode 100644
index 0000000..02e9f31
--- /dev/null
+++ b/tests/src/android/renderscript/cts/clear_object_type.rs
@@ -0,0 +1,10 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_type type;
+
+void root(int *out)
+{
+ rsClearObject( &type );
+ *out = ( NULL == type.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/copysign_f32.rs b/tests/src/android/renderscript/cts/copysign_f32.rs
new file mode 100644
index 0000000..d722d5a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/copysign_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct copysign_f32_input {
+ float x;
+ float y;
+};
+
+void root(const struct copysign_f32_input *in, float *out) {
+ *out = copysign(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/copysign_f32_2.rs b/tests/src/android/renderscript/cts/copysign_f32_2.rs
new file mode 100644
index 0000000..f310a5d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/copysign_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct copysign_f32_2_input {
+ float2 x;
+ float2 y;
+};
+
+void root(const struct copysign_f32_2_input *in, float2 *out) {
+ *out = copysign(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/copysign_f32_3.rs b/tests/src/android/renderscript/cts/copysign_f32_3.rs
new file mode 100644
index 0000000..bb58ef4
--- /dev/null
+++ b/tests/src/android/renderscript/cts/copysign_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct copysign_f32_3_input {
+ float3 x;
+ float3 y;
+};
+
+void root(const struct copysign_f32_3_input *in, float3 *out) {
+ *out = copysign(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/copysign_f32_4.rs b/tests/src/android/renderscript/cts/copysign_f32_4.rs
new file mode 100644
index 0000000..ad08337
--- /dev/null
+++ b/tests/src/android/renderscript/cts/copysign_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct copysign_f32_4_input {
+ float4 x;
+ float4 y;
+};
+
+void root(const struct copysign_f32_4_input *in, float4 *out) {
+ *out = copysign(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/cos_f32.rs b/tests/src/android/renderscript/cts/cos_f32.rs
new file mode 100644
index 0000000..89f3878
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cos_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = cos(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cos_f32_2.rs b/tests/src/android/renderscript/cts/cos_f32_2.rs
new file mode 100644
index 0000000..e596eca
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cos_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float2 *in, float2 *out) {
+ *out = cos(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cos_f32_3.rs b/tests/src/android/renderscript/cts/cos_f32_3.rs
new file mode 100644
index 0000000..bcf5c4a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cos_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3 *in, float3 *out) {
+ *out = cos(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cos_f32_4.rs b/tests/src/android/renderscript/cts/cos_f32_4.rs
new file mode 100644
index 0000000..08e4767
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cos_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4 *in, float4 *out) {
+ *out = cos(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cosh_f32.rs b/tests/src/android/renderscript/cts/cosh_f32.rs
new file mode 100644
index 0000000..6ec2987
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cosh_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = cosh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cosh_f32_2.rs b/tests/src/android/renderscript/cts/cosh_f32_2.rs
new file mode 100644
index 0000000..a440e60
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cosh_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float2 *in, float2 *out) {
+ *out = cosh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cosh_f32_3.rs b/tests/src/android/renderscript/cts/cosh_f32_3.rs
new file mode 100644
index 0000000..6408d33
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cosh_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3 *in, float3 *out) {
+ *out = cosh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cosh_f32_4.rs b/tests/src/android/renderscript/cts/cosh_f32_4.rs
new file mode 100644
index 0000000..666c493
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cosh_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4 *in, float4 *out) {
+ *out = cosh(*in);
+}
diff --git a/tests/src/android/renderscript/cts/cross_f32_3.rs b/tests/src/android/renderscript/cts/cross_f32_3.rs
new file mode 100644
index 0000000..5895ae4
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cross_f32_3.rs
@@ -0,0 +1,10 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+typedef struct _cross_f32_3_struct {
+ float3 low;
+ float3 high;
+}cross_f32_3_struct;
+
+void root(const cross_f32_3_struct *in, float3 *out) {
+ *out = cross(in->low, in->high);
+}
diff --git a/tests/src/android/renderscript/cts/cross_f32_4.rs b/tests/src/android/renderscript/cts/cross_f32_4.rs
new file mode 100644
index 0000000..b2092ca
--- /dev/null
+++ b/tests/src/android/renderscript/cts/cross_f32_4.rs
@@ -0,0 +1,10 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+typedef struct _cross_f32_4_struct {
+ float4 low;
+ float4 high;
+}cross_f32_4_struct;
+
+void root(const cross_f32_4_struct *in, float4 *out) {
+ *out = cross(in->low, in->high);
+}
diff --git a/tests/src/android/renderscript/cts/deg_f32.rs b/tests/src/android/renderscript/cts/deg_f32.rs
new file mode 100644
index 0000000..447b12b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/deg_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float* in, float* out) {
+ *out = degrees(*in);
+}
diff --git a/tests/src/android/renderscript/cts/deg_f32_2.rs b/tests/src/android/renderscript/cts/deg_f32_2.rs
new file mode 100644
index 0000000..c9fc6a0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/deg_f32_2.rs
@@ -0,0 +1,7 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float2* in, float2* out) {
+ *out = degrees (*in);
+
+}
diff --git a/tests/src/android/renderscript/cts/deg_f32_3.rs b/tests/src/android/renderscript/cts/deg_f32_3.rs
new file mode 100644
index 0000000..ed34b19
--- /dev/null
+++ b/tests/src/android/renderscript/cts/deg_f32_3.rs
@@ -0,0 +1,7 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3* in, float3* out) {
+ *out = degrees(*in);
+
+}
diff --git a/tests/src/android/renderscript/cts/deg_f32_4.rs b/tests/src/android/renderscript/cts/deg_f32_4.rs
new file mode 100644
index 0000000..82c5e5c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/deg_f32_4.rs
@@ -0,0 +1,7 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4* in, float4* out) {
+ *out = degrees(*in);
+
+}
diff --git a/tests/src/android/renderscript/cts/exp10_f32.rs b/tests/src/android/renderscript/cts/exp10_f32.rs
new file mode 100644
index 0000000..f45a503
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp10_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = exp10(*in);
+}
diff --git a/tests/src/android/renderscript/cts/exp10_f32_2.rs b/tests/src/android/renderscript/cts/exp10_f32_2.rs
new file mode 100644
index 0000000..ff48f4e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp10_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float2 *in, float2 *out) {
+ *out = exp10(*in);
+}
diff --git a/tests/src/android/renderscript/cts/exp10_f32_3.rs b/tests/src/android/renderscript/cts/exp10_f32_3.rs
new file mode 100644
index 0000000..e7ffa54
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp10_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3 *in, float3 *out) {
+ *out = exp10(*in);
+}
diff --git a/tests/src/android/renderscript/cts/exp10_f32_4.rs b/tests/src/android/renderscript/cts/exp10_f32_4.rs
new file mode 100644
index 0000000..1c60e94
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp10_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4 *in, float4 *out) {
+ *out = exp10(*in);
+}
diff --git a/tests/src/android/renderscript/cts/exp2_f32.rs b/tests/src/android/renderscript/cts/exp2_f32.rs
new file mode 100644
index 0000000..c5f0a81
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp2_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = exp2(*in);
+}
diff --git a/tests/src/android/renderscript/cts/exp2_f32_2.rs b/tests/src/android/renderscript/cts/exp2_f32_2.rs
new file mode 100644
index 0000000..c972310
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp2_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float2 *in, float2 *out) {
+ *out = exp2(*in);
+}
diff --git a/tests/src/android/renderscript/cts/exp2_f32_3.rs b/tests/src/android/renderscript/cts/exp2_f32_3.rs
new file mode 100644
index 0000000..80d49c1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp2_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3 *in, float3 *out) {
+ *out = exp2(*in);
+}
diff --git a/tests/src/android/renderscript/cts/exp2_f32_4.rs b/tests/src/android/renderscript/cts/exp2_f32_4.rs
new file mode 100644
index 0000000..a82430f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp2_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4 *in, float4 *out) {
+ *out = exp2(*in);
+}
diff --git a/tests/src/android/renderscript/cts/exp_f32.rs b/tests/src/android/renderscript/cts/exp_f32.rs
new file mode 100644
index 0000000..575d247
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = exp(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/exp_f32_2.rs b/tests/src/android/renderscript/cts/exp_f32_2.rs
new file mode 100644
index 0000000..1d2c546
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float2 *in, float2 *out) {
+ *out = exp(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/exp_f32_3.rs b/tests/src/android/renderscript/cts/exp_f32_3.rs
new file mode 100644
index 0000000..6b04c5f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3 *in, float3 *out) {
+ *out = exp(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/exp_f32_4.rs b/tests/src/android/renderscript/cts/exp_f32_4.rs
new file mode 100644
index 0000000..ced9021
--- /dev/null
+++ b/tests/src/android/renderscript/cts/exp_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4 *in, float4 *out) {
+ *out = exp(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/expm1_f32.rs b/tests/src/android/renderscript/cts/expm1_f32.rs
new file mode 100644
index 0000000..b9875ae
--- /dev/null
+++ b/tests/src/android/renderscript/cts/expm1_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = expm1(*in);
+}
diff --git a/tests/src/android/renderscript/cts/expm1_f32_2.rs b/tests/src/android/renderscript/cts/expm1_f32_2.rs
new file mode 100644
index 0000000..73fb2b1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/expm1_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float2 *in, float2 *out) {
+ *out = expm1(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/expm1_f32_3.rs b/tests/src/android/renderscript/cts/expm1_f32_3.rs
new file mode 100644
index 0000000..92593bd
--- /dev/null
+++ b/tests/src/android/renderscript/cts/expm1_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3 *in, float3 *out) {
+ *out = expm1(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/expm1_f32_4.rs b/tests/src/android/renderscript/cts/expm1_f32_4.rs
new file mode 100644
index 0000000..4d2aaaa
--- /dev/null
+++ b/tests/src/android/renderscript/cts/expm1_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4 *in, float4 *out) {
+ *out = expm1(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fabs_f32.rs b/tests/src/android/renderscript/cts/fabs_f32.rs
new file mode 100644
index 0000000..221339c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fabs_f32.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float *in, float *out) {
+ *out = fabs(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fabs_f32_2.rs b/tests/src/android/renderscript/cts/fabs_f32_2.rs
new file mode 100644
index 0000000..c4aa884
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fabs_f32_2.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float2 *in, float2 *out) {
+ *out = fabs(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fabs_f32_3.rs b/tests/src/android/renderscript/cts/fabs_f32_3.rs
new file mode 100644
index 0000000..320d551
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fabs_f32_3.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float3 *in, float3 *out) {
+ *out = fabs(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fabs_f32_4.rs b/tests/src/android/renderscript/cts/fabs_f32_4.rs
new file mode 100644
index 0000000..c7f9788
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fabs_f32_4.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float4 *in, float4 *out) {
+ *out = fabs(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fdim_f32.rs b/tests/src/android/renderscript/cts/fdim_f32.rs
new file mode 100644
index 0000000..4292ec9
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fdim_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct fdim_f32_input {
+ float x;
+ float y;
+};
+
+void root(const struct fdim_f32_input *in, float *out) {
+ *out = fdim(in->x, in->y);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fdim_f32_2.rs b/tests/src/android/renderscript/cts/fdim_f32_2.rs
new file mode 100644
index 0000000..5965a4e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fdim_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct fdim_f32_2_input {
+ float2 x;
+ float2 y;
+};
+
+void root(const struct fdim_f32_2_input *in, float2 *out) {
+ *out = fdim(in->x, in->y);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fdim_f32_3.rs b/tests/src/android/renderscript/cts/fdim_f32_3.rs
new file mode 100644
index 0000000..86aecd5
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fdim_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct fdim_f32_3_input {
+ float3 x;
+ float3 y;
+};
+
+void root(const struct fdim_f32_3_input *in, float3 *out) {
+ *out = fdim(in->x, in->y);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fdim_f32_4.rs b/tests/src/android/renderscript/cts/fdim_f32_4.rs
new file mode 100644
index 0000000..a3d953f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fdim_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct fdim_f32_4_input {
+ float4 x;
+ float4 y;
+};
+
+void root(const struct fdim_f32_4_input *in, float4 *out) {
+ *out = fdim(in->x, in->y);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/floor_f32.rs b/tests/src/android/renderscript/cts/floor_f32.rs
new file mode 100644
index 0000000..e2faa48
--- /dev/null
+++ b/tests/src/android/renderscript/cts/floor_f32.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float *in, float *out) {
+ *out = floor(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/floor_f32_2.rs b/tests/src/android/renderscript/cts/floor_f32_2.rs
new file mode 100644
index 0000000..83fb4e7
--- /dev/null
+++ b/tests/src/android/renderscript/cts/floor_f32_2.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float2 *in, float2 *out) {
+ *out = floor(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/floor_f32_3.rs b/tests/src/android/renderscript/cts/floor_f32_3.rs
new file mode 100644
index 0000000..6dad3e2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/floor_f32_3.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float3 *in, float3 *out) {
+ *out = floor(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/floor_f32_4.rs b/tests/src/android/renderscript/cts/floor_f32_4.rs
new file mode 100644
index 0000000..b6083be
--- /dev/null
+++ b/tests/src/android/renderscript/cts/floor_f32_4.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float4 *in, float4 *out) {
+ *out = floor(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fma_f32.rs b/tests/src/android/renderscript/cts/fma_f32.rs
new file mode 100644
index 0000000..fba5202
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fma_f32.rs
@@ -0,0 +1,12 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct Floats {
+ float fa;
+ float fb;
+ float fc;
+} Floats;
+
+void root(const Floats *in, float *out) {
+ *out = fma(in->fa, in->fb, in->fc);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fma_f32_2.rs b/tests/src/android/renderscript/cts/fma_f32_2.rs
new file mode 100644
index 0000000..1ab4b4f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fma_f32_2.rs
@@ -0,0 +1,12 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct Floats2 {
+ float2 fa;
+ float2 fb;
+ float2 fc;
+} Floats2;
+
+void root(const Floats2 *in, float2 *out) {
+ *out = fma(in->fa, in->fb, in->fc);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fma_f32_3.rs b/tests/src/android/renderscript/cts/fma_f32_3.rs
new file mode 100644
index 0000000..c1006e1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fma_f32_3.rs
@@ -0,0 +1,12 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct Floats3 {
+ float3 fa;
+ float3 fb;
+ float3 fc;
+} Floats3;
+
+void root(const Floats3 *in, float3 *out) {
+ *out = fma(in->fa, in->fb, in->fc);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fma_f32_4.rs b/tests/src/android/renderscript/cts/fma_f32_4.rs
new file mode 100644
index 0000000..46c2f89
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fma_f32_4.rs
@@ -0,0 +1,12 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct Floats4 {
+ float4 fa;
+ float4 fb;
+ float4 fc;
+} Floats4;
+
+void root(const Floats4 *in, float4 *out) {
+ *out = fma(in->fa, in->fb, in->fc);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fmax_f32.rs b/tests/src/android/renderscript/cts/fmax_f32.rs
new file mode 100644
index 0000000..3deab71
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmax_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct fmax_f32_in {
+ float first;
+ float second;
+} input;
+
+void root(const input* in, float* out){
+ *out = fmax(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/fmax_f32_2.rs b/tests/src/android/renderscript/cts/fmax_f32_2.rs
new file mode 100644
index 0000000..7e901e9
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmax_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct fmax_f32_2_in {
+ float2 first;
+ float2 second;
+} input;
+
+void root(const input* in, float2* out){
+ *out = fmax(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/fmax_f32_3.rs b/tests/src/android/renderscript/cts/fmax_f32_3.rs
new file mode 100644
index 0000000..37b856d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmax_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct fmax_f32_3_in {
+ float3 first;
+ float3 second;
+} input;
+
+void root(const input* in, float3* out){
+ *out = fmax(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/fmax_f32_4.rs b/tests/src/android/renderscript/cts/fmax_f32_4.rs
new file mode 100644
index 0000000..2057a86
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmax_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct fmax_f32_4_in {
+ float4 first;
+ float4 second;
+} input;
+
+void root(const input* in, float4* out){
+ *out = fmax(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/fmin_f32.rs b/tests/src/android/renderscript/cts/fmin_f32.rs
new file mode 100644
index 0000000..d8dec4d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmin_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct fmin_f32_in {
+ float first;
+ float second;
+} input;
+
+void root(const input* in, float* out){
+ *out = fmin(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/fmin_f32_2.rs b/tests/src/android/renderscript/cts/fmin_f32_2.rs
new file mode 100644
index 0000000..b623bc5
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmin_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct fmin_f32_2_in {
+ float2 first;
+ float2 second;
+} input;
+
+void root(const input* in, float2* out){
+ *out = fmin(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/fmin_f32_3.rs b/tests/src/android/renderscript/cts/fmin_f32_3.rs
new file mode 100644
index 0000000..8e60215
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmin_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct fmin_f32_3_in {
+ float3 first;
+ float3 second;
+} input;
+
+void root(const input* in, float3* out){
+ *out = fmin(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/fmin_f32_4.rs b/tests/src/android/renderscript/cts/fmin_f32_4.rs
new file mode 100644
index 0000000..ab29912
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmin_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct fmin_f32_4_in {
+ float4 first;
+ float4 second;
+} input;
+
+void root(const input* in, float4* out){
+ *out = fmin(in->first, in->second);
+}
diff --git a/tests/src/android/renderscript/cts/fmod_f32.rs b/tests/src/android/renderscript/cts/fmod_f32.rs
new file mode 100644
index 0000000..95f5ce3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmod_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct fmod_input_f32 {
+ float param1;
+ float param2;
+};
+
+void root(const struct fmod_input_f32 *in, float *out) {
+ *out = fmod(in->param1, in->param2);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fmod_f32_2.rs b/tests/src/android/renderscript/cts/fmod_f32_2.rs
new file mode 100644
index 0000000..c48c2a3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmod_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct fmod_input_f32_2 {
+ float2 param1;
+ float2 param2;
+};
+
+void root(const struct fmod_input_f32_2 *in, float2 *out) {
+ *out = fmod(in->param1, in->param2);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fmod_f32_3.rs b/tests/src/android/renderscript/cts/fmod_f32_3.rs
new file mode 100644
index 0000000..7a57e1a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmod_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct fmod_input_f32_3 {
+ float3 param1;
+ float3 param2;
+};
+
+void root(const struct fmod_input_f32_3 *in, float3 *out) {
+ *out = fmod(in->param1, in->param2);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/fmod_f32_4.rs b/tests/src/android/renderscript/cts/fmod_f32_4.rs
new file mode 100644
index 0000000..0fb4f73
--- /dev/null
+++ b/tests/src/android/renderscript/cts/fmod_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct fmod_input_f32_4 {
+ float4 param1;
+ float4 param2;
+};
+
+void root(const struct fmod_input_f32_4 *in, float4 *out) {
+ *out = fmod(in->param1, in->param2);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/get_allocation.rs b/tests/src/android/renderscript/cts/get_allocation.rs
new file mode 100644
index 0000000..0149e6c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/get_allocation.rs
@@ -0,0 +1,16 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+const int* pointer;
+rs_script script;
+rs_allocation alloc_in;
+rs_allocation alloc_out;
+
+void root(const int* in, int *out) {
+ *out = *in;
+}
+
+void start() {
+ alloc_in = rsGetAllocation(pointer);
+ rsForEach(script, alloc_in, alloc_out);
+}
diff --git a/tests/src/android/renderscript/cts/get_element_at_x.rs b/tests/src/android/renderscript/cts/get_element_at_x.rs
new file mode 100644
index 0000000..8d6ef8f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/get_element_at_x.rs
@@ -0,0 +1,9 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation gIn;
+
+void root(uint32_t *out, uint32_t x) {
+ const uint32_t * tm = rsGetElementAt (gIn, x);
+ *out = *tm;
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/get_element_at_x_y.rs b/tests/src/android/renderscript/cts/get_element_at_x_y.rs
new file mode 100644
index 0000000..2a978c3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/get_element_at_x_y.rs
@@ -0,0 +1,9 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation gIn;
+
+void root(uint32_t *out, uint32_t x, uint32_t y) {
+ const uint32_t * tm = rsGetElementAt (gIn, x, y);
+ *out = *tm;
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/hypot_f32.rs b/tests/src/android/renderscript/cts/hypot_f32.rs
new file mode 100644
index 0000000..196fd23
--- /dev/null
+++ b/tests/src/android/renderscript/cts/hypot_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct hypot_f32_in {
+ float x;
+ float y;
+} hypot_input_f32;
+
+void root(const hypot_input_f32 *in, float *out) {
+ *out = hypot(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/hypot_f32_2.rs b/tests/src/android/renderscript/cts/hypot_f32_2.rs
new file mode 100644
index 0000000..08d2809
--- /dev/null
+++ b/tests/src/android/renderscript/cts/hypot_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct hypot_f32_2_in {
+ float2 x;
+ float2 y;
+} hypot_input_f32_2;
+
+void root(const hypot_input_f32_2 *in, float2 *out) {
+ *out = hypot(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/hypot_f32_3.rs b/tests/src/android/renderscript/cts/hypot_f32_3.rs
new file mode 100644
index 0000000..7864840
--- /dev/null
+++ b/tests/src/android/renderscript/cts/hypot_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct hypot_f32_3_in {
+ float3 x;
+ float3 y;
+} hypot_input_f32_3;
+
+void root(const hypot_input_f32_3 *in, float3 *out) {
+ *out = hypot(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/hypot_f32_4.rs b/tests/src/android/renderscript/cts/hypot_f32_4.rs
new file mode 100644
index 0000000..b23effe
--- /dev/null
+++ b/tests/src/android/renderscript/cts/hypot_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct hypot_f32_4_in {
+ float4 x;
+ float4 y;
+} hypot_input_f32_4;
+
+void root(const hypot_input_f32_4 *in, float4 *out) {
+ *out = hypot(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/init_test.rs b/tests/src/android/renderscript/cts/init_test.rs
new file mode 100644
index 0000000..f89c979
--- /dev/null
+++ b/tests/src/android/renderscript/cts/init_test.rs
@@ -0,0 +1,13 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+float a;
+
+void init()
+{
+ a = 2.f;
+}
+
+void root(const float *in, float *out) {
+ *out = a;
+}
diff --git a/tests/src/android/renderscript/cts/is_object_allocation.rs b/tests/src/android/renderscript/cts/is_object_allocation.rs
new file mode 100644
index 0000000..b99668a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/is_object_allocation.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _object_allocation_input {
+ rs_allocation allocation;
+}object_allocation_input;
+
+void root( const object_allocation_input *in, int *out)
+{
+ *out = rsIsObject(in->allocation)==false ? 0 : 1;
+}
diff --git a/tests/src/android/renderscript/cts/is_object_element.rs b/tests/src/android/renderscript/cts/is_object_element.rs
new file mode 100644
index 0000000..cdc04e1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/is_object_element.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _object_element_input {
+ rs_element element;
+}object_element_input;
+
+void root( const object_element_input *in, int *out)
+{
+ *out = rsIsObject(in->element)==false ? 0 : 1;
+}
diff --git a/tests/src/android/renderscript/cts/is_object_mesh.rs b/tests/src/android/renderscript/cts/is_object_mesh.rs
new file mode 100644
index 0000000..7e25d04
--- /dev/null
+++ b/tests/src/android/renderscript/cts/is_object_mesh.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _object_mesh_input {
+ rs_mesh mesh;
+}object_mesh_input;
+
+void root( const object_mesh_input *in, int *out)
+{
+ *out = rsIsObject(in->mesh)==false ? 0 : 1;
+}
diff --git a/tests/src/android/renderscript/cts/is_object_sampler.rs b/tests/src/android/renderscript/cts/is_object_sampler.rs
new file mode 100644
index 0000000..96ac1e2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/is_object_sampler.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _object_sampler_input {
+ rs_sampler sampler;
+}object_sampler_input;
+
+void root( const object_sampler_input *in, int *out)
+{
+ *out = rsIsObject(in->sampler)==false ? 0 : 1;
+}
diff --git a/tests/src/android/renderscript/cts/is_object_script.rs b/tests/src/android/renderscript/cts/is_object_script.rs
new file mode 100644
index 0000000..0c632d0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/is_object_script.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _object_script_input {
+ rs_script script;
+}object_script_input;
+
+void root( const object_script_input *in, int *out)
+{
+ *out = rsIsObject(in->script)==false ? 0 : 1;
+}
diff --git a/tests/src/android/renderscript/cts/is_object_type.rs b/tests/src/android/renderscript/cts/is_object_type.rs
new file mode 100644
index 0000000..b55ea15
--- /dev/null
+++ b/tests/src/android/renderscript/cts/is_object_type.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _object_type_input {
+ rs_type type;
+}object_type_input;
+
+void root( const object_type_input *in, int *out)
+{
+ *out = rsIsObject(in->type)==false ? 0 : 1;
+}
diff --git a/tests/src/android/renderscript/cts/log10_f32.rs b/tests/src/android/renderscript/cts/log10_f32.rs
new file mode 100644
index 0000000..b1f5fd9
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log10_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = log10(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log10_f32_2.rs b/tests/src/android/renderscript/cts/log10_f32_2.rs
new file mode 100644
index 0000000..1e3a7fd
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log10_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = log10(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log10_f32_3.rs b/tests/src/android/renderscript/cts/log10_f32_3.rs
new file mode 100644
index 0000000..58b2a17
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log10_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = log10(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log10_f32_4.rs b/tests/src/android/renderscript/cts/log10_f32_4.rs
new file mode 100644
index 0000000..82b71b0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log10_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = log10(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log1p_f32.rs b/tests/src/android/renderscript/cts/log1p_f32.rs
new file mode 100644
index 0000000..d316a16
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log1p_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = log1p(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log1p_f32_2.rs b/tests/src/android/renderscript/cts/log1p_f32_2.rs
new file mode 100644
index 0000000..89657c2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log1p_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = log1p(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log1p_f32_3.rs b/tests/src/android/renderscript/cts/log1p_f32_3.rs
new file mode 100644
index 0000000..243bf0e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log1p_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = log1p(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log1p_f32_4.rs b/tests/src/android/renderscript/cts/log1p_f32_4.rs
new file mode 100644
index 0000000..c0b3591
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log1p_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = log1p(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log2_f32.rs b/tests/src/android/renderscript/cts/log2_f32.rs
new file mode 100644
index 0000000..5455c84
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log2_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = log2(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log2_f32_2.rs b/tests/src/android/renderscript/cts/log2_f32_2.rs
new file mode 100644
index 0000000..9650fa3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log2_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = log2(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log2_f32_3.rs b/tests/src/android/renderscript/cts/log2_f32_3.rs
new file mode 100644
index 0000000..6ab8847
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log2_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = log2(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log2_f32_4.rs b/tests/src/android/renderscript/cts/log2_f32_4.rs
new file mode 100644
index 0000000..6807fbb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log2_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = log2(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log_f32.rs b/tests/src/android/renderscript/cts/log_f32.rs
new file mode 100644
index 0000000..8b00f7b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = log(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log_f32_2.rs b/tests/src/android/renderscript/cts/log_f32_2.rs
new file mode 100644
index 0000000..3d1864a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = log(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log_f32_3.rs b/tests/src/android/renderscript/cts/log_f32_3.rs
new file mode 100644
index 0000000..6d7e389
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = log(*in);
+}
diff --git a/tests/src/android/renderscript/cts/log_f32_4.rs b/tests/src/android/renderscript/cts/log_f32_4.rs
new file mode 100644
index 0000000..a3cbe8e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/log_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = log(*in);
+}
diff --git a/tests/src/android/renderscript/cts/logb_f32.rs b/tests/src/android/renderscript/cts/logb_f32.rs
new file mode 100644
index 0000000..b29f86c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/logb_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = logb(*in);
+}
diff --git a/tests/src/android/renderscript/cts/logb_f32_2.rs b/tests/src/android/renderscript/cts/logb_f32_2.rs
new file mode 100644
index 0000000..ef0f948
--- /dev/null
+++ b/tests/src/android/renderscript/cts/logb_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = logb(*in);
+}
diff --git a/tests/src/android/renderscript/cts/logb_f32_3.rs b/tests/src/android/renderscript/cts/logb_f32_3.rs
new file mode 100644
index 0000000..15d14c9
--- /dev/null
+++ b/tests/src/android/renderscript/cts/logb_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = logb(*in);
+}
diff --git a/tests/src/android/renderscript/cts/logb_f32_4.rs b/tests/src/android/renderscript/cts/logb_f32_4.rs
new file mode 100644
index 0000000..7e2e24a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/logb_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = logb(*in);
+}
diff --git a/tests/src/android/renderscript/cts/mad_f32.rs b/tests/src/android/renderscript/cts/mad_f32.rs
new file mode 100644
index 0000000..fdf8680
--- /dev/null
+++ b/tests/src/android/renderscript/cts/mad_f32.rs
@@ -0,0 +1,12 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct mad_input_f32 {
+ float x;
+ float y;
+ float z;
+};
+
+void root(const struct mad_input_f32 *param, float *out) {
+ *out = mad(param->x, param->y, param->z);
+}
diff --git a/tests/src/android/renderscript/cts/mad_f32_2.rs b/tests/src/android/renderscript/cts/mad_f32_2.rs
new file mode 100644
index 0000000..16c8b25
--- /dev/null
+++ b/tests/src/android/renderscript/cts/mad_f32_2.rs
@@ -0,0 +1,12 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct mad_input_f32_2 {
+ float2 x;
+ float2 y;
+ float2 z;
+};
+
+void root(const struct mad_input_f32_2 *param, float2 *out) {
+ *out = mad(param->x, param->y, param->z);
+}
diff --git a/tests/src/android/renderscript/cts/mad_f32_3.rs b/tests/src/android/renderscript/cts/mad_f32_3.rs
new file mode 100644
index 0000000..d386238
--- /dev/null
+++ b/tests/src/android/renderscript/cts/mad_f32_3.rs
@@ -0,0 +1,12 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct mad_input_f32_3 {
+ float3 x;
+ float3 y;
+ float3 z;
+};
+
+void root(const struct mad_input_f32_3 *param, float3 *out) {
+ *out = mad(param->x, param->y, param->z);
+}
diff --git a/tests/src/android/renderscript/cts/mad_f32_4.rs b/tests/src/android/renderscript/cts/mad_f32_4.rs
new file mode 100644
index 0000000..d81cdd2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/mad_f32_4.rs
@@ -0,0 +1,12 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct mad_input_f32_4 {
+ float4 x;
+ float4 y;
+ float4 z;
+};
+
+void root(const struct mad_input_f32_4 *param, float4 *out) {
+ *out = mad(param->x, param->y, param->z);
+}
diff --git a/tests/src/android/renderscript/cts/nextafter_f32.rs b/tests/src/android/renderscript/cts/nextafter_f32.rs
new file mode 100644
index 0000000..042d48b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/nextafter_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct InputData {
+ float a;
+ float b;
+} InputData;
+
+void root(const InputData *in, float *out) {
+ *out = nextafter (in->a, in->b);
+}
diff --git a/tests/src/android/renderscript/cts/nextafter_f32_2.rs b/tests/src/android/renderscript/cts/nextafter_f32_2.rs
new file mode 100644
index 0000000..529aafe
--- /dev/null
+++ b/tests/src/android/renderscript/cts/nextafter_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct InputData_2 {
+ float2 a;
+ float2 b;
+} InputData_2;
+
+void root(const InputData_2 *in, float2 *out) {
+ *out = nextafter (in->a, in->b);
+}
diff --git a/tests/src/android/renderscript/cts/nextafter_f32_3.rs b/tests/src/android/renderscript/cts/nextafter_f32_3.rs
new file mode 100644
index 0000000..9c457bc
--- /dev/null
+++ b/tests/src/android/renderscript/cts/nextafter_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct InputData_3 {
+ float3 a;
+ float3 b;
+} InputData_3;
+
+void root(const InputData_3 *in, float3 *out) {
+ *out = nextafter (in->a, in->b);
+}
diff --git a/tests/src/android/renderscript/cts/nextafter_f32_4.rs b/tests/src/android/renderscript/cts/nextafter_f32_4.rs
new file mode 100644
index 0000000..0fc1edb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/nextafter_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct InputData_4 {
+ float4 a;
+ float4 b;
+} InputData_4;
+
+void root(const InputData_4 *in, float4 *out) {
+ *out = nextafter (in->a, in->b);
+}
diff --git a/tests/src/android/renderscript/cts/pow_f32.rs b/tests/src/android/renderscript/cts/pow_f32.rs
new file mode 100644
index 0000000..c05095e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/pow_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct PowInputData {
+ float base;
+ float expo;
+} PowInputData;
+
+void root(const PowInputData *in, float *out) {
+ *out = pow(in->base, in->expo);
+}
diff --git a/tests/src/android/renderscript/cts/pow_f32_2.rs b/tests/src/android/renderscript/cts/pow_f32_2.rs
new file mode 100644
index 0000000..1d696c3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/pow_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct PowInputData_2 {
+ float2 base;
+ float2 expo;
+} PowInputData_2;
+
+void root(const PowInputData_2 *in, float2 *out) {
+ *out = pow(in->base, in->expo);
+}
diff --git a/tests/src/android/renderscript/cts/pow_f32_3.rs b/tests/src/android/renderscript/cts/pow_f32_3.rs
new file mode 100644
index 0000000..02210eb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/pow_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct PowInputData_3 {
+ float3 base;
+ float3 expo;
+} PowInputData_3;
+
+void root(const PowInputData_3 *in, float3 *out) {
+ *out = pow(in->base, in->expo);
+}
diff --git a/tests/src/android/renderscript/cts/pow_f32_4.rs b/tests/src/android/renderscript/cts/pow_f32_4.rs
new file mode 100644
index 0000000..f020184
--- /dev/null
+++ b/tests/src/android/renderscript/cts/pow_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct PowInputData_4 {
+ float4 base;
+ float4 expo;
+} PowInputData_4;
+
+void root(const PowInputData_4 *in, float4 *out) {
+ *out = pow(in->base, in->expo);
+}
diff --git a/tests/src/android/renderscript/cts/pown_f32.rs b/tests/src/android/renderscript/cts/pown_f32.rs
new file mode 100644
index 0000000..e9bf8d2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/pown_f32.rs
@@ -0,0 +1,8 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation n;
+
+void root(const float *in, float *out, uint32_t x) {
+ *out = pown(*in, *(int *)rsGetElementAt(n,x));
+}
diff --git a/tests/src/android/renderscript/cts/pown_f32_2.rs b/tests/src/android/renderscript/cts/pown_f32_2.rs
new file mode 100644
index 0000000..ebf41a8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/pown_f32_2.rs
@@ -0,0 +1,8 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation n;
+
+void root(const float2 *in, float2 *out, uint32_t x) {
+ *out = pown(*in, *(int2 *)rsGetElementAt(n,x));
+}
diff --git a/tests/src/android/renderscript/cts/pown_f32_3.rs b/tests/src/android/renderscript/cts/pown_f32_3.rs
new file mode 100644
index 0000000..a386666
--- /dev/null
+++ b/tests/src/android/renderscript/cts/pown_f32_3.rs
@@ -0,0 +1,8 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation n;
+
+void root(const float3 *in, float3 *out, uint32_t x) {
+ *out = pown(*in, *(int3 *)rsGetElementAt(n,x));
+}
diff --git a/tests/src/android/renderscript/cts/pown_f32_4.rs b/tests/src/android/renderscript/cts/pown_f32_4.rs
new file mode 100644
index 0000000..b9f416e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/pown_f32_4.rs
@@ -0,0 +1,8 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation n;
+
+void root(const float4 *in, float4 *out, uint32_t x) {
+ *out = pown(*in, *(int4 *)rsGetElementAt(n,x));
+}
diff --git a/tests/src/android/renderscript/cts/powr_f32.rs b/tests/src/android/renderscript/cts/powr_f32.rs
new file mode 100644
index 0000000..c2c217f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/powr_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct PowInputData {
+ float base;
+ float expo;
+} PowInputData;
+
+void root(const PowInputData *in, float *out) {
+ *out = powr(in->base, in->expo);
+}
diff --git a/tests/src/android/renderscript/cts/powr_f32_2.rs b/tests/src/android/renderscript/cts/powr_f32_2.rs
new file mode 100644
index 0000000..cdd7699
--- /dev/null
+++ b/tests/src/android/renderscript/cts/powr_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct PowInputData_2 {
+ float2 base;
+ float2 expo;
+} PowInputData_2;
+
+void root(const PowInputData_2 *in, float2 *out) {
+ *out = powr(in->base, in->expo);
+}
diff --git a/tests/src/android/renderscript/cts/powr_f32_3.rs b/tests/src/android/renderscript/cts/powr_f32_3.rs
new file mode 100644
index 0000000..28957b4
--- /dev/null
+++ b/tests/src/android/renderscript/cts/powr_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct PowInputData_3 {
+ float3 base;
+ float3 expo;
+} PowInputData_3;
+
+void root(const PowInputData_3 *in, float3 *out) {
+ *out = powr(in->base, in->expo);
+}
diff --git a/tests/src/android/renderscript/cts/powr_f32_4.rs b/tests/src/android/renderscript/cts/powr_f32_4.rs
new file mode 100644
index 0000000..eedc674
--- /dev/null
+++ b/tests/src/android/renderscript/cts/powr_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct PowInputData_4 {
+ float4 base;
+ float4 expo;
+} PowInputData_4;
+
+void root(const PowInputData_4 *in, float4 *out) {
+ *out = powr(in->base, in->expo);
+}
diff --git a/tests/src/android/renderscript/cts/rad_f32.rs b/tests/src/android/renderscript/cts/rad_f32.rs
new file mode 100644
index 0000000..4bea905
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rad_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float* in, float* out) {
+ *out = radians (*in);
+}
diff --git a/tests/src/android/renderscript/cts/rad_f32_2.rs b/tests/src/android/renderscript/cts/rad_f32_2.rs
new file mode 100644
index 0000000..c7a7048
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rad_f32_2.rs
@@ -0,0 +1,7 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+
+void root(const float2* in, float2* out) {
+ *out = radians(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rad_f32_3.rs b/tests/src/android/renderscript/cts/rad_f32_3.rs
new file mode 100644
index 0000000..e16c7fa
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rad_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3* in, float3* out) {
+ *out = radians(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rad_f32_4.rs b/tests/src/android/renderscript/cts/rad_f32_4.rs
new file mode 100644
index 0000000..1224e52
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rad_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4* in, float4* out) {
+ *out = radians(*in);
+}
diff --git a/tests/src/android/renderscript/cts/remainder_f32.rs b/tests/src/android/renderscript/cts/remainder_f32.rs
new file mode 100644
index 0000000..4886fb3
--- /dev/null
+++ b/tests/src/android/renderscript/cts/remainder_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct remainder_f32 {
+ float num;
+ float den;
+};
+
+void root (const struct remainder_f32* in, float* out) {
+ *out = remainder(in->num, in->den);
+}
diff --git a/tests/src/android/renderscript/cts/remainder_f32_2.rs b/tests/src/android/renderscript/cts/remainder_f32_2.rs
new file mode 100644
index 0000000..9580817
--- /dev/null
+++ b/tests/src/android/renderscript/cts/remainder_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct remainder_f32_2 {
+ float2 num;
+ float2 den;
+};
+
+void root (const struct remainder_f32_2* in, float2* out) {
+ *out = remainder(in->num, in->den);
+}
diff --git a/tests/src/android/renderscript/cts/remainder_f32_3.rs b/tests/src/android/renderscript/cts/remainder_f32_3.rs
new file mode 100644
index 0000000..beb2ca8
--- /dev/null
+++ b/tests/src/android/renderscript/cts/remainder_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct remainder_f32_3 {
+ float3 num;
+ float3 den;
+};
+
+void root (const struct remainder_f32_3* in, float3* out) {
+ *out = remainder(in->num, in->den);
+}
diff --git a/tests/src/android/renderscript/cts/remainder_f32_4.rs b/tests/src/android/renderscript/cts/remainder_f32_4.rs
new file mode 100644
index 0000000..1118fc2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/remainder_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct remainder_f32_4 {
+ float4 num;
+ float4 den;
+};
+
+void root (const struct remainder_f32_4* in, float4* out) {
+ *out = remainder(in->num, in->den);
+}
diff --git a/tests/src/android/renderscript/cts/rint_f32.rs b/tests/src/android/renderscript/cts/rint_f32.rs
new file mode 100644
index 0000000..9d52d17
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rint_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = rint(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rint_f32_2.rs b/tests/src/android/renderscript/cts/rint_f32_2.rs
new file mode 100644
index 0000000..371f8ca
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rint_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = rint(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rint_f32_3.rs b/tests/src/android/renderscript/cts/rint_f32_3.rs
new file mode 100644
index 0000000..df3b240
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rint_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = rint(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rint_f32_4.rs b/tests/src/android/renderscript/cts/rint_f32_4.rs
new file mode 100644
index 0000000..02d1eab
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rint_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = rint(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rootn_f32.rs b/tests/src/android/renderscript/cts/rootn_f32.rs
new file mode 100644
index 0000000..f734c1d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rootn_f32.rs
@@ -0,0 +1,8 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation n;
+
+void root(const float *in, float *out, uint32_t x) {
+ *out = rootn(*in, *(int *)rsGetElementAt(n,x));
+}
diff --git a/tests/src/android/renderscript/cts/rootn_f32_2.rs b/tests/src/android/renderscript/cts/rootn_f32_2.rs
new file mode 100644
index 0000000..d31c179
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rootn_f32_2.rs
@@ -0,0 +1,8 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation n;
+
+void root(const float2 *in, float2 *out, uint32_t x) {
+ *out = rootn(*in, *(int2 *)rsGetElementAt(n,x));
+}
diff --git a/tests/src/android/renderscript/cts/rootn_f32_3.rs b/tests/src/android/renderscript/cts/rootn_f32_3.rs
new file mode 100644
index 0000000..7c6c9c9
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rootn_f32_3.rs
@@ -0,0 +1,8 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation n;
+
+void root(const float3 *in, float3 *out, uint32_t x) {
+ *out = rootn(*in, *(int3 *)rsGetElementAt(n,x));
+}
diff --git a/tests/src/android/renderscript/cts/rootn_f32_4.rs b/tests/src/android/renderscript/cts/rootn_f32_4.rs
new file mode 100644
index 0000000..cdf6c10
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rootn_f32_4.rs
@@ -0,0 +1,8 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+rs_allocation n;
+
+void root(const float4 *in, float4 *out, uint32_t x) {
+ *out = rootn(*in, *(int4 *)rsGetElementAt(n,x));
+}
diff --git a/tests/src/android/renderscript/cts/round_f32.rs b/tests/src/android/renderscript/cts/round_f32.rs
new file mode 100644
index 0000000..e06ad5c
--- /dev/null
+++ b/tests/src/android/renderscript/cts/round_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = round(*in);
+}
diff --git a/tests/src/android/renderscript/cts/round_f32_2.rs b/tests/src/android/renderscript/cts/round_f32_2.rs
new file mode 100644
index 0000000..cb8ea97
--- /dev/null
+++ b/tests/src/android/renderscript/cts/round_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in , float2* out) {
+ *out = round(*in);
+}
diff --git a/tests/src/android/renderscript/cts/round_f32_3.rs b/tests/src/android/renderscript/cts/round_f32_3.rs
new file mode 100644
index 0000000..421b1d4
--- /dev/null
+++ b/tests/src/android/renderscript/cts/round_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = round(*in);
+}
diff --git a/tests/src/android/renderscript/cts/round_f32_4.rs b/tests/src/android/renderscript/cts/round_f32_4.rs
new file mode 100644
index 0000000..55c36e1
--- /dev/null
+++ b/tests/src/android/renderscript/cts/round_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in , float4* out) {
+ *out = round(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rs_frac_f32.rs b/tests/src/android/renderscript/cts/rs_frac_f32.rs
new file mode 100644
index 0000000..3e0e49a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rs_frac_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = rsFrac(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rs_pack_color_to_8888_f32_3.rs b/tests/src/android/renderscript/cts/rs_pack_color_to_8888_f32_3.rs
new file mode 100644
index 0000000..76a0135
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rs_pack_color_to_8888_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, uchar4* out) {
+ *out = rsPackColorTo8888(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rs_pack_color_to_8888_f32_4.rs b/tests/src/android/renderscript/cts/rs_pack_color_to_8888_f32_4.rs
new file mode 100644
index 0000000..1d2d71b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rs_pack_color_to_8888_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, uchar4* out) {
+ *out = rsPackColorTo8888(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rs_pack_color_to_8888_rgb.rs b/tests/src/android/renderscript/cts/rs_pack_color_to_8888_rgb.rs
new file mode 100644
index 0000000..1639e61
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rs_pack_color_to_8888_rgb.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, uchar4* out) {
+ *out = rsPackColorTo8888(in->r, in->g, in->b);
+}
diff --git a/tests/src/android/renderscript/cts/rs_pack_color_to_8888_rgba.rs b/tests/src/android/renderscript/cts/rs_pack_color_to_8888_rgba.rs
new file mode 100644
index 0000000..64e7886
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rs_pack_color_to_8888_rgba.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, uchar4* out) {
+ *out = rsPackColorTo8888(in->r, in->g, in->b, in->a);
+}
diff --git a/tests/src/android/renderscript/cts/rs_unpack_color_8888.rs b/tests/src/android/renderscript/cts/rs_unpack_color_8888.rs
new file mode 100644
index 0000000..b0dafa5
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rs_unpack_color_8888.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const uchar4* in, float4* out) {
+ *out = rsUnpackColor8888(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rsqrt_f32.rs b/tests/src/android/renderscript/cts/rsqrt_f32.rs
new file mode 100644
index 0000000..2db534a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rsqrt_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = rsqrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rsqrt_f32_2.rs b/tests/src/android/renderscript/cts/rsqrt_f32_2.rs
new file mode 100644
index 0000000..549bd6a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rsqrt_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = rsqrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rsqrt_f32_3.rs b/tests/src/android/renderscript/cts/rsqrt_f32_3.rs
new file mode 100644
index 0000000..847112a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rsqrt_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = rsqrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/rsqrt_f32_4.rs b/tests/src/android/renderscript/cts/rsqrt_f32_4.rs
new file mode 100644
index 0000000..54587cd
--- /dev/null
+++ b/tests/src/android/renderscript/cts/rsqrt_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = rsqrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/sendToClientBlocking.rs b/tests/src/android/renderscript/cts/sendToClientBlocking.rs
new file mode 100644
index 0000000..3f4a419
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sendToClientBlocking.rs
@@ -0,0 +1,13 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+int ID;
+int data;
+
+void callBack1Params() {
+ rsSendToClientBlocking(ID);
+}
+
+void callBack3Params() {
+ rsSendToClientBlocking(ID, &data, sizeof(data));
+}
diff --git a/tests/src/android/renderscript/cts/send_to_client.rs b/tests/src/android/renderscript/cts/send_to_client.rs
new file mode 100644
index 0000000..12c963e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/send_to_client.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const int4* in) {
+ int id = in->x;
+ int data[4];
+ data[0] = in->y;
+ data[1] = in->z;
+ data[2] = in->w;
+ rsSendToClient(id, data, sizeof(data));
+}
diff --git a/tests/src/android/renderscript/cts/send_to_client_1.rs b/tests/src/android/renderscript/cts/send_to_client_1.rs
new file mode 100644
index 0000000..24c7222
--- /dev/null
+++ b/tests/src/android/renderscript/cts/send_to_client_1.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void callback(int id){
+ rsSendToClient(id);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/set_object_allocation.rs b/tests/src/android/renderscript/cts/set_object_allocation.rs
new file mode 100644
index 0000000..6d2dd1d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/set_object_allocation.rs
@@ -0,0 +1,13 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _set_object_allocation_input {
+ rs_allocation allocation;
+}set_object_allocation_input;
+
+void root( const set_object_allocation_input *in, int *out)
+{
+ rs_allocation dst;
+ rsSetObject(&dst,in->allocation);
+ *out = ( dst.p == in->allocation.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/set_object_element.rs b/tests/src/android/renderscript/cts/set_object_element.rs
new file mode 100644
index 0000000..6f21ebe
--- /dev/null
+++ b/tests/src/android/renderscript/cts/set_object_element.rs
@@ -0,0 +1,13 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _set_object_element_input {
+ rs_element element;
+}set_object_element_input;
+
+void root( const set_object_element_input *in, int *out)
+{
+ rs_element dst;
+ rsSetObject(&dst,in->element);
+ *out = ( dst.p == in->element.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/set_object_mesh.rs b/tests/src/android/renderscript/cts/set_object_mesh.rs
new file mode 100644
index 0000000..584b0e6
--- /dev/null
+++ b/tests/src/android/renderscript/cts/set_object_mesh.rs
@@ -0,0 +1,13 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _set_object_mesh_input {
+ rs_mesh mesh;
+}set_object_mesh_input;
+
+void root( const set_object_mesh_input *in, int *out)
+{
+ rs_mesh dst;
+ rsSetObject(&dst,in->mesh);
+ *out = ( dst.p == in->mesh.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/set_object_sampler.rs b/tests/src/android/renderscript/cts/set_object_sampler.rs
new file mode 100644
index 0000000..6ea201b
--- /dev/null
+++ b/tests/src/android/renderscript/cts/set_object_sampler.rs
@@ -0,0 +1,13 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _set_object_sampler_input {
+ rs_sampler sampler;
+}set_object_sampler_input;
+
+void root( const set_object_sampler_input *in, int *out)
+{
+ rs_sampler dst;
+ rsSetObject(&dst,in->sampler);
+ *out = ( dst.p == in->sampler.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/set_object_script.rs b/tests/src/android/renderscript/cts/set_object_script.rs
new file mode 100644
index 0000000..2f5703e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/set_object_script.rs
@@ -0,0 +1,13 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _set_object_script_input {
+ rs_script script;
+}set_object_script_input;
+
+void root( const set_object_script_input *in, int *out)
+{
+ rs_script dst;
+ rsSetObject(&dst,in->script);
+ *out = ( dst.p == in->script.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/set_object_type.rs b/tests/src/android/renderscript/cts/set_object_type.rs
new file mode 100644
index 0000000..704cc62
--- /dev/null
+++ b/tests/src/android/renderscript/cts/set_object_type.rs
@@ -0,0 +1,13 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+typedef struct _set_object_type_input {
+ rs_type type;
+}set_object_type_input;
+
+void root( const set_object_type_input *in, int *out)
+{
+ rs_type dst;
+ rsSetObject(&dst,in->type);
+ *out = ( dst.p == in->type.p ? 1 : 0 );
+}
diff --git a/tests/src/android/renderscript/cts/sign_f32.rs b/tests/src/android/renderscript/cts/sign_f32.rs
new file mode 100644
index 0000000..2954053
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sign_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float *in, float *out) {
+ *out = sign (*in);
+}
diff --git a/tests/src/android/renderscript/cts/sign_f32_2.rs b/tests/src/android/renderscript/cts/sign_f32_2.rs
new file mode 100644
index 0000000..3de8ecf
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sign_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float2 *in, float2 *out) {
+ *out = sign (*in);
+}
diff --git a/tests/src/android/renderscript/cts/sign_f32_3.rs b/tests/src/android/renderscript/cts/sign_f32_3.rs
new file mode 100644
index 0000000..6a60886
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sign_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float3 *in, float3 *out) {
+ *out = sign (*in);
+}
diff --git a/tests/src/android/renderscript/cts/sign_f32_4.rs b/tests/src/android/renderscript/cts/sign_f32_4.rs
new file mode 100644
index 0000000..3c29a7e
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sign_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root(const float4 *in, float4 *out) {
+ *out = sign (*in);
+}
diff --git a/tests/src/android/renderscript/cts/sin_f32.rs b/tests/src/android/renderscript/cts/sin_f32.rs
new file mode 100644
index 0000000..42b6713
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sin_f32.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float *in, float *out) {
+ *out = sin(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/sin_f32_2.rs b/tests/src/android/renderscript/cts/sin_f32_2.rs
new file mode 100644
index 0000000..e48c757
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sin_f32_2.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float2 *in, float2 *out) {
+ *out = sin(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/sin_f32_3.rs b/tests/src/android/renderscript/cts/sin_f32_3.rs
new file mode 100644
index 0000000..1a51f37
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sin_f32_3.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float3 *in, float3 *out) {
+ *out = sin(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/sin_f32_4.rs b/tests/src/android/renderscript/cts/sin_f32_4.rs
new file mode 100644
index 0000000..82848c0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sin_f32_4.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float4 *in, float4 *out) {
+ *out = sin(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/sinh_f32.rs b/tests/src/android/renderscript/cts/sinh_f32.rs
new file mode 100644
index 0000000..8fcc6f2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sinh_f32.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float *in, float *out) {
+ *out = sinh(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/sinh_f32_2.rs b/tests/src/android/renderscript/cts/sinh_f32_2.rs
new file mode 100644
index 0000000..5333429
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sinh_f32_2.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float2 *in, float2 *out) {
+ *out = sinh(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/sinh_f32_3.rs b/tests/src/android/renderscript/cts/sinh_f32_3.rs
new file mode 100644
index 0000000..49a5dee
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sinh_f32_3.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float3 *in, float3 *out) {
+ *out = sinh(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/sinh_f32_4.rs b/tests/src/android/renderscript/cts/sinh_f32_4.rs
new file mode 100644
index 0000000..e8b60cb
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sinh_f32_4.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float4 *in, float4 *out) {
+ *out = sinh(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/sqrt_f32.rs b/tests/src/android/renderscript/cts/sqrt_f32.rs
new file mode 100644
index 0000000..865183d
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sqrt_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = sqrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/sqrt_f32_2.rs b/tests/src/android/renderscript/cts/sqrt_f32_2.rs
new file mode 100644
index 0000000..ca70e03
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sqrt_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = sqrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/sqrt_f32_3.rs b/tests/src/android/renderscript/cts/sqrt_f32_3.rs
new file mode 100644
index 0000000..9efe0ce
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sqrt_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = sqrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/sqrt_f32_4.rs b/tests/src/android/renderscript/cts/sqrt_f32_4.rs
new file mode 100644
index 0000000..b980582
--- /dev/null
+++ b/tests/src/android/renderscript/cts/sqrt_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = sqrt(*in);
+}
diff --git a/tests/src/android/renderscript/cts/step_f32.rs b/tests/src/android/renderscript/cts/step_f32.rs
new file mode 100644
index 0000000..61320c6
--- /dev/null
+++ b/tests/src/android/renderscript/cts/step_f32.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct step_input {
+ float x;
+ float y;
+};
+
+void root(const struct step_input *in, float *out) {
+ *out = step(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/step_f32_2.rs b/tests/src/android/renderscript/cts/step_f32_2.rs
new file mode 100644
index 0000000..b3eac17
--- /dev/null
+++ b/tests/src/android/renderscript/cts/step_f32_2.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct step_2_input {
+ float2 x;
+ float2 y;
+};
+
+void root(const struct step_2_input *in, float2 *out) {
+ *out = step(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/step_f32_3.rs b/tests/src/android/renderscript/cts/step_f32_3.rs
new file mode 100644
index 0000000..3d4c9df
--- /dev/null
+++ b/tests/src/android/renderscript/cts/step_f32_3.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct step_3_input {
+ float3 x;
+ float3 y;
+};
+
+void root(const struct step_3_input *in, float3 *out) {
+ *out = step(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/step_f32_4.rs b/tests/src/android/renderscript/cts/step_f32_4.rs
new file mode 100644
index 0000000..29523d2
--- /dev/null
+++ b/tests/src/android/renderscript/cts/step_f32_4.rs
@@ -0,0 +1,11 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+struct step_4_input {
+ float4 x;
+ float4 y;
+};
+
+void root(const struct step_4_input *in, float4 *out) {
+ *out = step(in->x, in->y);
+}
diff --git a/tests/src/android/renderscript/cts/tan_f32.rs b/tests/src/android/renderscript/cts/tan_f32.rs
new file mode 100644
index 0000000..62b1a81
--- /dev/null
+++ b/tests/src/android/renderscript/cts/tan_f32.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float *in, float *out) {
+ *out = tan(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/tan_f32_2.rs b/tests/src/android/renderscript/cts/tan_f32_2.rs
new file mode 100644
index 0000000..f179da5
--- /dev/null
+++ b/tests/src/android/renderscript/cts/tan_f32_2.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float2 *in, float2 *out) {
+ *out = tan(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/tan_f32_3.rs b/tests/src/android/renderscript/cts/tan_f32_3.rs
new file mode 100644
index 0000000..0a7f550
--- /dev/null
+++ b/tests/src/android/renderscript/cts/tan_f32_3.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float3 *in, float3 *out) {
+ *out = tan(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/tan_f32_4.rs b/tests/src/android/renderscript/cts/tan_f32_4.rs
new file mode 100644
index 0000000..2d1b0d0
--- /dev/null
+++ b/tests/src/android/renderscript/cts/tan_f32_4.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float4 *in, float4 *out) {
+ *out = tan(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/tanh_f32.rs b/tests/src/android/renderscript/cts/tanh_f32.rs
new file mode 100644
index 0000000..e719572
--- /dev/null
+++ b/tests/src/android/renderscript/cts/tanh_f32.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float *in, float *out) {
+ *out = tanh(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/tanh_f32_2.rs b/tests/src/android/renderscript/cts/tanh_f32_2.rs
new file mode 100644
index 0000000..2ffb0ff
--- /dev/null
+++ b/tests/src/android/renderscript/cts/tanh_f32_2.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float2 *in, float2 *out) {
+ *out = tanh(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/tanh_f32_3.rs b/tests/src/android/renderscript/cts/tanh_f32_3.rs
new file mode 100644
index 0000000..f39b6fc
--- /dev/null
+++ b/tests/src/android/renderscript/cts/tanh_f32_3.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float3 *in, float3 *out) {
+ *out = tanh(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/tanh_f32_4.rs b/tests/src/android/renderscript/cts/tanh_f32_4.rs
new file mode 100644
index 0000000..f3ff7e7
--- /dev/null
+++ b/tests/src/android/renderscript/cts/tanh_f32_4.rs
@@ -0,0 +1,5 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+void root(const float4 *in, float4 *out) {
+ *out = tanh(*in);
+}
\ No newline at end of file
diff --git a/tests/src/android/renderscript/cts/trunc_f32.rs b/tests/src/android/renderscript/cts/trunc_f32.rs
new file mode 100644
index 0000000..9a2845a
--- /dev/null
+++ b/tests/src/android/renderscript/cts/trunc_f32.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float* in, float* out) {
+ *out = trunc(*in);
+}
diff --git a/tests/src/android/renderscript/cts/trunc_f32_2.rs b/tests/src/android/renderscript/cts/trunc_f32_2.rs
new file mode 100644
index 0000000..f4eabff
--- /dev/null
+++ b/tests/src/android/renderscript/cts/trunc_f32_2.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float2* in, float2* out) {
+ *out = trunc(*in);
+}
diff --git a/tests/src/android/renderscript/cts/trunc_f32_3.rs b/tests/src/android/renderscript/cts/trunc_f32_3.rs
new file mode 100644
index 0000000..9f0b13f
--- /dev/null
+++ b/tests/src/android/renderscript/cts/trunc_f32_3.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float3* in, float3* out) {
+ *out = trunc(*in);
+}
diff --git a/tests/src/android/renderscript/cts/trunc_f32_4.rs b/tests/src/android/renderscript/cts/trunc_f32_4.rs
new file mode 100644
index 0000000..2524caf
--- /dev/null
+++ b/tests/src/android/renderscript/cts/trunc_f32_4.rs
@@ -0,0 +1,6 @@
+#pragma version(1)
+#pragma rs java_package_name(android.renderscript.cts)
+
+void root (const float4* in, float4* out) {
+ *out = trunc(*in);
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AcosPiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AcosPiTest.java
new file mode 100644
index 0000000..532d61a
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AcosPiTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AcosPiTest extends RSBaseCompute {
+
+ private ScriptC_acospi_f32 script_f32;
+ private ScriptC_acospi_f32_2 script_f32_2;
+ private ScriptC_acospi_f32_3 script_f32_3;
+ private ScriptC_acospi_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.acos((double)in[idx])/Math.PI);
+ }
+ }
+ return ref;
+ }
+
+ public void testAcosPiF32() {
+ script_f32 = new ScriptC_acospi_f32(mRS, mRes, R.raw.acospi_f32);
+ doF32(0xe1, 5);
+ }
+
+ public void testAcosPiF32_2() {
+ script_f32_2 = new ScriptC_acospi_f32_2(mRS, mRes, R.raw.acospi_f32_2);
+ doF32_2(0xa123, 5);
+ }
+
+ public void testAcosPiF32_3() {
+ script_f32_3 = new ScriptC_acospi_f32_3(mRS, mRes, R.raw.acospi_f32_3);
+ doF32_3(0x123, 5);
+ }
+
+ public void testAcosPiF32_4() {
+ script_f32_4 = new ScriptC_acospi_f32_4(mRS, mRes, R.raw.acospi_f32_4);
+ doF32_4(0x123ef, 5);
+ }
+}
\ No newline at end of file
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AcosTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AcosTest.java
new file mode 100644
index 0000000..4b6e0b0
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AcosTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AcosTest extends RSBaseCompute {
+ private ScriptC_acos_f32 script_f32;
+ private ScriptC_acos_f32_2 script_f32_2;
+ private ScriptC_acos_f32_3 script_f32_3;
+ private ScriptC_acos_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.acos((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testAcosF32() {
+ script_f32 = new ScriptC_acos_f32(mRS, mRes, R.raw.acos_f32);
+ doF32(0x123e, 4);
+ }
+
+ public void testAcosF32_2() {
+ script_f32_2 = new ScriptC_acos_f32_2(mRS, mRes, R.raw.acos_f32_2);
+ doF32_2(0x1e, 4);
+ }
+
+ public void testAcosF32_3() {
+ script_f32_3 = new ScriptC_acos_f32_3(mRS, mRes, R.raw.acos_f32_3);
+ doF32_3(0xeaf, 4);
+ }
+
+ public void testAcosF32_4() {
+ script_f32_4 = new ScriptC_acos_f32_4(mRS, mRes, R.raw.acos_f32_4);
+ doF32_4(0x123, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AcoshTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AcoshTest.java
new file mode 100644
index 0000000..05ca183
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AcoshTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AcoshTest extends RSBaseCompute {
+ private ScriptC_acosh_f32 script_f32;
+ private ScriptC_acosh_f32_2 script_f32_2;
+ private ScriptC_acosh_f32_3 script_f32_3;
+ private ScriptC_acosh_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ double x = (double)in[idx];
+ ref[idxRef] = (float)(2*Math.log(Math.sqrt((x+1)/2) + Math.sqrt((x-1)/2)));
+ }
+ }
+ return ref;
+ }
+
+ public void testAcoshF32() {
+ script_f32 = new ScriptC_acosh_f32(mRS, mRes, R.raw.acosh_f32);
+ doF32(0x12345678, 4);
+ }
+
+ public void testAcoshF32_2() {
+ script_f32_2 = new ScriptC_acosh_f32_2(mRS, mRes, R.raw.acosh_f32_2);
+ doF32_2(0x1234ac, 4);
+ }
+
+ public void testAcoshF32_3() {
+ script_f32_3 = new ScriptC_acosh_f32_3(mRS, mRes, R.raw.acosh_f32_3);
+ doF32_3(0x123fc78, 4);
+ }
+
+ public void testAcoshF32_4() {
+ script_f32_4 = new ScriptC_acosh_f32_4(mRS, mRes, R.raw.acosh_f32_4);
+ doF32_4(0x12def8, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AllocationCopy2DRangeTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AllocationCopy2DRangeTest.java
new file mode 100644
index 0000000..b032fd4
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AllocationCopy2DRangeTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Type;
+import java.util.Random;
+import com.android.cts.stub.R;
+
+public class AllocationCopy2DRangeTest extends RSBaseCompute {
+ private Allocation mInAllocation;
+ private Allocation mOutAllocation;
+
+ public void testAllocationCopy2DRange() {
+ ScriptC_allocationCopy2DRange mScript =
+ new ScriptC_allocationCopy2DRange(mRS, mRes, R.raw.allocationcopy2drange);
+ Random random = new Random(0x172d8ab9);
+ int width = random.nextInt(512);
+ int height = random.nextInt(512);
+
+ int[] inArray = new int[width * height];
+ int[] outArray = new int[width * height];
+
+ for (int i = 0; i < width * height; i++) {
+ inArray[i] = random.nextInt();
+ }
+
+ // Create 2D data.
+ Type.Builder typeBuilder = new Type.Builder(mRS, Element.I32(mRS));
+ typeBuilder.setX(width).setY(height);
+ mInAllocation = Allocation.createTyped(mRS, typeBuilder.create());
+ mOutAllocation = Allocation.createTyped(mRS, mInAllocation.getType());
+ mInAllocation.copy2DRangeFrom(0, 0, width, height, inArray);
+
+ mScript.set_height(height);
+ mScript.set_width(width);
+ mScript.set_mIn(mInAllocation);
+ mScript.set_mOut(mOutAllocation);
+
+ mScript.invoke_testAllocationCopy2DRange();
+ mOutAllocation.copyTo(outArray);
+ assertTrue("testAllocationCopy2DRange failed, output array does not match input",
+ compareTwoArrays(inArray, outArray, width*height));
+ }
+
+ private boolean compareTwoArrays(int[] src, int[] dest, int size) {
+ boolean result = true;
+ for (int i = 0; i < size; i++) {
+ if (src[i] != dest[i]) {
+ result = false;
+ break;
+ }
+ }
+ return result;
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AllocationResize.java b/tests/tests/renderscript/src/android/renderscript/cts/AllocationResize.java
new file mode 100644
index 0000000..b6d9a1a
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AllocationResize.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+import java.util.Random;
+
+public class AllocationResize extends RSBaseCompute {
+ private Allocation mIn;
+ private Allocation mOut;
+ private ScriptC_allocation_resize mScript;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ mScript.forEach_root(mIn, mOut);
+ }
+
+ public void testResize() {
+ mScript = new ScriptC_allocation_resize(mRS, mRes, R.raw.allocation_resize);
+ mIn = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE/2);
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE*2);
+ mIn.resize(INPUTSIZE);
+ mOut.resize(INPUTSIZE);
+
+ Random random = new Random(0x12345678);
+ int[] outArray = new int[INPUTSIZE];
+ int[] inArray = new int[INPUTSIZE];
+ for (int i = 0; i < INPUTSIZE; i++) {
+ inArray[i] = random.nextInt();
+ }
+ mIn.copy1DRangeFrom(0, INPUTSIZE, inArray);
+
+ try {
+ RSUtils.forEach(this, 0, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+
+ mOut.copyTo(outArray);
+ for (int i = 0; i < INPUTSIZE; i++) {
+ assertEquals("Incorrect value @ idx = " + i + " | ", inArray[i], outArray[i]);
+ }
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AsinPiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AsinPiTest.java
new file mode 100644
index 0000000..63e60ce
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AsinPiTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AsinPiTest extends RSBaseCompute {
+ private ScriptC_asinpi_f32 script_f32;
+ private ScriptC_asinpi_f32_2 script_f32_2;
+ private ScriptC_asinpi_f32_3 script_f32_3;
+ private ScriptC_asinpi_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.asin((double)in[idx])/Math.PI);
+ }
+ }
+ return ref;
+ }
+
+ public void testAsinPiF32() {
+ script_f32 = new ScriptC_asinpi_f32(mRS, mRes, R.raw.asinpi_f32);
+ doF32(0xa, 5);
+ }
+
+ public void testAsinPiF32_2() {
+ script_f32_2 = new ScriptC_asinpi_f32_2(mRS, mRes, R.raw.asinpi_f32_2);
+ doF32_2(0xe, 5);
+ }
+
+ public void testAsinPiF32_3() {
+ script_f32_3 = new ScriptC_asinpi_f32_3(mRS, mRes, R.raw.asinpi_f32_3);
+ doF32_3(0x1234, 5);
+ }
+
+ public void testAsinPiF32_4() {
+ script_f32_4 = new ScriptC_asinpi_f32_4(mRS, mRes, R.raw.asinpi_f32_4);
+ doF32_4(0xaf, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AsinTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AsinTest.java
new file mode 100644
index 0000000..eaf5e45
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AsinTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AsinTest extends RSBaseCompute {
+ private ScriptC_asin_f32 script_f32;
+ private ScriptC_asin_f32_2 script_f32_2;
+ private ScriptC_asin_f32_3 script_f32_3;
+ private ScriptC_asin_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.asin((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testAsinF32() {
+ script_f32 = new ScriptC_asin_f32(mRS, mRes, R.raw.asin_f32);
+ doF32(0x12efa, 4);
+ }
+
+ public void testAsinF32_2() {
+ script_f32_2 = new ScriptC_asin_f32_2(mRS, mRes, R.raw.asin_f32_2);
+ doF32_2(0x34ef, 4);
+ }
+
+ public void testAsinF32_3() {
+ script_f32_3 = new ScriptC_asin_f32_3(mRS, mRes, R.raw.asin_f32_3);
+ doF32_3(0xae31, 4);
+ }
+
+ public void testAsinF32_4() {
+ script_f32_4 = new ScriptC_asin_f32_4(mRS, mRes, R.raw.asin_f32_4);
+ doF32_4(0x341, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AsinhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AsinhTest.java
new file mode 100644
index 0000000..e4370ec
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AsinhTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AsinhTest extends RSBaseCompute {
+ private ScriptC_asinh_f32 script_f32;
+ private ScriptC_asinh_f32_2 script_f32_2;
+ private ScriptC_asinh_f32_3 script_f32_3;
+ private ScriptC_asinh_f32_4 script_f32_4;
+
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ double x = (double)in[idx];
+ ref[idxRef] = (float)(Math.log(x+Math.sqrt(1+Math.pow(x, 2))));
+ }
+ }
+ return ref;
+ }
+
+ public void testAsinhF32() {
+ script_f32 = new ScriptC_asinh_f32(mRS, mRes, R.raw.asinh_f32);
+ doF32(0x12, 4);
+ }
+
+ public void testAsinhF32_2() {
+ script_f32_2 = new ScriptC_asinh_f32_2(mRS, mRes, R.raw.asinh_f32_2);
+ doF32_2(0xead, 4);
+ }
+
+ public void testAsinhF32_3() {
+ script_f32_3 = new ScriptC_asinh_f32_3(mRS, mRes, R.raw.asinh_f32_3);
+ doF32_3(0xabc, 4);
+ }
+
+ public void testAsinhF32_4() {
+ script_f32_4 = new ScriptC_asinh_f32_4(mRS, mRes, R.raw.asinh_f32_4);
+ doF32_4(0xfea, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Atan2PiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/Atan2PiTest.java
new file mode 100644
index 0000000..62d31e6
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Atan2PiTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class Atan2PiTest extends RSBaseCompute {
+ private ScriptC_atan2pi_f32 script_f32;
+ private ScriptC_atan2pi_f32_2 script_f32_2;
+ private ScriptC_atan2pi_f32_3 script_f32_3;
+ private ScriptC_atan2pi_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = (float)(Math.atan2((double)in[idx],(double)in[idx+stride]) / Math.PI);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testAtan2PiF32() {
+ script_f32 = new ScriptC_atan2pi_f32(mRS, mRes, R.raw.atan2pi_f32);
+ ScriptField_atan2pi_float_input in = new ScriptField_atan2pi_float_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12678, 6);
+ }
+
+ public void testAtan2PiF32_2() {
+ script_f32_2 = new ScriptC_atan2pi_f32_2(mRS, mRes, R.raw.atan2pi_f32_2);
+ ScriptField_atan2pi_float2_input in = new ScriptField_atan2pi_float2_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1af45, 6);
+ }
+
+ public void testAtan2PiF32_3() {
+ script_f32_3 = new ScriptC_atan2pi_f32_3(mRS, mRes, R.raw.atan2pi_f32_3);
+ ScriptField_atan2pi_float3_input in = new ScriptField_atan2pi_float3_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1cd345, 6);
+ }
+
+ public void testAtan2PiF32_4() {
+ script_f32_4 = new ScriptC_atan2pi_f32_4(mRS, mRes, R.raw.atan2pi_f32_4);
+ ScriptField_atan2pi_float4_input in = new ScriptField_atan2pi_float4_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x1ca45, 6);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Atan2Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Atan2Test.java
new file mode 100644
index 0000000..4071e10
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Atan2Test.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import android.renderscript.Element;
+
+public class Atan2Test extends RSBaseCompute {
+ private ScriptC_atan2_f32 script_f32;
+ private ScriptC_atan2_f32_2 script_f32_2;
+ private ScriptC_atan2_f32_3 script_f32_3;
+ private ScriptC_atan2_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = (float)Math.atan2((double)in[idx],(double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testAtan2F32() {
+ script_f32 = new ScriptC_atan2_f32(mRS, mRes, R.raw.atan2_f32);
+ ScriptField_atan2_f32_in in = new ScriptField_atan2_f32_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12678, 6);
+ }
+
+ public void testAtan2F32_2() {
+ script_f32_2 = new ScriptC_atan2_f32_2(mRS, mRes, R.raw.atan2_f32_2);
+ ScriptField_atan2_f32_2_in in = new ScriptField_atan2_f32_2_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1af45, 6);
+ }
+
+ public void testAtan2F32_3() {
+ script_f32_3 = new ScriptC_atan2_f32_3(mRS, mRes, R.raw.atan2_f32_3);
+ ScriptField_atan2_f32_3_in in = new ScriptField_atan2_f32_3_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1cd345, 6);
+ }
+
+ public void testAtan2F32_4() {
+ script_f32_4 = new ScriptC_atan2_f32_4(mRS, mRes, R.raw.atan2_f32_4);
+ ScriptField_atan2_f32_4_in in = new ScriptField_atan2_f32_4_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x1ca45, 6);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AtanPiTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AtanPiTest.java
new file mode 100644
index 0000000..2997724
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AtanPiTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AtanPiTest extends RSBaseCompute {
+ private ScriptC_atanpi_f32 script_f32;
+ private ScriptC_atanpi_f32_2 script_f32_2;
+ private ScriptC_atanpi_f32_3 script_f32_3;
+ private ScriptC_atanpi_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.atan((double)in[idx])/Math.PI);
+ }
+ }
+ return ref;
+ }
+
+ public void testAtanPiF32() {
+ script_f32 = new ScriptC_atanpi_f32(mRS, mRes, R.raw.atanpi_f32);
+ doF32(0x123, 5);
+ }
+
+ public void testAtanPiF32_2() {
+ script_f32_2 = new ScriptC_atanpi_f32_2(mRS, mRes, R.raw.atanpi_f32_2);
+ doF32_2(0x12, 5);
+ }
+
+ public void testAtanPiF32_3() {
+ script_f32_3 = new ScriptC_atanpi_f32_3(mRS, mRes, R.raw.atanpi_f32_3);
+ doF32_3(0x847, 5);
+ }
+
+ public void testAtanPiF32_4() {
+ script_f32_4 = new ScriptC_atanpi_f32_4(mRS, mRes, R.raw.atanpi_f32_4);
+ doF32_4(0xfa2, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AtanTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AtanTest.java
new file mode 100644
index 0000000..f1daec3
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AtanTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AtanTest extends RSBaseCompute {
+ private ScriptC_atan_f32 script_f32;
+ private ScriptC_atan_f32_2 script_f32_2;
+ private ScriptC_atan_f32_3 script_f32_3;
+ private ScriptC_atan_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.atan((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testAtanF32() {
+ script_f32 = new ScriptC_atan_f32(mRS, mRes, R.raw.atan_f32);
+ doF32(0x12a, 5);
+ }
+
+ public void testAtanF32_2() {
+ script_f32_2 = new ScriptC_atan_f32_2(mRS, mRes, R.raw.atan_f32_2);
+ doF32_2(0xad, 5);
+ }
+
+ public void testAtanF32_3() {
+ script_f32_3 = new ScriptC_atan_f32_3(mRS, mRes, R.raw.atan_f32_3);
+ doF32_3(0xafe, 5);
+ }
+
+ public void testAtanF32_4() {
+ script_f32_4 = new ScriptC_atan_f32_4(mRS, mRes, R.raw.atan_f32_4);
+ doF32_4(0x1238, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/AtanhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/AtanhTest.java
new file mode 100644
index 0000000..0ff35e9
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/AtanhTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class AtanhTest extends RSBaseCompute {
+ private ScriptC_atanh_f32 script_f32;
+ private ScriptC_atanh_f32_2 script_f32_2;
+ private ScriptC_atanh_f32_3 script_f32_3;
+ private ScriptC_atanh_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ double x = (double)in[idx];
+ ref[idxRef] = (float)((Math.log(1+x) - Math.log(1-x))/2);
+ }
+ }
+ return ref;
+ }
+
+ public void testAtanhF32() {
+ script_f32 = new ScriptC_atanh_f32(mRS, mRes, R.raw.atanh_f32);
+ doF32(0xace, 5);
+ }
+
+ public void testAtanhF32_2() {
+ script_f32_2 = new ScriptC_atanh_f32_2(mRS, mRes, R.raw.atanh_f32_2);
+ doF32_2(0xdae, 5);
+ }
+
+ public void testAtanhF32_3() {
+ script_f32_3 = new ScriptC_atanh_f32_3(mRS, mRes, R.raw.atanh_f32_3);
+ doF32_3(0x123, 5);
+ }
+
+ public void testAtanhF32_4() {
+ script_f32_4 = new ScriptC_atanh_f32_4(mRS, mRes, R.raw.atanh_f32_4);
+ doF32_4(0x6480, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CbrtTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CbrtTest.java
new file mode 100644
index 0000000..2db4706
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CbrtTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class CbrtTest extends RSBaseCompute {
+ private ScriptC_cbrt_f32 mscript_f32;
+ private ScriptC_cbrt_f32_2 mscript_f32_2;
+ private ScriptC_cbrt_f32_3 mscript_f32_3;
+ private ScriptC_cbrt_f32_4 mscript_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ mscript_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ mscript_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ mscript_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ mscript_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.cbrt((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testCbrtF32() {
+ mscript_f32 = new ScriptC_cbrt_f32(mRS, mRes, R.raw.cbrt_f32);
+ doF32(0xabe, 2);
+ }
+
+ public void testCbrtF32_2() {
+ mscript_f32_2 = new ScriptC_cbrt_f32_2(mRS, mRes, R.raw.cbrt_f32_2);
+ doF32_2(0x78, 2);
+ }
+
+ public void testCbrtF32_3() {
+ mscript_f32_3 = new ScriptC_cbrt_f32_3(mRS, mRes, R.raw.cbrt_f32_3);
+ doF32_3(0x1e, 2);
+ }
+
+ public void testCbrtF32_4() {
+ mscript_f32_4 = new ScriptC_cbrt_f32_4(mRS, mRes, R.raw.cbrt_f32_4);
+ doF32_4(0xfe2, 2);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CeilTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CeilTest.java
new file mode 100644
index 0000000..dfaee00
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CeilTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class CeilTest extends RSBaseCompute {
+ private ScriptC_ceil_f32 mscript_f32;
+ private ScriptC_ceil_f32_2 mscript_f32_2;
+ private ScriptC_ceil_f32_3 mscript_f32_3;
+ private ScriptC_ceil_f32_4 mscript_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ mscript_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ mscript_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ mscript_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ mscript_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.ceil((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testCeilF32() {
+ mscript_f32 = new ScriptC_ceil_f32(mRS, mRes, R.raw.ceil_f32);
+ doF32(0x12345ace, 0);
+ }
+
+ public void testCeilF32_2() {
+ mscript_f32_2 = new ScriptC_ceil_f32_2(mRS, mRes, R.raw.ceil_f32_2);
+ doF32_2(0x1ac478, 0);
+ }
+
+ public void testCeilF32_3() {
+ mscript_f32_3 = new ScriptC_ceil_f32_3(mRS, mRes, R.raw.ceil_f32_3);
+ doF32_3(0xacef, 0);
+ }
+
+ public void testCeilF32_4() {
+ mscript_f32_4 = new ScriptC_ceil_f32_4(mRS, mRes, R.raw.ceil_f32_4);
+ doF32_4(0xef12, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/ClearObjectTest.java b/tests/tests/renderscript/src/android/renderscript/cts/ClearObjectTest.java
new file mode 100644
index 0000000..6a974a6
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/ClearObjectTest.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Type;
+import android.renderscript.Sampler;
+import android.renderscript.Script;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class ClearObjectTest extends RSBaseCompute {
+ int ObjectNum = 1;
+ static final int TEST_ID_ELEMENT = 0;
+ static final int TEST_ID_TYPE = 1;
+ static final int TEST_ID_ALLOCATION = 2;
+ static final int TEST_ID_SAMPLER = 3;
+ static final int TEST_ID_SCRIPT = 4;
+ private ScriptC_clear_object_element ms_element;
+ private ScriptC_clear_object_type ms_type;
+ private ScriptC_clear_object_allocation ms_allcation;
+ private ScriptC_clear_object_sampler ms_sampler;
+ private ScriptC_clear_object_script ms_script;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_ID_ELEMENT:
+ ms_element.forEach_root(mOut);
+ break;
+ case TEST_ID_TYPE:
+ ms_type.forEach_root(mOut);
+ break;
+ case TEST_ID_ALLOCATION:
+ ms_allcation.forEach_root(mOut);
+ break;
+ case TEST_ID_SAMPLER:
+ ms_sampler.forEach_root(mOut);
+ break;
+ case TEST_ID_SCRIPT:
+ ms_script.forEach_root(mOut);
+ break;
+ }
+ }
+
+ public void testClearObjectElement() {
+ ms_element = new ScriptC_clear_object_element(mRS, mRes, R.raw.clear_object_element);
+ Element element = Element.BOOLEAN(mRS);
+ Allocation mIn = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ms_element.set_element(element);
+ try {
+ RSUtils.forEach(this, TEST_ID_ELEMENT, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ for(int i = 0; i < ObjectNum; i++)
+ assertEquals(tmpArray[i], 1);
+ }
+
+ public void testclearObjectType() {
+ ms_type = new ScriptC_clear_object_type(mRS, mRes, R.raw.clear_object_type);
+ Type type= new Type.Builder(mRS, Element.I8(mRS)).setX(1).create();
+ Allocation mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation mIn = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ms_type.set_type(type);
+
+ try {
+ RSUtils.forEach(this, TEST_ID_TYPE, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ for(int i = 0; i < ObjectNum; i++)
+ assertEquals(tmpArray[i], 1);
+ }
+
+ public void testclearObjectAllocation() {
+ ms_allcation = new ScriptC_clear_object_allocation(mRS, mRes,
+ R.raw.clear_object_allocation);
+ Allocation mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation mIn = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation allocation = Allocation.createTyped(mRS, mIn.getType());
+ ms_allcation.set_allocation(allocation);
+ try {
+ RSUtils.forEach(this, TEST_ID_ALLOCATION, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ for(int i = 0; i < ObjectNum; i++)
+ assertEquals(tmpArray[i], 1);
+ }
+
+ public void testclearObjectSampler() {
+ ms_sampler = new ScriptC_clear_object_sampler(mRS, mRes, R.raw.clear_object_sampler);
+ Sampler sampler = new Sampler.Builder(mRS).create();
+ Allocation mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation mIn = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ms_sampler.set_sampler(sampler);
+ try {
+ RSUtils.forEach(this, TEST_ID_SAMPLER, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ for(int i = 0; i < ObjectNum; i++)
+ assertEquals(tmpArray[i], 1);
+ }
+
+ public void testclearObjectScript() {
+ ms_script = new ScriptC_clear_object_script(mRS, mRes, R.raw.clear_object_script);
+ Script script = new ScriptC_clear_object_type(mRS, mRes, R.raw.clear_object_element);
+ Allocation mIn = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ Allocation mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ms_script.set_script(script);
+ try {
+ RSUtils.forEach(this, TEST_ID_SCRIPT, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ for(int i = 0; i < ObjectNum; i++)
+ assertEquals(tmpArray[i], 1);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CopysignTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CopysignTest.java
new file mode 100644
index 0000000..84e07ed
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CopysignTest.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class CopysignTest extends RSBaseCompute {
+ private ScriptC_copysign_f32 ms_f32;
+ private ScriptC_copysign_f32_2 ms_f32_2;
+ private ScriptC_copysign_f32_3 ms_f32_3;
+ private ScriptC_copysign_f32_4 ms_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ ms_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ ms_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ ms_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ ms_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ int vec_size = stride - skip;
+ float[] ref = new float[vec_size * input_size];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < vec_size; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i*vec_size + j] = Math.copySign(in[idx], in[idx + stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ /**
+ * Tests copysign(float, float).
+ */
+ public void testCopysignF32() {
+ ms_f32 = new ScriptC_copysign_f32(mRS, mRes, R.raw.copysign_f32);
+ ScriptField_copysign_f32_input in = new ScriptField_copysign_f32_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12ac5678, 0);
+ }
+
+ /**
+ * Tests copysign(float2, float2).
+ */
+ public void testCopysignF32_2() {
+ ms_f32_2 = new ScriptC_copysign_f32_2(mRS, mRes, R.raw.copysign_f32_2);
+ ScriptField_copysign_f32_2_input in =
+ new ScriptField_copysign_f32_2_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x12fe5678, 0);
+ }
+
+ /**
+ * Tests copysign(float3, float3).
+ */
+ public void testCopysignF32_3() {
+ ms_f32_3 = new ScriptC_copysign_f32_3(mRS, mRes, R.raw.copysign_f32_3);
+ ScriptField_copysign_f32_3_input in =
+ new ScriptField_copysign_f32_3_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1c345678, 0);
+ }
+
+ /**
+ * Tests copysign(float4, float4).
+ */
+ public void testCopysignF32_4() {
+ ms_f32_4 = new ScriptC_copysign_f32_4(mRS, mRes, R.raw.copysign_f32_4);
+ ScriptField_copysign_f32_4_input in =
+ new ScriptField_copysign_f32_4_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x123a5f7d, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CosTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CosTest.java
new file mode 100644
index 0000000..ae2bac4
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CosTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class CosTest extends RSBaseCompute {
+ private ScriptC_cos_f32 script_f32;
+ private ScriptC_cos_f32_2 script_f32_2;
+ private ScriptC_cos_f32_3 script_f32_3;
+ private ScriptC_cos_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.cos((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testCosF32() {
+ script_f32 = new ScriptC_cos_f32(mRS, mRes, R.raw.cos_f32);
+ doF32(0xe, 4);
+ }
+
+ public void testCosF32_2() {
+ script_f32_2 = new ScriptC_cos_f32_2(mRS, mRes, R.raw.cos_f32_2);
+ doF32_2(0xb, 4);
+ }
+
+ public void testCosF32_3() {
+ script_f32_3 = new ScriptC_cos_f32_3(mRS, mRes, R.raw.cos_f32_3);
+ doF32_3(0x12a, 4);
+ }
+
+ public void testCosF32_4() {
+ script_f32_4 = new ScriptC_cos_f32_4(mRS, mRes, R.raw.cos_f32_4);
+ doF32_4(0x98a, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CoshTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CoshTest.java
new file mode 100644
index 0000000..eafa3b0
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CoshTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import com.android.cts.stub.R;
+import android.renderscript.RSRuntimeException;
+
+public class CoshTest extends RSBaseCompute {
+
+ private ScriptC_cosh_f32 ms_f32;
+ private ScriptC_cosh_f32_2 ms_f32_2;
+ private ScriptC_cosh_f32_3 ms_f32_3;
+ private ScriptC_cosh_f32_4 ms_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ ms_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ ms_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ ms_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ ms_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.cosh((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testCoshF32() {
+ ms_f32 = new ScriptC_cosh_f32(mRS, mRes, R.raw.cosh_f32);
+ doF32(0xfe, 4);
+ }
+
+ public void testCoshF32_2() {
+ ms_f32_2 = new ScriptC_cosh_f32_2(mRS, mRes, R.raw.cosh_f32_2);
+ doF32_2(0x71, 4);
+ }
+
+ public void testCoshF32_3() {
+ ms_f32_3 = new ScriptC_cosh_f32_3(mRS, mRes, R.raw.cosh_f32_3);
+ doF32_3(0xa, 4);
+ }
+
+ public void testCoshF32_4() {
+ ms_f32_4 = new ScriptC_cosh_f32_4(mRS, mRes, R.raw.cosh_f32_4);
+ doF32_4(0xabe, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/CrossTest.java b/tests/tests/renderscript/src/android/renderscript/cts/CrossTest.java
new file mode 100644
index 0000000..3c8c212
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/CrossTest.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+
+public class CrossTest extends RSBaseCompute {
+ private ScriptC_cross_f32_3 script_f32_3;
+ private ScriptC_cross_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ int idx= i * stride * 2;
+ int idxRef = i * (stride - skip);
+ ref[idxRef + 0] = in[idx+1] * in[idx+2+stride] - in[idx+2] * in[idx+1+stride];
+ ref[idxRef + 1] = in[idx+2] * in[idx+0+stride] - in[idx+0] * in[idx+2+stride];
+ ref[idxRef + 2] = in[idx+0] * in[idx+1+stride] - in[idx+1] * in[idx+0+stride];
+ if (skip == 1)
+ ref[idxRef + 3] = 0.f;
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ /**
+ * cross test for float3
+ */
+ public void testCrossF32_3() {
+ script_f32_3 = new ScriptC_cross_f32_3(mRS, mRes, R.raw.cross_f32_3);
+ ScriptField__cross_f32_3_struct in = new ScriptField__cross_f32_3_struct(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x12345678, 0);
+ }
+
+ /**
+ * cross test for float4
+ */
+ public void testCrossF32_4() {
+ script_f32_4 = new ScriptC_cross_f32_4(mRS, mRes, R.raw.cross_f32_4);
+ ScriptField__cross_f32_4_struct in = new ScriptField__cross_f32_4_struct(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x12ac5678, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/DegreesTest.java b/tests/tests/renderscript/src/android/renderscript/cts/DegreesTest.java
new file mode 100644
index 0000000..83496ff
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/DegreesTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class DegreesTest extends RSBaseCompute {
+ private ScriptC_deg_f32 script_f32;
+ private ScriptC_deg_f32_2 script_f32_2;
+ private ScriptC_deg_f32_3 script_f32_3;
+ private ScriptC_deg_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ double val = (double)in[idx] * (180.0 / Math.PI);
+ ref[idxRef] = (float)val;
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * degrees test for float
+ */
+ public void testDegreesF32() {
+ script_f32 = new ScriptC_deg_f32(mRS, mRes, R.raw.deg_f32);
+ doF32(0x12345678, 3);
+ }
+
+ /**
+ * degrees test for float2
+ */
+ public void testDegreesF32_2() {
+ script_f32_2 = new ScriptC_deg_f32_2(mRS, mRes, R.raw.deg_f32_2);
+ doF32_2(0x12353678, 3);
+ }
+
+ /**
+ * degrees test for float3
+ */
+ public void testDegreesF32_3() {
+ script_f32_3 = new ScriptC_deg_f32_3(mRS, mRes, R.raw.deg_f32_3);
+ doF32_3(0x12312678, 3);
+ }
+
+ /**
+ * degrees test for float4
+ */
+ public void testDegreesF32_4() {
+ script_f32_4 = new ScriptC_deg_f32_4(mRS, mRes, R.raw.deg_f32_4);
+ doF32_4(0x12675678, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Exp10Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Exp10Test.java
new file mode 100644
index 0000000..679dd7a
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Exp10Test.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class Exp10Test extends RSBaseCompute {
+ private ScriptC_exp10_f32 script_f32;
+ private ScriptC_exp10_f32_2 script_f32_2;
+ private ScriptC_exp10_f32_3 script_f32_3;
+ private ScriptC_exp10_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.pow(10, (double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testExp10F32() {
+ script_f32 = new ScriptC_exp10_f32(mRS, mRes, R.raw.exp10_f32);
+ doF32(0x81, 3);
+ }
+
+ public void testExp10F32_2() {
+ script_f32_2 = new ScriptC_exp10_f32_2(mRS, mRes, R.raw.exp10_f32_2);
+ doF32_2(0xa42, 3);
+ }
+
+ public void testExp10F32_3() {
+ script_f32_3 = new ScriptC_exp10_f32_3(mRS, mRes, R.raw.exp10_f32_3);
+ doF32_3(0xace2, 3);
+ }
+
+ public void testExp10F32_4() {
+ script_f32_4 = new ScriptC_exp10_f32_4(mRS, mRes, R.raw.exp10_f32_4);
+ doF32_4(0x918, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Exp2Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Exp2Test.java
new file mode 100644
index 0000000..4b4918d
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Exp2Test.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class Exp2Test extends RSBaseCompute {
+ private ScriptC_exp2_f32 script_f32;
+ private ScriptC_exp2_f32_2 script_f32_2;
+ private ScriptC_exp2_f32_3 script_f32_3;
+ private ScriptC_exp2_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.pow(2, (double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testExp2F32() {
+ script_f32 = new ScriptC_exp2_f32(mRS, mRes, R.raw.exp2_f32);
+ doF32(0xa6, 3);
+ }
+
+ public void testExp2F32_2() {
+ script_f32_2 = new ScriptC_exp2_f32_2(mRS, mRes, R.raw.exp2_f32_2);
+ doF32_2(0xab2, 3);
+ }
+
+ public void testExp2F32_3() {
+ script_f32_3 = new ScriptC_exp2_f32_3(mRS, mRes, R.raw.exp2_f32_3);
+ doF32_3(0x617a, 3);
+ }
+
+ public void testExp2F32_4() {
+ script_f32_4 = new ScriptC_exp2_f32_4(mRS, mRes, R.raw.exp2_f32_4);
+ doF32_4(0xabc3, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/ExpTest.java b/tests/tests/renderscript/src/android/renderscript/cts/ExpTest.java
new file mode 100644
index 0000000..c2789e8
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/ExpTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class ExpTest extends RSBaseCompute {
+ private ScriptC_exp_f32 script_f32;
+ private ScriptC_exp_f32_2 script_f32_2;
+ private ScriptC_exp_f32_3 script_f32_3;
+ private ScriptC_exp_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.exp((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testExpF32() {
+ script_f32 = new ScriptC_exp_f32(mRS, mRes, R.raw.exp_f32);
+ doF32(0xa28, 3);
+ }
+
+ public void testExpF32_2() {
+ script_f32_2 = new ScriptC_exp_f32_2(mRS, mRes, R.raw.exp_f32_2);
+ doF32_2(0xfeb4, 3);
+ }
+
+ public void testExpF32_3() {
+ script_f32_3 = new ScriptC_exp_f32_3(mRS, mRes, R.raw.exp_f32_3);
+ doF32_3(0xab2, 3);
+ }
+
+ public void testExpF32_4() {
+ script_f32_4 = new ScriptC_exp_f32_4(mRS, mRes, R.raw.exp_f32_4);
+ doF32_4(0x7a6, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Expm1Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Expm1Test.java
new file mode 100644
index 0000000..4379462
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Expm1Test.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class Expm1Test extends RSBaseCompute {
+ private ScriptC_expm1_f32 script_f32;
+ private ScriptC_expm1_f32_2 script_f32_2;
+ private ScriptC_expm1_f32_3 script_f32_3;
+ private ScriptC_expm1_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.expm1((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testExpm1F32() {
+ script_f32 = new ScriptC_expm1_f32(mRS, mRes, R.raw.expm1_f32);
+ doF32(0xa29, 3);
+ }
+
+ public void testExpm1F32_2() {
+ script_f32_2 = new ScriptC_expm1_f32_2(mRS, mRes, R.raw.expm1_f32_2);
+ doF32_2(0x8a2, 3);
+ }
+
+ public void testExpm1F32_3() {
+ script_f32_3 = new ScriptC_expm1_f32_3(mRS, mRes, R.raw.expm1_f32_3);
+ doF32_3(0xa7c, 3);
+ }
+
+ public void testExpm1F32_4() {
+ script_f32_4 = new ScriptC_expm1_f32_4(mRS, mRes, R.raw.expm1_f32_4);
+ doF32_4(0x81a, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FabsTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FabsTest.java
new file mode 100644
index 0000000..481e4ed
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FabsTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FabsTest extends RSBaseCompute {
+ private ScriptC_fabs_f32 script_f32;
+ private ScriptC_fabs_f32_2 script_f32_2;
+ private ScriptC_fabs_f32_3 script_f32_3;
+ private ScriptC_fabs_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = Math.abs(in[idx]);
+ }
+ }
+ return ref;
+ }
+
+ public void testfabsF32() {
+ script_f32 = new ScriptC_fabs_f32(mRS, mRes, R.raw.fabs_f32);
+ doF32(0xa, 0);
+ }
+
+ public void testfabsF32_2() {
+ script_f32_2 = new ScriptC_fabs_f32_2(mRS, mRes, R.raw.fabs_f32_2);
+ doF32_2(0xb, 0);
+ }
+
+ public void testfabsF32_3() {
+ script_f32_3 = new ScriptC_fabs_f32_3(mRS, mRes, R.raw.fabs_f32_3);
+ doF32_3(0xc, 0);
+ }
+
+ public void testfabsF32_4() {
+ script_f32_4 = new ScriptC_fabs_f32_4(mRS, mRes, R.raw.fabs_f32_4);
+ doF32_4(0xd, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FdimTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FdimTest.java
new file mode 100644
index 0000000..ee19d38
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FdimTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FdimTest extends RSBaseCompute {
+ private ScriptC_fdim_f32 script_f32;
+ private ScriptC_fdim_f32_2 script_f32_2;
+ private ScriptC_fdim_f32_3 script_f32_3;
+ private ScriptC_fdim_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = (float)(Math.max(0.0, (double)in[idx] - (double)in[idx+stride]));
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testfdimF32() {
+ script_f32 = new ScriptC_fdim_f32(mRS, mRes, R.raw.fdim_f32);
+ ScriptField_fdim_f32_input floatArray = new ScriptField_fdim_f32_input(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32(0x12678, 0);
+ }
+
+ public void testfdimF32_2() {
+ script_f32_2 = new ScriptC_fdim_f32_2(mRS, mRes, R.raw.fdim_f32_2);
+ ScriptField_fdim_f32_2_input floatArray = new ScriptField_fdim_f32_2_input(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_2(0x1af45, 0);
+ }
+
+ public void testfdimF32_3() {
+ script_f32_3 = new ScriptC_fdim_f32_3(mRS, mRes, R.raw.fdim_f32_3);
+ ScriptField_fdim_f32_3_input floatArray = new ScriptField_fdim_f32_3_input(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_3(0x1cd345, 0);
+ }
+
+ public void testfdimF32_4() {
+ script_f32_4 = new ScriptC_fdim_f32_4(mRS, mRes, R.raw.fdim_f32_4);
+ ScriptField_fdim_f32_4_input floatArray = new ScriptField_fdim_f32_4_input(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_4(0x1ca45, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FloorTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FloorTest.java
new file mode 100644
index 0000000..3068d09
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FloorTest.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FloorTest extends RSBaseCompute {
+ private ScriptC_floor_f32 script_f32;
+ private ScriptC_floor_f32_2 script_f32_2;
+ private ScriptC_floor_f32_3 script_f32_3;
+ private ScriptC_floor_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.floor((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testfloorF32() {
+ script_f32 = new ScriptC_floor_f32(mRS, mRes, R.raw.floor_f32);
+ doF32(0xa, 0);
+ }
+
+ public void testfloorF32_2() {
+ script_f32_2 = new ScriptC_floor_f32_2(mRS, mRes, R.raw.floor_f32_2);
+ doF32_2(0xb, 0);
+ }
+
+ public void testfloorF32_3() {
+ script_f32_3 = new ScriptC_floor_f32_3(mRS, mRes, R.raw.floor_f32_3);
+ doF32_3(0xef1, 0);
+ }
+
+ public void testfloorF32_4() {
+ script_f32_4 = new ScriptC_floor_f32_4(mRS, mRes, R.raw.floor_f32_4);
+ doF32_4(0xefa12, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FmaTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FmaTest.java
new file mode 100644
index 0000000..e68d9a1
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FmaTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FmaTest extends RSBaseCompute {
+ private ScriptC_fma_f32 script_f32;
+ private ScriptC_fma_f32_2 script_f32_2;
+ private ScriptC_fma_f32_3 script_f32_3;
+ private ScriptC_fma_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 3 + j;
+ ref[i * (stride - skip) + j] = (float)((double)in[idx] * (double)in[idx+stride] + (double)in[idx+stride*2]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*3];
+ }
+
+ public void testFmaF32() {
+ script_f32 = new ScriptC_fma_f32(mRS, mRes, R.raw.fma_f32);
+ ScriptField_Floats floatArray = new ScriptField_Floats(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32(0xea1, 0);
+ }
+
+ public void testFmaF32_2() {
+ script_f32_2 = new ScriptC_fma_f32_2(mRS, mRes, R.raw.fma_f32_2);
+ ScriptField_Floats2 floatArray = new ScriptField_Floats2(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_2(0x12a, 0);
+ }
+
+ public void testFmaF32_3() {
+ script_f32_3 = new ScriptC_fma_f32_3(mRS, mRes, R.raw.fma_f32_3);
+ ScriptField_Floats3 floatArray = new ScriptField_Floats3(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_3(0xfae, 0);
+ }
+
+ public void testFmaF32_4() {
+ script_f32_4 = new ScriptC_fma_f32_4(mRS, mRes, R.raw.fma_f32_4);
+ ScriptField_Floats4 floatArray = new ScriptField_Floats4(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_4(0x87a, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FmaxTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FmaxTest.java
new file mode 100644
index 0000000..5c2a9d3
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FmaxTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FmaxTest extends RSBaseCompute {
+ private ScriptC_fmax_f32 script_f32;
+ private ScriptC_fmax_f32_2 script_f32_2;
+ private ScriptC_fmax_f32_3 script_f32_3;
+ private ScriptC_fmax_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation max, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = Math.max(in[idx], in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testfmaxF32() {
+ script_f32 = new ScriptC_fmax_f32(mRS, mRes, R.raw.fmax_f32);
+ ScriptField_fmax_f32_in in = new ScriptField_fmax_f32_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12678, 0);
+ }
+
+ public void testfmaxF32_2() {
+ script_f32_2 = new ScriptC_fmax_f32_2(mRS, mRes, R.raw.fmax_f32_2);
+ ScriptField_fmax_f32_2_in in = new ScriptField_fmax_f32_2_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x12ace, 0);
+ }
+
+ public void testfmaxF32_3() {
+ script_f32_3 = new ScriptC_fmax_f32_3(mRS, mRes, R.raw.fmax_f32_3);
+ ScriptField_fmax_f32_3_in in = new ScriptField_fmax_f32_3_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x12e8, 0);
+ }
+
+ public void testfmaxF32_4() {
+ script_f32_4 = new ScriptC_fmax_f32_4(mRS, mRes, R.raw.fmax_f32_4);
+ ScriptField_fmax_f32_4_in in = new ScriptField_fmax_f32_4_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0xeac, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FminTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FminTest.java
new file mode 100644
index 0000000..179edd7
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FminTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FminTest extends RSBaseCompute {
+ private ScriptC_fmin_f32 script_f32;
+ private ScriptC_fmin_f32_2 script_f32_2;
+ private ScriptC_fmin_f32_3 script_f32_3;
+ private ScriptC_fmin_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = Math.min(in[idx], in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testfminF32() {
+ script_f32 = new ScriptC_fmin_f32(mRS, mRes, R.raw.fmin_f32);
+ ScriptField_fmin_f32_in in = new ScriptField_fmin_f32_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12678, 0);
+ }
+
+ public void testfminF32_2() {
+ script_f32_2 = new ScriptC_fmin_f32_2(mRS, mRes, R.raw.fmin_f32_2);
+ ScriptField_fmin_f32_2_in in = new ScriptField_fmin_f32_2_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x12ace, 0);
+ }
+
+ public void testfminF32_3() {
+ script_f32_3 = new ScriptC_fmin_f32_3(mRS, mRes, R.raw.fmin_f32_3);
+ ScriptField_fmin_f32_3_in in = new ScriptField_fmin_f32_3_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x12e8, 0);
+ }
+
+ public void testfminF32_4() {
+ script_f32_4 = new ScriptC_fmin_f32_4(mRS, mRes, R.raw.fmin_f32_4);
+ ScriptField_fmin_f32_4_in in = new ScriptField_fmin_f32_4_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0xeac, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/FmodTest.java b/tests/tests/renderscript/src/android/renderscript/cts/FmodTest.java
new file mode 100644
index 0000000..0cd49b5
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/FmodTest.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class FmodTest extends RSBaseCompute {
+ private ScriptC_fmod_f32 script_f32;
+ private ScriptC_fmod_f32_2 script_f32_2;
+ private ScriptC_fmod_f32_3 script_f32_3;
+ private ScriptC_fmod_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = (float)((double)in[idx] % (double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ /**
+ * This method is used for testing the fmod() function with F32
+ */
+ public void testfmodF32() {
+ script_f32 = new ScriptC_fmod_f32(mRS, mRes, R.raw.fmod_f32);
+ ScriptField_fmod_input_f32 floatArray = new ScriptField_fmod_input_f32(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32(0x12345678, 0);
+ }
+
+ /**
+ * This method is used for testing the fmod() function with F32_2
+ */
+ public void testfmodF32_2() {
+ script_f32_2 = new ScriptC_fmod_f32_2(mRS, mRes, R.raw.fmod_f32_2);
+ ScriptField_fmod_input_f32_2 floatArray = new ScriptField_fmod_input_f32_2(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_2(0x12345, 0);
+ }
+
+ /**
+ * This method is used for testing the fmod() function with F32_3
+ */
+ public void testfmodF32_3() {
+ script_f32_3 = new ScriptC_fmod_f32_3(mRS, mRes, R.raw.fmod_f32_3);
+ ScriptField_fmod_input_f32_3 floatArray = new ScriptField_fmod_input_f32_3(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_3(0x12345, 0);
+ }
+
+ /**
+ * This method is used for testing the fmod() function with F32_4
+ */
+ public void testfmodF32_4() {
+ script_f32_4 = new ScriptC_fmod_f32_4(mRS, mRes, R.raw.fmod_f32_4);
+ ScriptField_fmod_input_f32_4 floatArray = new ScriptField_fmod_input_f32_4(mRS, INPUTSIZE);
+ mIn = floatArray.getAllocation();
+ doF32_4(0x12345, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/GetAllocationTest.java b/tests/tests/renderscript/src/android/renderscript/cts/GetAllocationTest.java
new file mode 100644
index 0000000..e447224
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/GetAllocationTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+import java.util.Random;
+
+public class GetAllocationTest extends RSBaseCompute {
+
+ public void testGetAllocation () {
+ Random random = new Random(0x827492ab);
+ int[] tempArray = new int[INPUTSIZE];
+ for (int i = 0; i < INPUTSIZE; ++i) {
+ tempArray[i] = random.nextInt();
+ }
+ ScriptC_get_allocation ms =
+ new ScriptC_get_allocation(mRS, mRes, R.raw.get_allocation);
+
+ Allocation mTemp = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE);
+ mTemp.copyFrom(tempArray);
+ Allocation mOut = Allocation.createTyped(mRS, mTemp.getType());
+
+ ms.bind_pointer(mTemp);
+ ms.set_script(ms);
+ ms.set_alloc_out(mOut);
+ ms.invoke_start();
+
+ int [] out = new int[INPUTSIZE];
+ mOut.copyTo(out);
+ for (int i = 0; i < tempArray.length; i++) {
+ assertEquals("Incorrect value @ idx = " + i + " | ",
+ tempArray[i],
+ out[i]);
+ }
+ }
+
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/GetElementAt.java b/tests/tests/renderscript/src/android/renderscript/cts/GetElementAt.java
new file mode 100644
index 0000000..a9be1bc
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/GetElementAt.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Type;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+import java.util.Random;
+
+public class GetElementAt extends RSBaseCompute {
+ static final int TEST_ID_X = 0;
+ static final int TEST_ID_XY = 1;
+ private Allocation mOut;
+ private Allocation gIn;
+ private int[] in;
+ private int[] out;
+ ScriptC_get_element_at_x script_x;
+ ScriptC_get_element_at_x_y script_xy;
+
+ @Override
+ public void forEach(int testId, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_ID_X:
+ script_x.forEach_root(mOut);
+ break;
+ case TEST_ID_XY:
+ script_xy.forEach_root(mOut);
+ break;
+ }
+ }
+
+ private void setupArrays(int size) {
+ Random random = new Random(0x12345678);
+ in = new int[size];
+ for (int i = 0; i < size; ++i) {
+ in[i] = random.nextInt(100);
+ }
+ out = new int[size];
+ }
+
+ public void testX () {
+ setupArrays(INPUTSIZE);
+ script_x = new ScriptC_get_element_at_x(mRS, mRes, R.raw.get_element_at_x);
+ gIn = Allocation.createSized(mRS, Element.U32(mRS), INPUTSIZE);
+ gIn.copyFrom(in);
+ mOut = Allocation.createTyped(mRS, gIn.getType());
+ script_x.set_gIn(gIn);
+ try {
+ RSUtils.forEach(this, TEST_ID_X, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ mOut.copyTo(out);
+ for (int k = 0; k < INPUTSIZE; ++k) {
+ assertEquals("idx = " + k, in[k], out[k]);
+ }
+ }
+
+ public void testXY () {
+ setupArrays(INPUTSIZE*INPUTSIZE);
+ script_xy = new ScriptC_get_element_at_x_y(mRS, mRes, R.raw.get_element_at_x_y);
+ Type.Builder builder = new Type.Builder(mRS, Element.U32(mRS));
+ builder.setX(INPUTSIZE);
+ builder.setY(INPUTSIZE);
+ Type type = builder.create();
+ gIn = Allocation.createTyped(mRS, type);
+ gIn.copyFrom(in);
+ mOut = Allocation.createTyped(mRS, gIn.getType());
+ script_xy.set_gIn(gIn);
+ try {
+ RSUtils.forEach(this, TEST_ID_XY, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ mOut.copyTo(out);
+ for (int k = 0; k < INPUTSIZE*INPUTSIZE; ++k) {
+ assertEquals("idx = " + k, in[k], out[k]);
+ }
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/HypotTest.java b/tests/tests/renderscript/src/android/renderscript/cts/HypotTest.java
new file mode 100644
index 0000000..ffe0399
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/HypotTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class HypotTest extends RSBaseCompute {
+ private ScriptC_hypot_f32 script_f32;
+ private ScriptC_hypot_f32_2 script_f32_2;
+ private ScriptC_hypot_f32_3 script_f32_3;
+ private ScriptC_hypot_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = (float)Math.hypot((double)in[idx], (double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testHypotF32() {
+ script_f32 = new ScriptC_hypot_f32(mRS, mRes, R.raw.hypot_f32);
+ ScriptField_hypot_f32_in in = new ScriptField_hypot_f32_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x123678, 4);
+ }
+
+ public void testHypotF32_2() {
+ script_f32_2 = new ScriptC_hypot_f32_2(mRS, mRes, R.raw.hypot_f32_2);
+ ScriptField_hypot_f32_2_in in = new ScriptField_hypot_f32_2_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1234a5, 4);
+ }
+
+ public void testHypotF32_3() {
+ script_f32_3 = new ScriptC_hypot_f32_3(mRS, mRes, R.raw.hypot_f32_3);
+ ScriptField_hypot_f32_3_in in = new ScriptField_hypot_f32_3_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1af345, 4);
+ }
+
+ public void testHypotF32_4() {
+ script_f32_4 = new ScriptC_hypot_f32_4(mRS, mRes, R.raw.hypot_f32_4);
+ ScriptField_hypot_f32_4_in in = new ScriptField_hypot_f32_4_in(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x12ce45, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/InitTest.java b/tests/tests/renderscript/src/android/renderscript/cts/InitTest.java
new file mode 100644
index 0000000..ef36927
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/InitTest.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class InitTest extends RSBaseCompute {
+ private Allocation mIn;
+ private Allocation mOut;
+ private ScriptC_init_test script;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ script.forEach_root(mIn, mOut);
+ }
+
+ public void testInitTest() {
+ script = new ScriptC_init_test(mRS, mRes, R.raw.init_test);
+ float[] ref = new float[INPUTSIZE];
+ float[] in = new float[INPUTSIZE];
+ float[] out = new float[INPUTSIZE];
+ mIn = Allocation.createSized(mRS, Element.F32(mRS), INPUTSIZE);
+ mOut= Allocation.createSized(mRS, Element.F32(mRS), INPUTSIZE);
+ for (int i = 0 ;i < INPUTSIZE; i++) {
+ ref[i] = 2.0f;
+ in[i] = 0;
+ }
+
+ mIn.copy1DRangeFrom(0, INPUTSIZE, in);
+
+ try {
+ RSUtils.forEach(this, 0, mIn, mOut);
+ } catch (RSRuntimeException e) {
+ }
+ mOut.copyTo(out);
+ checkArray(ref, out, INPUTSIZE, 1, 1, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/IsObjectTest.java b/tests/tests/renderscript/src/android/renderscript/cts/IsObjectTest.java
new file mode 100644
index 0000000..fffaa5c
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/IsObjectTest.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.*;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.util.Log;
+import android.view.SurfaceHolder;
+import com.android.cts.stub.R;
+
+import junit.framework.Assert;
+
+public class IsObjectTest extends RSBaseCompute {
+ int ObjectNum = 1;
+ private Allocation mIn;
+ private Allocation mOut;
+
+ Element element;
+ Type type;
+ Allocation allocation;
+ Sampler sampler;
+ Script script;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ element = Element.BOOLEAN(mRS);
+
+ type = new Type.Builder(mRS, Element.I8(mRS)).setX(1).create();
+ allocation = Allocation.createTyped(mRS, type);
+ sampler = new Sampler.Builder(mRS).create();
+ script = new ScriptC_is_object_element(mRS, mRes, R.raw.is_object_element);
+ }
+
+ /**
+ * is object test
+ */
+ public void testIsObjectElement() {
+ ScriptField__object_element_input filed = new ScriptField__object_element_input(
+ mRS, 1);
+ ScriptField__object_element_input.Item mItem =
+ new ScriptField__object_element_input.Item();
+ mItem.element = element;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ScriptC_is_object_element mScript = new ScriptC_is_object_element(mRS, mRes,
+ R.raw.is_object_element);
+ try {
+ mScript.forEach_root(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsIsObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsIsObject element test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testIsObjectType() {
+ ScriptField__object_type_input filed = new ScriptField__object_type_input(mRS, 1);
+ ScriptField__object_type_input.Item mItem = new ScriptField__object_type_input.Item();
+ mItem.type = type;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ScriptC_is_object_type mScript = new ScriptC_is_object_type(mRS, mRes,
+ R.raw.is_object_type);
+
+ try {
+ mScript.forEach_root(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsIsObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue(
+ "rsIsObject type test fail: " + "Expect 1;value " + tmpArray[0],
+ tmpArray[0] == 1);
+ }
+
+ public void testIsObjectAllocation() {
+ ScriptField__object_allocation_input filed = new ScriptField__object_allocation_input(
+ mRS, 1);
+ ScriptField__object_allocation_input.Item mItem =
+ new ScriptField__object_allocation_input.Item();
+ mItem.allocation = allocation;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ScriptC_is_object_allocation mScript = new ScriptC_is_object_allocation(mRS,
+ mRes, R.raw.is_object_allocation);
+
+ try {
+ mScript.forEach_root(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsIsObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsIsObject allocation test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testIsObjectSampler() {
+ ScriptField__object_sampler_input filed = new ScriptField__object_sampler_input(
+ mRS, 1);
+ ScriptField__object_sampler_input.Item mItem =
+ new ScriptField__object_sampler_input.Item();
+ mItem.sampler = sampler;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ScriptC_is_object_sampler mScript = new ScriptC_is_object_sampler(mRS, mRes,
+ R.raw.is_object_sampler);
+
+ try {
+ mScript.forEach_root(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsIsObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsIsObject sampler test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testIsObjectScript() {
+ ScriptField__object_script_input filed = new ScriptField__object_script_input(
+ mRS, 1);
+ ScriptField__object_script_input.Item mItem = new ScriptField__object_script_input.Item();
+ mItem.script = script;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ScriptC_is_object_script mScript = new ScriptC_is_object_script(mRS, mRes,
+ R.raw.is_object_script);
+
+ try {
+ mScript.forEach_root(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsIsObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsIsObject script test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+}
\ No newline at end of file
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Log10Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Log10Test.java
new file mode 100644
index 0000000..7fd94ce
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Log10Test.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class Log10Test extends RSBaseCompute {
+ private ScriptC_log10_f32 script_f32;
+ private ScriptC_log10_f32_2 script_f32_2;
+ private ScriptC_log10_f32_3 script_f32_3;
+ private ScriptC_log10_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.log10((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testLog10F32() {
+ script_f32 = new ScriptC_log10_f32(mRS, mRes, R.raw.log10_f32);
+ doF32(0x13, 3);
+ }
+
+ public void testLog10F32_2() {
+ script_f32_2 = new ScriptC_log10_f32_2(mRS, mRes, R.raw.log10_f32_2);
+ doF32_2(0xf, 3);
+ }
+
+ public void testLog10F32_3() {
+ script_f32_3 = new ScriptC_log10_f32_3(mRS, mRes, R.raw.log10_f32_3);
+ doF32_3(0xa, 3);
+ }
+
+ public void testLog10F32_4() {
+ script_f32_4 = new ScriptC_log10_f32_4(mRS, mRes, R.raw.log10_f32_4);
+ doF32_4(0xf3, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Log1PTest.java b/tests/tests/renderscript/src/android/renderscript/cts/Log1PTest.java
new file mode 100644
index 0000000..0c15c1f
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Log1PTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class Log1PTest extends RSBaseCompute {
+ private ScriptC_log1p_f32 script_f32;
+ private ScriptC_log1p_f32_2 script_f32_2;
+ private ScriptC_log1p_f32_3 script_f32_3;
+ private ScriptC_log1p_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.log1p((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testLog1PF32() {
+ script_f32 = new ScriptC_log1p_f32(mRS, mRes, R.raw.log1p_f32);
+ doF32(0xab, 2);
+ }
+
+ public void testLog1PF32_2() {
+ script_f32_2 = new ScriptC_log1p_f32_2(mRS, mRes, R.raw.log1p_f32_2);
+ doF32_2(0x12, 2);
+ }
+
+ public void testLog1PF32_3() {
+ script_f32_3 = new ScriptC_log1p_f32_3(mRS, mRes, R.raw.log1p_f32_3);
+ doF32_3(0xa1, 2);
+ }
+
+ public void testLog1PF32_4() {
+ script_f32_4 = new ScriptC_log1p_f32_4(mRS, mRes, R.raw.log1p_f32_4);
+ doF32_4(0xbae, 2);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/Log2Test.java b/tests/tests/renderscript/src/android/renderscript/cts/Log2Test.java
new file mode 100644
index 0000000..10f9beb
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/Log2Test.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class Log2Test extends RSBaseCompute {
+ private ScriptC_log2_f32 script_f32;
+ private ScriptC_log2_f32_2 script_f32_2;
+ private ScriptC_log2_f32_3 script_f32_3;
+ private ScriptC_log2_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.log10((double)in[idx])/Math.log10(2.0));
+ }
+ }
+ return ref;
+ }
+
+ public void testLog2F32() {
+ script_f32 = new ScriptC_log2_f32(mRS, mRes, R.raw.log2_f32);
+ doF32(0x18a, 3);
+ }
+
+ public void testLog2F32_2() {
+ script_f32_2 = new ScriptC_log2_f32_2(mRS, mRes, R.raw.log2_f32_2);
+ doF32_2(0xfa, 3);
+ }
+
+ public void testLog2F32_3() {
+ script_f32_3 = new ScriptC_log2_f32_3(mRS, mRes, R.raw.log2_f32_3);
+ doF32_3(0xaef, 3);
+ }
+
+ public void testLog2F32_4() {
+ script_f32_4 = new ScriptC_log2_f32_4(mRS, mRes, R.raw.log2_f32_4);
+ doF32_4(0xae62, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/LogTest.java b/tests/tests/renderscript/src/android/renderscript/cts/LogTest.java
new file mode 100644
index 0000000..d43d1df
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/LogTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class LogTest extends RSBaseCompute {
+ private ScriptC_log_f32 script_f32;
+ private ScriptC_log_f32_2 script_f32_2;
+ private ScriptC_log_f32_3 script_f32_3;
+ private ScriptC_log_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.log((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testLogF32() {
+ script_f32 = new ScriptC_log_f32(mRS, mRes, R.raw.log_f32);
+ doF32(0xfae, 3);
+ }
+
+ public void testLogF32_2() {
+ script_f32_2 = new ScriptC_log_f32_2(mRS, mRes, R.raw.log_f32_2);
+ doF32_2(0x123, 3);
+ }
+
+ public void testLogF32_3() {
+ script_f32_3 = new ScriptC_log_f32_3(mRS, mRes, R.raw.log_f32_3);
+ doF32_3(0xab4, 3);
+ }
+
+ public void testLogF32_4() {
+ script_f32_4 = new ScriptC_log_f32_4(mRS, mRes, R.raw.log_f32_4);
+ doF32_4(0xfa3, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/LogbTest.java b/tests/tests/renderscript/src/android/renderscript/cts/LogbTest.java
new file mode 100644
index 0000000..b8ae32e
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/LogbTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class LogbTest extends RSBaseCompute {
+ private ScriptC_logb_f32 script_f32;
+ private ScriptC_logb_f32_2 script_f32_2;
+ private ScriptC_logb_f32_3 script_f32_3;
+ private ScriptC_logb_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = ((Float.floatToIntBits(in[idx]) >> 23) & 0xFF) - 127.0f;
+ }
+ }
+ return ref;
+ }
+
+ public void testLogbF32() {
+ script_f32 = new ScriptC_logb_f32(mRS, mRes, R.raw.logb_f32);
+ doF32(0xe, 0);
+ }
+
+ public void testLogbF32_2() {
+ script_f32_2 = new ScriptC_logb_f32_2(mRS, mRes, R.raw.logb_f32_2);
+ doF32_2(0xa1, 0);
+ }
+
+ public void testLogbF32_3() {
+ script_f32_3 = new ScriptC_logb_f32_3(mRS, mRes, R.raw.logb_f32_3);
+ doF32_3(0xab2, 0);
+ }
+
+ public void testLogbF32_4() {
+ script_f32_4 = new ScriptC_logb_f32_4(mRS, mRes, R.raw.logb_f32_4);
+ doF32_4(0xaa2, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/MadTest.java b/tests/tests/renderscript/src/android/renderscript/cts/MadTest.java
new file mode 100644
index 0000000..554b832
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/MadTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class MadTest extends RSBaseCompute {
+ private ScriptC_mad_f32 script_f32;
+ private ScriptC_mad_f32_2 script_f32_2;
+ private ScriptC_mad_f32_3 script_f32_3;
+ private ScriptC_mad_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 3 + j;
+ ref[i * (stride - skip) + j] = (float)((double)in[idx] * (double)in[idx+stride] + (double)in[idx+stride*2]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*3];
+ }
+
+ public void testMadF32() {
+ script_f32 = new ScriptC_mad_f32(mRS, mRes, R.raw.mad_f32);
+ ScriptField_mad_input_f32 in = new ScriptField_mad_input_f32(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x123678, 4);
+ }
+
+ public void testMadF32_2() {
+ script_f32_2 = new ScriptC_mad_f32_2(mRS, mRes, R.raw.mad_f32_2);
+ ScriptField_mad_input_f32_2 in = new ScriptField_mad_input_f32_2(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1234a5, 4);
+ }
+
+ public void testMadF32_3() {
+ script_f32_3 = new ScriptC_mad_f32_3(mRS, mRes, R.raw.mad_f32_3);
+ ScriptField_mad_input_f32_3 in = new ScriptField_mad_input_f32_3(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1af345, 4);
+ }
+
+ public void testMadF32_4() {
+ script_f32_4 = new ScriptC_mad_f32_4(mRS, mRes, R.raw.mad_f32_4);
+ ScriptField_mad_input_f32_4 in = new ScriptField_mad_input_f32_4(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x12ce45, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/NextafterTest.java b/tests/tests/renderscript/src/android/renderscript/cts/NextafterTest.java
new file mode 100644
index 0000000..ad7558a
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/NextafterTest.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class NextafterTest extends RSBaseCompute {
+ private ScriptC_nextafter_f32 script_f32;
+ private ScriptC_nextafter_f32_2 script_f32_2;
+ private ScriptC_nextafter_f32_3 script_f32_3;
+ private ScriptC_nextafter_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = Math.nextAfter(in[idx],(double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testNextafterF32() {
+ script_f32 = new ScriptC_nextafter_f32(mRS, mRes, R.raw.nextafter_f32);
+ ScriptField_InputData inputDataArray = new ScriptField_InputData(mRS, INPUTSIZE);
+ mIn = inputDataArray.getAllocation();
+ doF32(0x12678, 0);
+ }
+
+ public void testNextafterF32_2() {
+ script_f32_2 = new ScriptC_nextafter_f32_2(mRS, mRes, R.raw.nextafter_f32_2);
+ ScriptField_InputData_2 inputDataArray = new ScriptField_InputData_2(mRS, INPUTSIZE);
+ mIn = inputDataArray.getAllocation();
+ doF32_2(0x1af45, 0);
+ }
+
+ public void testNextafterF32_3() {
+ script_f32_3 = new ScriptC_nextafter_f32_3(mRS, mRes, R.raw.nextafter_f32_3);
+ ScriptField_InputData_3 inputDataArray = new ScriptField_InputData_3(mRS, INPUTSIZE);
+ mIn = inputDataArray.getAllocation();
+ doF32_3(0x1cd345, 0);
+ }
+
+ public void testNextafterF32_4() {
+ script_f32_4 = new ScriptC_nextafter_f32_4(mRS, mRes, R.raw.nextafter_f32_4);
+ ScriptField_InputData_4 inputDataArray = new ScriptField_InputData_4(mRS, INPUTSIZE);
+ mIn = inputDataArray.getAllocation();
+ doF32_4(0x1ca45, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/PowTest.java b/tests/tests/renderscript/src/android/renderscript/cts/PowTest.java
new file mode 100644
index 0000000..8ed7f1d
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/PowTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class PowTest extends RSBaseCompute {
+ private ScriptC_pow_f32 script_f32;
+ private ScriptC_pow_f32_2 script_f32_2;
+ private ScriptC_pow_f32_3 script_f32_3;
+ private ScriptC_pow_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride * 2 + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)Math.pow((double)in[idx], (double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ @Override
+ protected void fillRandom(long seed, int fact, int offset, float[] inArray, int rStride, int rSkip) {
+ RSUtils.genRandom(seed, 32, -16, inArray, rStride, rSkip);
+ }
+
+ public void testPowF32() {
+ script_f32 = new ScriptC_pow_f32(mRS, mRes, R.raw.pow_f32);
+ ScriptField_PowInputData in = new ScriptField_PowInputData(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12345678, 16);
+ }
+
+ public void testPowF32_2() {
+ script_f32_2 = new ScriptC_pow_f32_2(mRS, mRes, R.raw.pow_f32_2);
+ ScriptField_PowInputData_2 in = new ScriptField_PowInputData_2(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x12ab78, 16);
+ }
+
+ public void testPowF32_3() {
+ script_f32_3 = new ScriptC_pow_f32_3(mRS, mRes, R.raw.pow_f32_3);
+ ScriptField_PowInputData_3 in = new ScriptField_PowInputData_3(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1f5678, 16);
+ }
+
+ public void testPowF32_4() {
+ script_f32_4 = new ScriptC_pow_f32_4(mRS, mRes, R.raw.pow_f32_4);
+ ScriptField_PowInputData_4 in = new ScriptField_PowInputData_4(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0xc678, 16);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/PownTest.java b/tests/tests/renderscript/src/android/renderscript/cts/PownTest.java
new file mode 100644
index 0000000..4af3d2b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/PownTest.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class PownTest extends RSBaseCompute {
+ private ScriptC_pown_f32 script_f32;
+ private ScriptC_pown_f32_2 script_f32_2;
+ private ScriptC_pown_f32_3 script_f32_3;
+ private ScriptC_pown_f32_4 script_f32_4;
+ private int[] n;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)Math.pow((double)in[idx], (double)n[idx]);
+ }
+ }
+ return ref;
+ }
+
+ public void testPownF32() {
+ script_f32 = new ScriptC_pown_f32(mRS, mRes, R.raw.pown_f32);
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE];
+ RSUtils.genRandom(0x12345678, 32, 1, -16, n);
+ nAlloc.copyFrom(n);
+ script_f32.set_n(nAlloc);
+
+ doF32(0x716acd, 16);
+ }
+
+ public void testPownF32_2() {
+ script_f32_2 = new ScriptC_pown_f32_2(mRS, mRes, R.raw.pown_f32_2);
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_2(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*2];
+ RSUtils.genRandom(0xacdef1, 32, 1, -16, n);
+ nAlloc.copyFrom(n);
+ script_f32_2.set_n(nAlloc);
+
+ doF32_2(0xacdef1, 16);
+ }
+
+ public void testPownF32_3() {
+ script_f32_3 = new ScriptC_pown_f32_3(mRS, mRes, R.raw.pown_f32_3);
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_3(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*4];
+ RSUtils.genRandom(0xa123f1, 32, 1, -16, n, 4, 1);
+ nAlloc.copyFrom(n);
+ script_f32_3.set_n(nAlloc);
+
+ doF32_3(0xaac3f1, 16);
+ }
+
+ public void testPownF32_4() {
+ script_f32_4 = new ScriptC_pown_f32_4(mRS, mRes, R.raw.pown_f32_4);
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_4(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*4];
+ RSUtils.genRandom(0x4323ca, 32, 1, -16, n);
+ nAlloc.copyFrom(n);
+ script_f32_4.set_n(nAlloc);
+
+ doF32_4(0xaa12f1, 16);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/PowrTest.java b/tests/tests/renderscript/src/android/renderscript/cts/PowrTest.java
new file mode 100644
index 0000000..4339e6b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/PowrTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class PowrTest extends RSBaseCompute {
+ private ScriptC_powr_f32 script_f32;
+ private ScriptC_powr_f32_2 script_f32_2;
+ private ScriptC_powr_f32_3 script_f32_3;
+ private ScriptC_powr_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride * 2 + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)Math.pow((double)in[idx], (double)in[idx+stride]);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ @Override
+ protected void fillRandom(long seed, int fact, int offset, float[] inArray, int rStride, int rSkip) {
+ RSUtils.genRandom(seed, 64, 0, inArray, rStride, rSkip);
+ }
+
+ public void testPowrF32() {
+ script_f32 = new ScriptC_powr_f32(mRS, mRes, R.raw.powr_f32);
+ ScriptField_PowInputData in = new ScriptField_PowInputData(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12345678, 16);
+ }
+
+ public void testPowrF32_2() {
+ script_f32_2 = new ScriptC_powr_f32_2(mRS, mRes, R.raw.powr_f32_2);
+ ScriptField_PowInputData_2 in = new ScriptField_PowInputData_2(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x12ab78, 16);
+ }
+
+ public void testPowrF32_3() {
+ script_f32_3 = new ScriptC_powr_f32_3(mRS, mRes, R.raw.powr_f32_3);
+ ScriptField_PowInputData_3 in = new ScriptField_PowInputData_3(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1f5678, 16);
+ }
+
+ public void testPowrF32_4() {
+ script_f32_4 = new ScriptC_powr_f32_4(mRS, mRes, R.raw.powr_f32_4);
+ ScriptField_PowInputData_4 in = new ScriptField_PowInputData_4(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0xc678, 16);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java b/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java
index 3278113..d02e28b 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RSBaseCompute.java
@@ -17,6 +17,9 @@
package android.renderscript.cts;
import android.renderscript.RenderScript;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
/**
* Base RenderScript test class. This class provides a message handler and a
@@ -25,6 +28,12 @@
class RSBaseCompute extends RSBase {
RenderScript mRS;
+ static final int TEST_F32 = 0;
+ static final int TEST_F32_2 = 1;
+ static final int TEST_F32_3 = 2;
+ static final int TEST_F32_4 = 3;
+ protected int INPUTSIZE = 512;
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -41,4 +50,110 @@
super.tearDown();
}
+ public void checkArray(float[] ref, float[] out, int height, int refStride,
+ int outStride, float ulpCount) {
+ int minStride = refStride > outStride ? outStride : refStride;
+ for (int i = 0; i < height; i++) {
+ for (int j = 0; j < minStride; j++) {
+ int refIdx = i * refStride + j;
+ int outIdx = i * outStride + j;
+ float ulp = Math.ulp(ref[refIdx]) * ulpCount;
+ assertEquals("Incorrect value @ idx = " + i + " |",
+ ref[refIdx],
+ out[outIdx],
+ ulp);
+ }
+ }
+ }
+
+ public void checkArray(int[] ref, int[] out, int height, int refStride,
+ int outStride) {
+ int minStride = refStride > outStride ? outStride : refStride;
+ for (int i = 0; i < height; i++) {
+ for (int j = 0; j < minStride; j++) {
+ int refIdx = i * refStride + j;
+ int outIdx = i * outStride + j;
+ assertEquals("Incorrect value @ idx = " + i + " |",
+ ref[refIdx],
+ out[outIdx]);
+ }
+ }
+ }
+
+ private void baseTestHelper(int testid, Element inElement, Element outElement, long seed, int fact,
+ int offset, int rStride, int rSkip, int refStride, int outStride,
+ int inStride, int skip, int ulp) {
+ float[] inArray = makeInArray(INPUTSIZE * inStride);
+ fillRandom(seed, fact, offset, inArray, rStride, rSkip);
+ float[] refArray = getRefArray(inArray, INPUTSIZE, inStride, skip);
+
+ Allocation mAllocationIn = setInAlloc(inElement);
+ fillInAlloc(mAllocationIn, inArray);
+
+ Allocation mAllocationOut = setOutAlloc(outElement);
+ try {
+ RSUtils.forEach(this, testid, mAllocationIn, mAllocationOut);
+ } catch (RSRuntimeException e) {
+ }
+ float[] outArray = makeOutArray(INPUTSIZE * outStride);
+ mAllocationOut.copyTo(outArray);
+ checkArray(refArray, outArray, INPUTSIZE, refStride, outStride, ulp);
+ }
+
+ public void baseTest(int testid, long seed, int refStride, int outStride, int inStride, int skip, int ulp) {
+ baseTestHelper(testid, null, null, seed, 1, 0, 1, 0, refStride, outStride, inStride, skip, ulp);
+ }
+
+ public void doF32(long seed, int ulp) {
+ baseTestHelper(TEST_F32, Element.F32(mRS), Element.F32(mRS), seed, 1, 0, 1, 0, 1, 1, 1, 0, ulp);
+ }
+
+ public void doF32_2(long seed, int ulp) {
+ baseTestHelper(TEST_F32_2, Element.F32_2(mRS), Element.F32_2(mRS), seed, 1, 0, 1, 0, 2, 2, 2, 0, ulp);
+ }
+
+ public void doF32_3(long seed, int ulp) {
+ baseTestHelper(TEST_F32_3, Element.F32_3(mRS), Element.F32_3(mRS), seed, 1, 0, 4, 1, 3, 4, 4, 1, ulp);
+ }
+
+ public void doF32_4(long seed, int ulp) {
+ baseTestHelper(TEST_F32_4, Element.F32_4(mRS), Element.F32_4(mRS), seed, 1, 0, 1, 0, 4, 4, 4, 0, ulp);
+ }
+
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ // Intentionally empty... subclass will likely define only one, but not both
+ }
+
+ public void forEach(int testId, Allocation mIn) throws RSRuntimeException {
+ // Intentionally empty... subclass will likely define only one, but not both
+ }
+
+ //These are default actions for these functions, specific tests overload them
+ protected float[] getRefArray(float[] inArray, int size, int stride, int skip) {
+ return null;
+ }
+
+ protected Allocation setInAlloc(Element e) {
+ return Allocation.createSized(mRS, e, INPUTSIZE);
+ }
+
+ protected Allocation setOutAlloc(Element e) {
+ return Allocation.createSized(mRS, e, INPUTSIZE);
+ }
+
+ protected float[] makeInArray(int size) {
+ return new float[size];
+ }
+
+ protected float[] makeOutArray(int size) {
+ return new float[size];
+ }
+
+ protected void fillRandom(long seed, int fact, int offset, float[] inArray, int rStride, int rSkip) {
+ RSUtils.genRandom(seed, fact, offset, inArray, rStride, rSkip);
+ }
+
+ protected void fillInAlloc(Allocation mIn, float[] inArray) {
+ mIn.copy1DRangeFromUnchecked(0, INPUTSIZE, inArray);
+ }
}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java b/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java
new file mode 100644
index 0000000..8c81e3d
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RSUtils.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.content.res.Resources;
+import java.util.Random;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+/**
+ * This class supplies some utils for renderscript tests
+ */
+public class RSUtils {
+
+ public static void genRandom(long seed, int factor, int offset, float array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = r.nextFloat() * factor + offset;
+ }
+ }
+
+ public static void genRandom(long seed, int factor, int offset, float array[],
+ int stride, int skip) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length / stride; i++) {
+ for (int j = 0; j < stride; j++) {
+ if (j >= stride - skip)
+ array[i * stride + j] = 0;
+ else
+ array[i * stride + j] = r.nextFloat() * factor + offset;
+ }
+ }
+ }
+
+ public static void genRandom(long seed, int max, int factor, int offset, int array[]) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length; i++) {
+ array[i] = (r.nextInt(max) * factor + offset);
+ }
+ }
+
+ public static void genRandom(long seed, int factor, int offset, int array[],
+ int stride, int skip) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length / stride; i++) {
+ for (int j = 0; j < stride; j++) {
+ if (j >= stride - skip)
+ array[i * stride + j] = 0;
+ else
+ array[i * stride + j] = r.nextInt() * factor + offset;
+ }
+ }
+ }
+
+ public static void genRandom(long seed, int max, int factor, int offset, int array[],
+ int stride, int skip) {
+ Random r = new Random(seed);
+ for (int i = 0; i < array.length / stride; i++) {
+ for (int j = 0; j < stride; j++) {
+ if (j >= stride - skip)
+ array[i * stride + j] = 0;
+ else
+ array[i * stride + j] = r.nextInt(max) * factor + offset;
+ }
+ }
+ }
+
+ public static void forEach(RSBaseCompute base, int testId, Allocation in) throws RSRuntimeException {
+ base.forEach(testId, in);
+ }
+
+ public static void forEach(RSBaseCompute base, int testId, Allocation in, Allocation out)
+ throws RSRuntimeException {
+ base.forEach(testId, in,out);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RadiansTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RadiansTest.java
new file mode 100644
index 0000000..a12b13e
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RadiansTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class RadiansTest extends RSBaseCompute {
+ private ScriptC_rad_f32 script_f32;
+ private ScriptC_rad_f32_2 script_f32_2;
+ private ScriptC_rad_f32_3 script_f32_3;
+ private ScriptC_rad_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ double val = (double)in[idx] * (Math.PI / 180.0);
+ ref[idxRef] = (float)val;
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * radians test for float
+ */
+ public void testRadiansF32() {
+ script_f32 = new ScriptC_rad_f32(mRS, mRes, R.raw.rad_f32);
+ doF32(0x1234f678, 3);
+ }
+
+ /**
+ * radians test for float2
+ */
+ public void testRadiansF32_2() {
+ script_f32_2 = new ScriptC_rad_f32_2(mRS, mRes, R.raw.rad_f32_2);
+ doF32_2(0x12345678, 3);
+ }
+
+ /**
+ * radians test for float3
+ */
+ public void testRadiansF32_3() {
+ script_f32_3 = new ScriptC_rad_f32_3(mRS, mRes, R.raw.rad_f32_3);
+ doF32_3(0x123d5678, 3);
+ }
+
+ /**
+ * radians test for float4
+ */
+ public void testRadiansF32_4() {
+ script_f32_4 = new ScriptC_rad_f32_4(mRS, mRes, R.raw.rad_f32_4);
+ doF32_4(0x123a5678, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RemainderTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RemainderTest.java
new file mode 100644
index 0000000..e096839
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RemainderTest.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class RemainderTest extends RSBaseCompute {
+ private ScriptC_remainder_f32 script_f32;
+ private ScriptC_remainder_f32_2 script_f32_2;
+ private ScriptC_remainder_f32_3 script_f32_3;
+ private ScriptC_remainder_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ double num = (double)in[idx];
+ double den = (double)in[idx+stride];
+ ref[i * (stride - skip) + j] = (float)(num - Math.round(num / den) * den);
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testRemainderF32() {
+ script_f32 = new ScriptC_remainder_f32(mRS, mRes, R.raw.remainder_f32);
+ ScriptField_remainder_f32 in = new ScriptField_remainder_f32(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x123678, 0);
+ }
+
+ public void testRemainderF32_2() {
+ script_f32_2 = new ScriptC_remainder_f32_2(mRS, mRes, R.raw.remainder_f32_2);
+ ScriptField_remainder_f32_2 in = new ScriptField_remainder_f32_2(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1234a5, 0);
+ }
+
+ public void testRemainderF32_3() {
+ script_f32_3 = new ScriptC_remainder_f32_3(mRS, mRes, R.raw.remainder_f32_3);
+ ScriptField_remainder_f32_3 in = new ScriptField_remainder_f32_3(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0x1af345, 0);
+ }
+
+ public void testRemainderF32_4() {
+ script_f32_4 = new ScriptC_remainder_f32_4(mRS, mRes, R.raw.remainder_f32_4);
+ ScriptField_remainder_f32_4 in = new ScriptField_remainder_f32_4(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x12ce45, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RintTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RintTest.java
new file mode 100644
index 0000000..150d3ef
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RintTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class RintTest extends RSBaseCompute {
+ private ScriptC_rint_f32 ms_f32;
+ private ScriptC_rint_f32_2 ms_f32_2;
+ private ScriptC_rint_f32_3 ms_f32_3;
+ private ScriptC_rint_f32_4 ms_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut)
+ throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ ms_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ ms_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ ms_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ ms_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] inArray, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * (stride - skip)];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idxIn = i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float) Math.rint(inArray[idxIn]);
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * rint test for float
+ */
+ public void testRintF32() {
+ ms_f32 = new ScriptC_rint_f32(mRS, mRes, R.raw.rint_f32);
+ doF32(0x12345678, 0);
+ }
+
+ /**
+ * rint test for float2
+ */
+ public void testRintF32_2() {
+ ms_f32_2 = new ScriptC_rint_f32_2(mRS, mRes, R.raw.rint_f32_2);
+ doF32_2(0x12ab5678, 0);
+ }
+
+ /**
+ * rint test for float3
+ */
+ public void testRintF32_3() {
+ ms_f32_3 = new ScriptC_rint_f32_3(mRS, mRes, R.raw.rint_f32_3);
+ doF32_3(0x123ac678, 0);
+ }
+
+ /**
+ * rint test for float4
+ */
+ public void testRintF32_4() {
+ ms_f32_4 = new ScriptC_rint_f32_4(mRS, mRes, R.raw.rint_f32_4);
+ doF32_4(0x1f345678, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RootnTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RootnTest.java
new file mode 100644
index 0000000..dd074ed
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RootnTest.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class RootnTest extends RSBaseCompute {
+ private ScriptC_rootn_f32 script_f32;
+ private ScriptC_rootn_f32_2 script_f32_2;
+ private ScriptC_rootn_f32_3 script_f32_3;
+ private ScriptC_rootn_f32_4 script_f32_4;
+ private int[] n;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)Math.pow((double)in[idx], 1.0/(double)n[idx]);
+ }
+ }
+ return ref;
+ }
+
+ public void testRootnF32() {
+ script_f32 = new ScriptC_rootn_f32(mRS, mRes, R.raw.rootn_f32);
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE];
+ RSUtils.genRandom(0x12345678, 32, 1, 1, n);
+ nAlloc.copyFrom(n);
+ script_f32.set_n(nAlloc);
+
+ doF32(0x716acd, 16);
+ }
+
+ public void testRootnF32_2() {
+ script_f32_2 = new ScriptC_rootn_f32_2(mRS, mRes, R.raw.rootn_f32_2);
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_2(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*2];
+ RSUtils.genRandom(0xacdef1, 32, 1, 1, n);
+ nAlloc.copyFrom(n);
+ script_f32_2.set_n(nAlloc);
+
+ doF32_2(0xacdef1, 16);
+ }
+
+ public void testRootnF32_3() {
+ script_f32_3 = new ScriptC_rootn_f32_3(mRS, mRes, R.raw.rootn_f32_3);
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_3(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*4];
+ RSUtils.genRandom(0xa123f1, 32, 1, 1, n, 4, 1);
+ nAlloc.copyFrom(n);
+ script_f32_3.set_n(nAlloc);
+
+ doF32_3(0xaac3f1, 16);
+ }
+
+ public void testRootnF32_4() {
+ script_f32_4 = new ScriptC_rootn_f32_4(mRS, mRes, R.raw.rootn_f32_4);
+ Allocation nAlloc = Allocation.createSized(mRS, Element.I32_4(mRS), INPUTSIZE);
+
+ n = new int[INPUTSIZE*4];
+ RSUtils.genRandom(0x4323ca, 32, 1, 1, n);
+ nAlloc.copyFrom(n);
+ script_f32_4.set_n(nAlloc);
+
+ doF32_4(0xaa12f1, 16);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RoundTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RoundTest.java
new file mode 100644
index 0000000..ac8f6fc
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RoundTest.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class RoundTest extends RSBaseCompute {
+ private ScriptC_round_f32 ms_f32;
+ private ScriptC_round_f32_2 ms_f32_2;
+ private ScriptC_round_f32_3 ms_f32_3;
+ private ScriptC_round_f32_4 ms_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut)
+ throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ ms_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ ms_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ ms_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ ms_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] inArray, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * (stride - skip)];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idxIn = i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ int res = ((Float.floatToIntBits(inArray[idxIn]) >> 31) & 0x01);
+ float roundValue = (float) Math.round(inArray[idxIn]);
+ float expective = roundValue;
+ if ((roundValue - inArray[idxIn]) == 0.5f && res == 1)
+ expective -= 1;
+ if (res == 1 && expective == +0.0f) {
+ expective = -0.0f;
+ }
+ ref[idxRef] = expective;
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * round test for float
+ */
+ public void testRoundF32() {
+ ms_f32 = new ScriptC_round_f32(mRS, mRes, R.raw.round_f32);
+ doF32(0x12345678, 0);
+ }
+
+ /**
+ * round test for float2
+ */
+ public void testRoundF32_2() {
+ ms_f32_2 = new ScriptC_round_f32_2(mRS, mRes, R.raw.round_f32_2);
+ doF32_2(0x123a5678, 0);
+ }
+
+ /**
+ * round test for float3
+ */
+ public void testRoundF32_3() {
+ ms_f32_3 = new ScriptC_round_f32_3(mRS, mRes, R.raw.round_f32_3);
+ doF32_3(0x1af45678, 0);
+ }
+
+ /**
+ * round test for float4
+ */
+ public void testRoundF32_4() {
+ ms_f32_4 = new ScriptC_round_f32_4(mRS, mRes, R.raw.round_f32_4);
+ doF32_4(0x1f345678, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RsFracTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RsFracTest.java
new file mode 100644
index 0000000..74c9425
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RsFracTest.java
@@ -0,0 +1,48 @@
+/**
+ * Copyright (C) 2012 The Android Open Source Project
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class RsFracTest extends RSBaseCompute {
+ private ScriptC_rs_frac_f32 mScript;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut)
+ throws RSRuntimeException {
+ mScript.forEach_root(mIn, mOut);
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = Math.min(in[idx] - (float)Math.floor((double)in[idx]), 0x1.fffffep-1f);
+ }
+ }
+ return ref;
+ }
+
+ public void testRsFrac() {
+ mScript = new ScriptC_rs_frac_f32(mRS, mRes, R.raw.rs_frac_f32);
+ doF32(0x12, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RsPackColorTo8888Test.java b/tests/tests/renderscript/src/android/renderscript/cts/RsPackColorTo8888Test.java
new file mode 100644
index 0000000..53ee490
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RsPackColorTo8888Test.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Float3;
+import android.renderscript.Float4;
+import android.renderscript.RSRuntimeException;
+
+public class RsPackColorTo8888Test extends RSBaseCompute {
+ private ScriptC_rs_pack_color_to_8888_rgb script_rgb;
+ private ScriptC_rs_pack_color_to_8888_rgba script_rgba;
+ private ScriptC_rs_pack_color_to_8888_f32_3 script_f32_3;
+ private ScriptC_rs_pack_color_to_8888_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case 0:
+ script_rgb.forEach_root(mIn, mOut);
+ break;
+ case 1:
+ script_rgba.forEach_root(mIn, mOut);
+ break;
+ case 2:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case 3:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ public void testRsPackColorTo8888RGB() {
+ script_rgb = new ScriptC_rs_pack_color_to_8888_rgb(mRS, mRes, R.raw.rs_pack_color_to_8888_rgb);
+ float3input(0x17abc72, 0);
+ }
+
+ public void testRsPackColorTo8888RGBA() {
+ script_rgba = new ScriptC_rs_pack_color_to_8888_rgba(mRS, mRes, R.raw.rs_pack_color_to_8888_rgba);
+ float4input(0x76a6b, 1);
+ }
+
+ public void testRsPackColorTo8888F32_3() {
+ script_f32_3 = new ScriptC_rs_pack_color_to_8888_f32_3(mRS, mRes, R.raw.rs_pack_color_to_8888_f32_3);
+ float3input(0x17abc72, 2);
+ }
+
+ public void testRsPackColorTo8888F32_4() {
+ script_f32_4 = new ScriptC_rs_pack_color_to_8888_f32_4(mRS, mRes, R.raw.rs_pack_color_to_8888_f32_4);
+ float4input(0xabc72, 3);
+ }
+
+ private void float3input(long seed, int testId) {
+ Allocation mAllocationIn = Allocation.createSized(mRS, Element.F32_3(mRS), INPUTSIZE);
+ Allocation mAllocationOut = Allocation.createSized(mRS, Element.U8_4(mRS), INPUTSIZE);
+ float[] inArray = new float[INPUTSIZE * 4];
+ byte[] outArray = new byte[INPUTSIZE * 4];
+ byte[] refArray = new byte[INPUTSIZE * 4];
+ RSUtils.genRandom(seed, 1, 0, inArray, 4, 1);
+ mAllocationIn.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ try {
+ RSUtils.forEach(this, testId, mAllocationIn, mAllocationOut);
+ } catch (RSRuntimeException e) {
+ }
+ mAllocationOut.copyTo(outArray);
+ for (int i = 0; i < outArray.length; i += 4) {
+ int offset = i;
+ Float3 inValues = new Float3(inArray[offset], inArray[offset + 1], inArray[offset + 2]);
+ byte[] cValue = rs_PackColorTo8888(inValues);
+ refArray[i] = cValue[0];
+ refArray[i + 1] = cValue[1];
+ refArray[i + 2] = cValue[2];
+ refArray[i + 3] = cValue[3];
+ for (int j = 0; j < 4; j++){
+ assertEquals(refArray[i+j] & 0xff, outArray[i+j] & 0xff);
+ }
+ }
+ }
+
+ private void float4input(long seed, int testId) {
+ Allocation mAllocationIn = Allocation.createSized(mRS, Element.F32_4(mRS), INPUTSIZE);
+ Allocation mAllocationOut = Allocation.createSized(mRS, Element.U8_4(mRS), INPUTSIZE);
+ float[] inArray = new float[INPUTSIZE * 4];
+ byte[] outArray = new byte[INPUTSIZE * 4];
+ byte[] refArray = new byte[INPUTSIZE * 4];
+ RSUtils.genRandom(seed, 1, 0, inArray);
+ mAllocationIn.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ try {
+ RSUtils.forEach(this, testId, mAllocationIn, mAllocationOut);
+ } catch (RSRuntimeException e) {
+ }
+ mAllocationOut.copyTo(outArray);
+ for (int i = 0; i < outArray.length; i += 4) {
+ int offset = i;
+ Float4 inValues = new Float4( inArray[offset],inArray[offset + 1],inArray[offset + 2],inArray[offset + 3]);
+ byte[] cValue = rs_PackColorTo8888(inValues);
+ refArray[i] = cValue[0];
+ refArray[i + 1] = cValue[1];
+ refArray[i + 2] = cValue[2];
+ refArray[i + 3] = cValue[3];
+ for (int j = 0; j < 4; j++){
+ assertEquals(refArray[i+j] & 0xff, outArray[i+j] & 0xff);
+ }
+ }
+ }
+
+ private byte[] rs_PackColorTo8888(Float3 color) {
+ color.x *= 255.f;
+ color.y *= 255.f;
+ color.z *= 255.f;
+ color.x += 0.5f;
+ color.y += 0.5f;
+ color.z += 0.5f;
+ byte[] c = {
+ (byte) color.x, (byte) color.y, (byte) color.z, (byte) 255
+ };
+ return c;
+ }
+
+ private byte[] rs_PackColorTo8888(Float4 color) {
+ color.x *= 255.f;
+ color.y *= 255.f;
+ color.z *= 255.f;
+ color.x += 0.5f;
+ color.y += 0.5f;
+ color.z += 0.5f;
+ color.w *= 255.f;
+ color.w += 0.5f;
+ byte[] c = {
+ (byte) color.x, (byte) color.y, (byte) color.z, (byte) color.w
+ };
+ return c;
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RsUnpackColor8888Test.java b/tests/tests/renderscript/src/android/renderscript/cts/RsUnpackColor8888Test.java
new file mode 100644
index 0000000..4df1169
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RsUnpackColor8888Test.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.Float4;
+import android.renderscript.RSRuntimeException;
+import java.util.Random;
+
+public class RsUnpackColor8888Test extends RSBaseCompute {
+ private ScriptC_rs_unpack_color_8888 script;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ script.forEach_root(mIn, mOut);
+ }
+
+ public void testRsUnpackColor8888RGB() {
+ script = new ScriptC_rs_unpack_color_8888(mRS, mRes, R.raw.rs_unpack_color_8888);
+ Allocation mAllocationIn = Allocation.createSized(mRS, Element.U8_4(mRS), INPUTSIZE);
+ Allocation mAllocationOut = Allocation.createSized(mRS, Element.F32_4(mRS), INPUTSIZE);
+ byte[] inArray = new byte[INPUTSIZE * 4];
+ float[] outArray = new float[INPUTSIZE * 4];
+ float[] refArray = new float[INPUTSIZE * 4];
+
+ Random r = new Random(0x128fa817);
+ r.nextBytes(inArray);
+
+ mAllocationIn.copy1DRangeFrom(0, INPUTSIZE, inArray);
+ try {
+ RSUtils.forEach(this, 0, mAllocationIn, mAllocationOut);
+ } catch (RSRuntimeException e) {
+ }
+ mAllocationOut.copyTo(outArray);
+
+ for (int i = 0; i < outArray.length; i += 4) {
+ byte[] inValues = {inArray[i], inArray[i+1], inArray[i+2], inArray[i+3]};
+ Float4 c = rs_UnpackColor8888(inValues);
+ refArray[i] = c.x;
+ refArray[i + 1] = c.y;
+ refArray[i + 2] = c.z;
+ refArray[i + 3] = c.w;
+ for (int j = 0; j < 4; j++){
+ assertEquals(refArray[i+j], outArray[i+j]);
+ }
+ }
+ }
+
+ private static Float4 rs_UnpackColor8888(byte[] c) {
+ Float4 ret = new Float4(0.003921569f, 0.003921569f, 0.003921569f, 0.003921569f);
+ ret.x *= (c[0] & 0xff);
+ ret.y *= (c[1] & 0xff);
+ ret.z *= (c[2] & 0xff);
+ ret.w *= (c[3] & 0xff);
+ return ret;
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/RsqrtTest.java b/tests/tests/renderscript/src/android/renderscript/cts/RsqrtTest.java
new file mode 100644
index 0000000..7878d1b
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/RsqrtTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class RsqrtTest extends RSBaseCompute {
+ private ScriptC_rsqrt_f32 script_f32;
+ private ScriptC_rsqrt_f32_2 script_f32_2;
+ private ScriptC_rsqrt_f32_3 script_f32_3;
+ private ScriptC_rsqrt_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)Math.pow((double)in[idx], -0.5);
+ }
+ }
+ return ref;
+ }
+
+ public void testRsqrtF32() {
+ script_f32 = new ScriptC_rsqrt_f32(mRS, mRes, R.raw.rsqrt_f32);
+ doF32(0x12345678, 2);
+ }
+
+ public void testRsqrtF32_2() {
+ script_f32_2 = new ScriptC_rsqrt_f32_2(mRS, mRes, R.raw.rsqrt_f32_2);
+ doF32_2(0x12ae4567, 2);
+ }
+
+ public void testRsqrtF32_3() {
+ script_f32_3 = new ScriptC_rsqrt_f32_3(mRS, mRes, R.raw.rsqrt_f32_3);
+ doF32_3(0x12cf8, 2);
+ }
+
+ public void testRsqrtF32_4() {
+ script_f32_4 = new ScriptC_rsqrt_f32_4(mRS, mRes, R.raw.rsqrt_f32_4);
+ doF32_4(0x12abc8, 2);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SendToClient.java b/tests/tests/renderscript/src/android/renderscript/cts/SendToClient.java
new file mode 100644
index 0000000..56961a9
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SendToClient.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import java.util.Random;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RenderScript.RSMessageHandler;
+import com.android.cts.stub.R;
+
+public class SendToClient extends RSBaseCompute {
+ private Allocation mInAllocation;
+ private static Random random = new Random();
+
+ int outArray[] = new int[4];
+ RSMessageHandlerForTest mRsMessage = new RSMessageHandlerForTest() {
+ public void run() {
+ switch (mID) {
+ default:
+ outArray[0] = mID;
+ outArray[1] = mData[0];
+ outArray[2] = mData[1];
+ outArray[3] = mData[2];
+ try {
+ releaseForTest();
+ } catch (Exception e) {
+ //TODO: handle exception
+ }
+ return;
+ }
+ }
+ };
+
+ /*
+ * test rsSendToClient(int cmdID, const void* data, uint len);
+ */
+ public void testSendToClient() {
+ int[] inArray = new int[4];
+ for (int i=0; i<4; i++) {
+ inArray[i] = random.nextInt(1000);
+ }
+ mInAllocation = Allocation.createSized(mRS, Element.I32_4(mRS), 1);
+ mInAllocation.copyFrom(inArray);
+ ScriptC_send_to_client mScript;
+ mRS.setMessageHandler(mRsMessage);
+ mScript = new ScriptC_send_to_client(mRS,mRes,R.raw.send_to_client);
+ mScript.forEach_root(mInAllocation);
+ try {
+ mRsMessage.waitForTest();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ for (int i=0; i<inArray.length; i++) {
+ assertEquals(createErrorMsgF(i, inArray[i], outArray[i]),
+ inArray[i], outArray[i]);
+ }
+ }
+
+ /*
+ * test rsSendToClient(int cmdID)
+ */
+ public void testSendToClient1(){
+ outArray[0] = 0;
+ int Id = random.nextInt(100);
+ mRS.setMessageHandler(mRsMessage);
+ ScriptC_send_to_client_1 mScript;
+ mScript = new ScriptC_send_to_client_1(mRS,mRes,R.raw.send_to_client_1);
+ mScript.invoke_callback(Id);
+ try {
+ mRsMessage.waitForTest();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertEquals(createErrorMsgF(1, Id, outArray[0]), Id, outArray[0]);
+ }
+
+ private String createErrorMsgF(int i, int in, int temp) {
+ StringBuffer bf = new StringBuffer();
+ bf.append("[Wrong value]");
+ bf.append("; i = " + i);
+ bf.append("; InValue = " + in);
+ bf.append("; exceptValue = " + temp);
+ return bf.toString();
+ }
+
+ class RSMessageHandlerForTest extends RSMessageHandler {
+ public synchronized void waitForTest() throws InterruptedException {
+ wait();
+ }
+ public synchronized void releaseForTest() throws InterruptedException {
+ notify();
+ }
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SendToClientBlockingTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SendToClientBlockingTest.java
new file mode 100644
index 0000000..5083f87
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SendToClientBlockingTest.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.RenderScript.RSMessageHandler;
+
+import java.util.Random;
+
+import com.android.cts.stub.R;
+
+public class SendToClientBlockingTest extends RSBaseCompute {
+
+ private ScriptC_sendToClientBlocking mScript;
+ private Random random;
+
+ private int resultId = 0;
+ private int resultData = 0;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ random = new Random();
+ }
+
+ RSMessageHandlerForTest mRsMessageForTest = new RSMessageHandlerForTest() {
+ public void run() {
+ switch (mID) {
+ default:
+ resultId = mID;
+ resultData = mData[0];
+ try {
+ releaseForTest();
+ } catch (Exception e) {
+ // TODO: handle exception
+ }
+ return;
+ }
+ }
+ };
+
+ public void testSendToClientBlocking1Params() {
+
+ int id = random.nextInt(10);
+ mRS.setMessageHandler(mRsMessageForTest);
+ mScript = new ScriptC_sendToClientBlocking(mRS, mRes,
+ R.raw.sendtoclientblocking);
+ mScript.set_ID(id);
+ // Log.i("testSendToClientBlocking1Params", "==" + id);
+ mScript.invoke_callBack1Params();
+ try {
+ mRsMessageForTest.waitForTest();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue("testSendToClientBlocking1Params fail the result is:" + resultId,
+ resultId == id);
+ }
+
+ public void testSendToClientBlocking3Params() {
+
+ int id = random.nextInt(10);
+ int data = random.nextInt();
+ mRS.setMessageHandler(mRsMessageForTest);
+ mScript = new ScriptC_sendToClientBlocking(mRS, mRes,
+ R.raw.sendtoclientblocking);
+ mScript.set_ID(id);
+ mScript.set_data(data);
+ // Log.i("testSendToClientBlocking3Params", data + "==" + id);
+ mScript.invoke_callBack3Params();
+ try {
+ mRsMessageForTest.waitForTest();
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ assertTrue("testSendToClientBlocking3Params fail the ID is:" + resultId +
+ "The data is:" + data, resultId == id && resultData == data);
+ }
+
+}
+
+/** This class is used to wait callback. */
+class RSMessageHandlerForTest extends RSMessageHandler {
+
+ public synchronized void waitForTest() throws InterruptedException {
+ wait();
+ }
+
+ public synchronized void releaseForTest() throws InterruptedException {
+ notify();
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SetObjectTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SetObjectTest.java
new file mode 100644
index 0000000..6e814b0
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SetObjectTest.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.*;
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.util.Log;
+import com.android.cts.stub.R;
+
+import junit.framework.Assert;
+
+public class SetObjectTest extends RSBaseCompute {
+ int ObjectNum = 1;
+ private Allocation mIn;
+ private Allocation mOut;
+
+ Element element;
+ Type type;
+ Allocation allocation;
+ Sampler sampler;
+ Script script;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ element = Element.BOOLEAN(mRS);
+
+ type = new Type.Builder(mRS, Element.I8(mRS)).setX(1).create();
+ allocation = Allocation.createTyped(mRS, type);
+ sampler = new Sampler.Builder(mRS).create();
+ script = new ScriptC_set_object_element(mRS, mRes, R.raw.set_object_element);
+ }
+
+ /**
+ * rsSetObject test
+ */
+ public void testSetObjectElement() {
+ ScriptField__set_object_element_input filed = new ScriptField__set_object_element_input(
+ mRS, 1);
+ ScriptField__set_object_element_input.Item mItem = new ScriptField__set_object_element_input.Item();
+ mItem.element = element;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ScriptC_set_object_element mScript = new ScriptC_set_object_element(mRS, mRes,
+ R.raw.set_object_element);
+ try {
+ mScript.forEach_root(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsSetObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsSetObject element test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testSetObjectType() {
+ ScriptField__set_object_type_input filed = new ScriptField__set_object_type_input(mRS, 1);
+ ScriptField__set_object_type_input.Item mItem = new ScriptField__set_object_type_input.Item();
+ mItem.type = type;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ScriptC_set_object_type mScript = new ScriptC_set_object_type(mRS, mRes,
+ R.raw.set_object_type);
+
+ try {
+ mScript.forEach_root(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsSetObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue(
+ "rsSetObject type test fail: " + "Expect 1;value " + tmpArray[0],
+ tmpArray[0] == 1);
+ }
+
+ public void testSetObjectAllocation() {
+ ScriptField__set_object_allocation_input filed = new ScriptField__set_object_allocation_input(
+ mRS, 1);
+ ScriptField__set_object_allocation_input.Item mItem = new ScriptField__set_object_allocation_input.Item();
+ mItem.allocation = allocation;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ScriptC_set_object_allocation mScript = new ScriptC_set_object_allocation(mRS,
+ mRes, R.raw.set_object_allocation);
+
+ try {
+ mScript.forEach_root(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsSetObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsSetObject allocation test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testSetObjectSampler() {
+ ScriptField__set_object_sampler_input filed = new ScriptField__set_object_sampler_input(
+ mRS, 1);
+ ScriptField__set_object_sampler_input.Item mItem = new ScriptField__set_object_sampler_input.Item();
+ mItem.sampler = sampler;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ScriptC_set_object_sampler mScript = new ScriptC_set_object_sampler(mRS, mRes,
+ R.raw.set_object_sampler);
+
+ try {
+ mScript.forEach_root(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsSetObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsSetObject sampler test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+
+ public void testSetObjectScript() {
+ ScriptField__set_object_script_input filed = new ScriptField__set_object_script_input(
+ mRS, 1);
+ ScriptField__set_object_script_input.Item mItem = new ScriptField__set_object_script_input.Item();
+ mItem.script = script;
+ filed.set(mItem, 0, true);
+
+ mIn = filed.getAllocation();
+ mOut = Allocation.createSized(mRS, Element.I32(mRS), ObjectNum);
+ ScriptC_set_object_script mScript = new ScriptC_set_object_script(mRS, mRes,
+ R.raw.set_object_script);
+
+ try {
+ mScript.forEach_root(mIn, mOut);
+ } catch (RSRuntimeException e) {
+ Log.i("compare", "rsSetObject root fail");
+ }
+ int[] tmpArray = new int[ObjectNum];
+ mOut.copyTo(tmpArray);
+
+ Assert.assertTrue("rsSetObject script test fail: " + "Expect 1;value "
+ + tmpArray[0], tmpArray[0] == 1);
+ }
+}
\ No newline at end of file
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SignTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SignTest.java
new file mode 100644
index 0000000..a6df373
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SignTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class SignTest extends RSBaseCompute {
+ private ScriptC_sign_f32 script_f32;
+ private ScriptC_sign_f32_2 script_f32_2;
+ private ScriptC_sign_f32_3 script_f32_3;
+ private ScriptC_sign_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idxIn = i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = in[idxIn] > 0.f ? 1.f : -1.f;
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * This method is used for sign() function with f32
+ */
+ public void testSignF32() {
+ script_f32 = new ScriptC_sign_f32(mRS, mRes, R.raw.sign_f32);
+ doF32(0x12345678, 0);
+ }
+
+ public void testSignF32_2() {
+ script_f32_2 = new ScriptC_sign_f32_2(mRS, mRes, R.raw.sign_f32_2);
+ doF32_2(0x12a45678, 0);
+ }
+
+ /**
+ * This method is used for sign() function with f32_3
+ */
+ public void testSignF32_3() {
+ script_f32_3 = new ScriptC_sign_f32_3(mRS, mRes, R.raw.sign_f32_3);
+ doF32_3(0x123c5678, 0);
+ }
+
+ /**
+ * This method is used for sign() function with f32_4
+ */
+ public void testSignF32_4() {
+ script_f32_4 = new ScriptC_sign_f32_4(mRS, mRes, R.raw.sign_f32_4);
+ doF32_4(0x123d678, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SinTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SinTest.java
new file mode 100644
index 0000000..0bce175
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SinTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class SinTest extends RSBaseCompute {
+ private ScriptC_sin_f32 script_f32;
+ private ScriptC_sin_f32_2 script_f32_2;
+ private ScriptC_sin_f32_3 script_f32_3;
+ private ScriptC_sin_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.sin((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testSinF32() {
+ script_f32 = new ScriptC_sin_f32(mRS, mRes, R.raw.sin_f32);
+ doF32(0xba, 4);
+ }
+
+ public void testSinF32_2() {
+ script_f32_2 = new ScriptC_sin_f32_2(mRS, mRes, R.raw.sin_f32_2);
+ doF32_2(0xbaa, 4);
+ }
+
+ public void testSinF32_3() {
+ script_f32_3 = new ScriptC_sin_f32_3(mRS, mRes, R.raw.sin_f32_3);
+ doF32_3(0xca, 4);
+ }
+
+ public void testSinF32_4() {
+ script_f32_4 = new ScriptC_sin_f32_4(mRS, mRes, R.raw.sin_f32_4);
+ doF32_4(0xda, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SinhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SinhTest.java
new file mode 100644
index 0000000..6d2f7e8
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SinhTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class SinhTest extends RSBaseCompute {
+ private ScriptC_sinh_f32 script_f32;
+ private ScriptC_sinh_f32_2 script_f32_2;
+ private ScriptC_sinh_f32_3 script_f32_3;
+ private ScriptC_sinh_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.sinh((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testSinhF32() {
+ script_f32 = new ScriptC_sinh_f32(mRS, mRes, R.raw.sinh_f32);
+ doF32(0x32a, 4);
+ }
+
+ public void testSinhF32_2() {
+ script_f32_2 = new ScriptC_sinh_f32_2(mRS, mRes, R.raw.sinh_f32_2);
+ doF32_2(0xba35, 4);
+ }
+
+ public void testSinhF32_3() {
+ script_f32_3 = new ScriptC_sinh_f32_3(mRS, mRes, R.raw.sinh_f32_3);
+ doF32_3(0xacc3, 4);
+ }
+
+ public void testSinhF32_4() {
+ script_f32_4 = new ScriptC_sinh_f32_4(mRS, mRes, R.raw.sinh_f32_4);
+ doF32_4(0xaa, 4);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SqrtTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SqrtTest.java
new file mode 100644
index 0000000..8433734
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SqrtTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class SqrtTest extends RSBaseCompute {
+ private ScriptC_sqrt_f32 script_f32;
+ private ScriptC_sqrt_f32_2 script_f32_2;
+ private ScriptC_sqrt_f32_3 script_f32_3;
+ private ScriptC_sqrt_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.sqrt((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testSqrtF32() {
+ script_f32 = new ScriptC_sqrt_f32(mRS, mRes, R.raw.sqrt_f32);
+ doF32(0xab3, 3);
+ }
+
+ public void testSqrtF32_2() {
+ script_f32_2 = new ScriptC_sqrt_f32_2(mRS, mRes, R.raw.sqrt_f32_2);
+ doF32_2(0xa1, 3);
+ }
+
+ public void testSqrtF32_3() {
+ script_f32_3 = new ScriptC_sqrt_f32_3(mRS, mRes, R.raw.sqrt_f32_3);
+ doF32_3(0xbae7, 3);
+ }
+
+ public void testSqrtF32_4() {
+ script_f32_4 = new ScriptC_sqrt_f32_4(mRS, mRes, R.raw.sqrt_f32_4);
+ doF32_4(0xbac361, 3);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/StepTest.java b/tests/tests/renderscript/src/android/renderscript/cts/StepTest.java
new file mode 100644
index 0000000..b3fd01c
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/StepTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.renderscript.cts;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RSRuntimeException;
+import com.android.cts.stub.R;
+
+public class StepTest extends RSBaseCompute {
+ private ScriptC_step_f32 script_f32;
+ private ScriptC_step_f32_2 script_f32_2;
+ private ScriptC_step_f32_3 script_f32_3;
+ private ScriptC_step_f32_4 script_f32_4;
+ private Allocation mIn;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx = i * stride * 2 + j;
+ ref[i * (stride - skip) + j] = in[idx+stride] < in[idx] ? 0.0f : 1.0f;
+ }
+ }
+ return ref;
+ }
+
+ @Override
+ protected Allocation setInAlloc(Element e) {
+ return mIn;
+ }
+
+ @Override
+ protected float[] makeInArray(int size) {
+ return new float[size*2];
+ }
+
+ public void testStepF32() {
+ script_f32 = new ScriptC_step_f32(mRS, mRes, R.raw.step_f32);
+ ScriptField_step_input in = new ScriptField_step_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32(0x12678, 0);
+ }
+
+ public void testStepF32_2() {
+ script_f32_2 = new ScriptC_step_f32_2(mRS, mRes, R.raw.step_f32_2);
+ ScriptField_step_2_input in = new ScriptField_step_2_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_2(0x1ace8, 0);
+ }
+
+ public void testStepF32_3() {
+ script_f32_3 = new ScriptC_step_f32_3(mRS, mRes, R.raw.step_f32_3);
+ ScriptField_step_3_input in = new ScriptField_step_3_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_3(0xa2ce8, 0);
+ }
+
+ public void testStepF32_4() {
+ script_f32_4 = new ScriptC_step_f32_4(mRS, mRes, R.raw.step_f32_4);
+ ScriptField_step_4_input in = new ScriptField_step_4_input(mRS, INPUTSIZE);
+ mIn = in.getAllocation();
+ doF32_4(0x1ee8, 0);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TanTest.java b/tests/tests/renderscript/src/android/renderscript/cts/TanTest.java
new file mode 100644
index 0000000..07dfb33
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TanTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class TanTest extends RSBaseCompute {
+ private ScriptC_tan_f32 script_f32;
+ private ScriptC_tan_f32_2 script_f32_2;
+ private ScriptC_tan_f32_3 script_f32_3;
+ private ScriptC_tan_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.tan((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testTanF32() {
+ script_f32 = new ScriptC_tan_f32(mRS, mRes, R.raw.tan_f32);
+ doF32(0xabe, 5);
+ }
+
+ public void testTanF32_2() {
+ script_f32_2 = new ScriptC_tan_f32_2(mRS, mRes, R.raw.tan_f32_2);
+ doF32_2(0x29, 5);
+ }
+
+ public void testTanF32_3() {
+ script_f32_3 = new ScriptC_tan_f32_3(mRS, mRes, R.raw.tan_f32_3);
+ doF32_3(0x9a, 5);
+ }
+
+ public void testTanF32_4() {
+ script_f32_4 = new ScriptC_tan_f32_4(mRS, mRes, R.raw.tan_f32_4);
+ doF32_4(0xac3, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TanhTest.java b/tests/tests/renderscript/src/android/renderscript/cts/TanhTest.java
new file mode 100644
index 0000000..2070a81
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TanhTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class TanhTest extends RSBaseCompute {
+ private ScriptC_tanh_f32 script_f32;
+ private ScriptC_tanh_f32_2 script_f32_2;
+ private ScriptC_tanh_f32_3 script_f32_3;
+ private ScriptC_tanh_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] in, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idx= i * stride + j;
+ int idxRef = i * (stride - skip) + j;
+ ref[idxRef] = (float)(Math.tanh((double)in[idx]));
+ }
+ }
+ return ref;
+ }
+
+ public void testTanhF32() {
+ script_f32 = new ScriptC_tanh_f32(mRS, mRes, R.raw.tanh_f32);
+ doF32(0xab61, 5);
+ }
+
+ public void testTanhF32_2() {
+ script_f32_2 = new ScriptC_tanh_f32_2(mRS, mRes, R.raw.tanh_f32_2);
+ doF32_2(0xa301, 5);
+ }
+
+ public void testTanhF32_3() {
+ script_f32_3 = new ScriptC_tanh_f32_3(mRS, mRes, R.raw.tanh_f32_3);
+ doF32_3(0x918, 5);
+ }
+
+ public void testTanhF32_4() {
+ script_f32_4 = new ScriptC_tanh_f32_4(mRS, mRes, R.raw.tanh_f32_4);
+ doF32_4(0x81, 5);
+ }
+}
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/TruncTest.java b/tests/tests/renderscript/src/android/renderscript/cts/TruncTest.java
new file mode 100644
index 0000000..46bc882
--- /dev/null
+++ b/tests/tests/renderscript/src/android/renderscript/cts/TruncTest.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.renderscript.cts;
+
+import com.android.cts.stub.R;
+import android.renderscript.Allocation;
+import android.renderscript.RSRuntimeException;
+
+public class TruncTest extends RSBaseCompute {
+ private ScriptC_trunc_f32 script_f32;
+ private ScriptC_trunc_f32_2 script_f32_2;
+ private ScriptC_trunc_f32_3 script_f32_3;
+ private ScriptC_trunc_f32_4 script_f32_4;
+
+ @Override
+ public void forEach(int testId, Allocation mIn, Allocation mOut) throws RSRuntimeException {
+ switch (testId) {
+ case TEST_F32:
+ script_f32.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_2:
+ script_f32_2.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_3:
+ script_f32_3.forEach_root(mIn, mOut);
+ break;
+ case TEST_F32_4:
+ script_f32_4.forEach_root(mIn, mOut);
+ break;
+ }
+ }
+
+ @Override
+ protected float[] getRefArray(float[] inArray, int input_size, int stride, int skip) {
+ float[] ref = new float[input_size * stride];
+ for (int i = 0; i < input_size; i++) {
+ for (int j = 0; j < stride - skip; j++) {
+ int idxSrc = i * stride + j;
+ int idxDst = i * (stride - skip) + j;
+ int sign = ((Float.floatToIntBits(inArray[idxSrc]) >> 31) & 0x01);
+ float trunc = (int)inArray[idxSrc];
+ if (sign == 1 && trunc == +0.0f) {
+ trunc = -0.0f;
+ }
+ ref[idxDst] = trunc;
+ }
+ }
+ return ref;
+ }
+
+ /**
+ * trunc test for float
+ */
+ public void testTruncF32() {
+ script_f32 = new ScriptC_trunc_f32(mRS, mRes, R.raw.trunc_f32);
+ doF32(0x12345678, 0);
+ }
+
+ /**
+ * trunc test for float2
+ */
+ public void testTruncF32_2() {
+ script_f32_2 = new ScriptC_trunc_f32_2(mRS, mRes, R.raw.trunc_f32_2);
+ doF32_2(0x12345a78, 0);
+ }
+
+ /**
+ * trunc test for float3
+ */
+ public void testTruncF32_3() {
+ script_f32_3 = new ScriptC_trunc_f32_3(mRS, mRes, R.raw.trunc_f32_3);
+ doF32_3(0x12f45678, 0);
+ }
+
+ /**
+ * trunc test for float4
+ */
+ public void testTruncF32_4() {
+ script_f32_4 = new ScriptC_trunc_f32_4(mRS, mRes, R.raw.trunc_f32_4);
+ doF32_4(0x123c5678, 0);
+ }
+}
diff --git a/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java b/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
index 20429f0..9d4bbed 100644
--- a/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
+++ b/tools/vm-tests-tf/src/util/build/BuildDalvikSuite.java
@@ -16,7 +16,7 @@
package util.build;
-import com.android.dx.util.FileUtils;
+import com.android.dex.util.FileUtils;
import dot.junit.AllTests;