summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2012-10-31 16:02:59 -0700
committerTim Murray <timmurray@google.com>2012-10-31 16:02:59 -0700
commit16b95120323dd6e977dea43c29da5897ac40ec83 (patch)
tree44ad8f6d5cc45994ece2cc22f9cfa047a4bedb88 /tests
parent57d9d6cbb505dc4109d54962b71144111ad12777 (diff)
downloadrs-16b95120323dd6e977dea43c29da5897ac40ec83.tar.gz
Fix up C++ basic API test
Change-Id: I80cd8d74e7b12c2097da5b16725dbbd3c079573c
Diffstat (limited to 'tests')
-rw-r--r--tests/Android.mk15
-rw-r--r--tests/compute.cpp2
-rw-r--r--tests/mono.rs30
3 files changed, 42 insertions, 5 deletions
diff --git a/tests/Android.mk b/tests/Android.mk
index 22637331..ff945f16 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -3,7 +3,12 @@ include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
compute.cpp \
- ScriptC_mono.cpp
+
+LOCAL_RS_CPP_FILES:= \
+ mono.rs
+
+#LOCAL_GENERATED_SOURCES := \
+# rawScriptC_mono.cpp
LOCAL_SHARED_LIBRARIES := \
libRS \
@@ -24,10 +29,10 @@ LOCAL_MODULE:= rstest-compute
LOCAL_MODULE_TAGS := tests
intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,TARGET,)
-librs_generated_headers := \
- $(intermediates)/rsgApiStructs.h \
- $(intermediates)/rsgApiFuncDecl.h
-LOCAL_GENERATED_SOURCES := $(librs_generated_headers)
+#librs_generated_headers := \
+# $(intermediates)/rsgApiStructs.h \
+# $(intermediates)/rsgApiFuncDecl.h
+#LOCAL_GENERATED_SOURCES := $(librs_generated_headers)
LOCAL_C_INCLUDES += frameworks/rs/cpp
LOCAL_C_INCLUDES += frameworks/rs
diff --git a/tests/compute.cpp b/tests/compute.cpp
index 351627b7..8c390db7 100644
--- a/tests/compute.cpp
+++ b/tests/compute.cpp
@@ -56,6 +56,8 @@ int main(int argc, char** argv)
t.clear();
a1.clear();
e.clear();
+ ain.clear();
+ aout.clear();
delete rs;
printf("Delete OK\n");
}
diff --git a/tests/mono.rs b/tests/mono.rs
new file mode 100644
index 00000000..c420cac5
--- /dev/null
+++ b/tests/mono.rs
@@ -0,0 +1,30 @@
+/*
+ * 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.
+ */
+
+#pragma version(1)
+#pragma rs java_package_name(com.android.rs.image)
+#pragma rs_fp_relaxed
+
+const static float3 gMonoMult = {0.299f, 0.587f, 0.114f};
+
+void root(const uchar4 *v_in, uchar4 *v_out) {
+ float4 f4 = rsUnpackColor8888(*v_in);
+
+ float3 mono = dot(f4.rgb, gMonoMult);
+ *v_out = rsPackColorTo8888(mono);
+}
+
+