summaryrefslogtreecommitdiffstats
path: root/libs/rs
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2012-02-24 14:24:56 -0800
committerJason Sams <rjsams@android.com>2012-02-24 14:24:56 -0800
commit9733f2609312d1ad93344eb64aa40ecb665b1c4b (patch)
tree1ee8497782f5877d89547ab0d6c2689fed8a30a7 /libs/rs
parent170dc848aefe17d830d08cd29b332730498003d2 (diff)
downloadframeworks_base-9733f2609312d1ad93344eb64aa40ecb665b1c4b.zip
frameworks_base-9733f2609312d1ad93344eb64aa40ecb665b1c4b.tar.gz
frameworks_base-9733f2609312d1ad93344eb64aa40ecb665b1c4b.tar.bz2
test runs but I do not check results yet.
Change-Id: I427581a301bb1a9710554187accad2d6f9d9b10c
Diffstat (limited to 'libs/rs')
-rw-r--r--libs/rs/Allocation.cpp2
-rw-r--r--libs/rs/BaseObj.cpp1
-rw-r--r--libs/rs/Element.cpp2
-rw-r--r--libs/rs/RenderScript.cpp2
-rw-r--r--libs/rs/Script.cpp2
-rw-r--r--libs/rs/ScriptC.cpp2
-rw-r--r--libs/rs/ScriptC.h1
-rw-r--r--libs/rs/Type.cpp3
-rw-r--r--libs/rs/tests/Android.mk3
-rw-r--r--libs/rs/tests/ScriptC_mono.cpp87
-rw-r--r--libs/rs/tests/ScriptC_mono.h26
-rw-r--r--libs/rs/tests/compute.cpp23
12 files changed, 150 insertions, 4 deletions
diff --git a/libs/rs/Allocation.cpp b/libs/rs/Allocation.cpp
index 46df171..d69c55f 100644
--- a/libs/rs/Allocation.cpp
+++ b/libs/rs/Allocation.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "libRS_cpp"
+
#include <utils/Log.h>
#include <malloc.h>
diff --git a/libs/rs/BaseObj.cpp b/libs/rs/BaseObj.cpp
index 66e6fac..82e51e7 100644
--- a/libs/rs/BaseObj.cpp
+++ b/libs/rs/BaseObj.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#define LOG_TAG "libRS_cpp"
#include <rs.h>
diff --git a/libs/rs/Element.cpp b/libs/rs/Element.cpp
index d193892..f318d40 100644
--- a/libs/rs/Element.cpp
+++ b/libs/rs/Element.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "libRS_cpp"
+
#include <utils/Log.h>
#include <malloc.h>
#include <string.h>
diff --git a/libs/rs/RenderScript.cpp b/libs/rs/RenderScript.cpp
index 39f1024..0b42055 100644
--- a/libs/rs/RenderScript.cpp
+++ b/libs/rs/RenderScript.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "libRS_cpp"
+
#include <utils/Log.h>
#include <malloc.h>
#include <string.h>
diff --git a/libs/rs/Script.cpp b/libs/rs/Script.cpp
index b6112dd..25fa673 100644
--- a/libs/rs/Script.cpp
+++ b/libs/rs/Script.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "libRS_cpp"
+
#include <utils/Log.h>
#include <malloc.h>
diff --git a/libs/rs/ScriptC.cpp b/libs/rs/ScriptC.cpp
index 53d75b8..ad82ff4 100644
--- a/libs/rs/ScriptC.cpp
+++ b/libs/rs/ScriptC.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "libRS_cpp"
+
#include <utils/Log.h>
#include <malloc.h>
diff --git a/libs/rs/ScriptC.h b/libs/rs/ScriptC.h
index 25f00ec..dcbbe10 100644
--- a/libs/rs/ScriptC.h
+++ b/libs/rs/ScriptC.h
@@ -24,7 +24,6 @@
class ScriptC : public Script {
protected:
- ScriptC(RenderScript *rs, void *txt, size_t len);
ScriptC(RenderScript *rs,
const char *codeTxt, size_t codeLength,
const char *cachedName, size_t cachedNameLength,
diff --git a/libs/rs/Type.cpp b/libs/rs/Type.cpp
index 3249f97..1352bd7 100644
--- a/libs/rs/Type.cpp
+++ b/libs/rs/Type.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#define LOG_TAG "libRS_cpp"
+
#include <utils/Log.h>
#include <malloc.h>
#include <string.h>
@@ -124,7 +126,6 @@ void Type::Builder::setFaces(bool value) {
}
const Type * Type::Builder::create() {
- ALOGE(" %i %i %i %i %i", mDimX, mDimY, mDimZ, mDimFaces, mDimMipmaps);
if (mDimZ > 0) {
if ((mDimX < 1) || (mDimY < 1)) {
ALOGE("Both X and Y dimension required when Z is present.");
diff --git a/libs/rs/tests/Android.mk b/libs/rs/tests/Android.mk
index a773e84..197e862 100644
--- a/libs/rs/tests/Android.mk
+++ b/libs/rs/tests/Android.mk
@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= \
- compute.cpp
+ compute.cpp \
+ ScriptC_mono.cpp
LOCAL_SHARED_LIBRARIES := \
libRS \
diff --git a/libs/rs/tests/ScriptC_mono.cpp b/libs/rs/tests/ScriptC_mono.cpp
new file mode 100644
index 0000000..7f83616
--- /dev/null
+++ b/libs/rs/tests/ScriptC_mono.cpp
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2008-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.
+ */
+
+#include "ScriptC_mono.h"
+
+static const char mono[] = \
+ "\xDE\xC0\x17\x0B\x00\x00\x00\x00\x18\x00\x00\x00\xFC\x03\x00\x00\x00\x00\x00\x00" \
+ "\x10\x00\x00\x00\x42\x43\xC0\xDE\x21\x0C\x00\x00\xFC\x00\x00\x00\x01\x10\x00\x00" \
+ "\x12\x00\x00\x00\x07\x81\x23\x91\x41\xC8\x04\x49\x06\x10\x32\x39\x92\x01\x84\x0C" \
+ "\x25\x05\x08\x19\x1E\x04\x8B\x62\x80\x14\x45\x02\x42\x92\x0B\x42\xA4\x10\x32\x14" \
+ "\x38\x08\x18\x49\x0A\x32\x44\x24\x48\x0A\x90\x21\x23\xC4\x52\x80\x0C\x19\x21\x72" \
+ "\x24\x07\xC8\x48\x11\x62\xA8\xA0\xA8\x40\xC6\xF0\x01\x00\x00\x00\x49\x18\x00\x00" \
+ "\x08\x00\x00\x00\x0B\x8C\x00\x04\x41\x10\x04\x09\x01\x04\x41\x10\x04\x89\xFF\xFF" \
+ "\xFF\xFF\x1F\xC0\x60\x81\xF0\xFF\xFF\xFF\xFF\x03\x18\x00\x00\x00\x89\x20\x00\x00" \
+ "\x13\x00\x00\x00\x32\x22\x48\x09\x20\x64\x85\x04\x93\x22\xA4\x84\x04\x93\x22\xE3" \
+ "\x84\xA1\x90\x14\x12\x4C\x8A\x8C\x0B\x84\xA4\x4C\x10\x48\x23\x00\x73\x04\xC8\x30" \
+ "\x02\x11\x90\x28\x03\x18\x83\xC8\x0C\xC0\x30\x02\x61\x14\xE1\x08\x42\xC3\x08\x83" \
+ "\x51\x06\xA3\x14\xAD\x22\x08\x45\x6D\x20\x60\x8E\x00\x0C\x86\x11\x06\x08\x00\x00" \
+ "\x13\xB0\x70\x90\x87\x76\xB0\x87\x3B\x68\x03\x77\x78\x07\x77\x28\x87\x36\x60\x87" \
+ "\x74\x70\x87\x7A\xC0\x87\x36\x38\x07\x77\xA8\x87\x72\x08\x07\x71\x48\x87\x0D\xF2" \
+ "\x50\x0E\x6D\x00\x0F\x7A\x30\x07\x72\xA0\x07\x73\x20\x07\x7A\x30\x07\x72\xD0\x06" \
+ "\xE9\x10\x07\x7A\x80\x07\x7A\x80\x07\x6D\x90\x0E\x78\xA0\x07\x78\xA0\x07\x78\xD0" \
+ "\x06\xE9\x10\x07\x76\xA0\x07\x71\x60\x07\x7A\x10\x07\x76\xD0\x06\xE9\x30\x07\x72" \
+ "\xA0\x07\x73\x20\x07\x7A\x30\x07\x72\xD0\x06\xE9\x60\x07\x74\xA0\x07\x76\x40\x07" \
+ "\x7A\x60\x07\x74\xD0\x06\xE6\x30\x07\x72\xA0\x07\x73\x20\x07\x7A\x30\x07\x72\xD0" \
+ "\x06\xE6\x60\x07\x74\xA0\x07\x76\x40\x07\x7A\x60\x07\x74\xD0\x06\xF6\x60\x07\x74" \
+ "\xA0\x07\x76\x40\x07\x7A\x60\x07\x74\xD0\x06\xF6\x10\x07\x72\x80\x07\x7A\x60\x07" \
+ "\x74\xA0\x07\x71\x20\x07\x78\xD0\x06\xE1\x00\x07\x7A\x00\x07\x7A\x60\x07\x74\xD0" \
+ "\x06\xEE\x30\x07\x72\xD0\x06\xB3\x60\x07\x74\x30\x44\x29\x00\x00\x08\x00\x00\x00" \
+ "\x80\x21\x4A\x02\x04\x00\x00\x00\x00\x00\x0C\x51\x18\x20\x00\x00\x00\x00\x00\x60" \
+ "\x88\xE2\x00\x01\x00\x00\x00\x00\x00\x79\x18\x00\x45\x00\x00\x00\x43\x88\x27\x78" \
+ "\x84\x05\x87\x3D\x94\x83\x3C\xCC\x43\x3A\xBC\x83\x3B\x2C\x08\xE2\x60\x08\xF1\x10" \
+ "\x4F\xB1\x20\x52\x87\x70\xB0\x87\x70\xF8\x05\x78\x08\x87\x71\x58\x87\x70\x38\x87" \
+ "\x72\xF8\x05\x77\x08\x87\x76\x28\x87\x05\x63\x30\x0E\xEF\xD0\x0E\x6E\x50\x0E\xF8" \
+ "\x10\x0E\xED\x00\x0F\xEC\x50\x0E\x6E\x10\x0E\xEE\x40\x0E\xF2\xF0\x0E\xE9\x40\x0E" \
+ "\x6E\x20\x0F\xF3\xE0\x06\xE8\x50\x0E\xEC\xC0\x0E\xEF\x30\x0E\xEF\xD0\x0E\xF0\x50" \
+ "\x0F\xF4\x50\x0E\x43\x84\xE7\x58\x40\xC8\xC3\x3B\xBC\x03\x3D\x0C\x11\x9E\x64\x41" \
+ "\x30\x07\x43\x88\x67\x79\x98\x05\xCF\x3B\xB4\x83\x3B\xA4\x03\x3C\xBC\x03\x3D\x94" \
+ "\x83\x3B\xD0\x03\x18\x8C\x03\x3A\x84\x83\x3C\x0C\x21\x9E\x06\x00\x16\x44\xB3\x90" \
+ "\x0E\xED\x00\x0F\xEC\x50\x0E\x60\x30\x0A\x6F\x30\x0A\x6B\xB0\x06\x60\x40\x0B\xA2" \
+ "\x10\x0A\xA1\x30\xE2\x18\x03\x78\x90\x87\x70\x38\x87\x76\x08\x87\x29\x02\x30\x8C" \
+ "\xB8\xC6\x40\x1E\xE6\xE1\x17\xCA\x01\x1F\xE0\xE1\x1D\xE4\x81\x1E\x7E\xC1\x1C\xDE" \
+ "\x41\x1E\xCA\x21\x1C\xC6\x01\x1D\x7E\xC1\x1D\xC2\xA1\x1D\xCA\x61\x4A\x60\x8C\x90" \
+ "\xC6\x40\x1E\xE6\xE1\x17\xCA\x01\x1F\xE0\xE1\x1D\xE4\x81\x1E\x7E\xC1\x1C\xDE\x41" \
+ "\x1E\xCA\x21\x1C\xC6\x01\x1D\xA6\x04\x08\x00\x00\x61\x20\x00\x00\x24\x00\x00\x00" \
+ "\x13\x04\x41\x2C\x10\x00\x00\x00\x0C\x00\x00\x00\x04\x8B\xA0\x04\x46\x00\xE8\xCC" \
+ "\x00\x90\x9A\x01\x98\x63\x70\x1A\x86\xCC\x18\x41\x6D\xFA\xB2\xEF\x8D\x11\x88\x6D" \
+ "\xCC\xC6\xDF\x18\xC1\x49\x97\x72\xFA\x51\x9C\x63\x40\x0E\x63\x04\x00\x00\x00\x00" \
+ "\x44\x8C\x11\x03\x42\x08\x82\x68\x90\x41\x4A\x9E\x11\x83\x42\x08\x84\x69\x99\x63" \
+ "\x50\x28\x64\x90\xA1\x52\xA0\x11\x03\x42\x08\x06\x6B\x30\xA2\xB8\x06\x00\xC3\x81" \
+ "\x00\x00\x00\x00\x03\x00\x00\x00\x46\x40\x54\x3F\xD2\x58\x41\x51\xFD\x0E\x35\x01" \
+ "\x01\x31\x00\x00\x03\x00\x00\x00\x5B\x06\x20\x50\xB6\x0C\x47\xA0\x00\x00\x00\x00" \
+ "\x00\x00\x00\x00\x79\x18\x00\x00\x0B\x00\x00\x00\x33\x08\x80\x1C\xC4\xE1\x1C\x66" \
+ "\x14\x01\x3D\x88\x43\x38\x84\xC3\x8C\x42\x80\x07\x79\x78\x07\x73\x98\xB1\x0C\xE6" \
+ "\x00\x0F\xE1\x30\x0E\xE3\x50\x0F\xF2\x10\x0E\xE3\x90\x0F\x00\x00\x71\x20\x00\x00" \
+ "\x0E\x00\x00\x00\x06\x40\x44\x8E\x33\x59\x40\x14\x49\x6E\xF3\x00\x82\xC2\x39\x8B" \
+ "\x13\xF1\x3C\xCF\x9B\x40\xF3\xCF\xF7\xE0\x4C\x5D\x75\xFF\x05\xFB\xDB\x80\xF6\xCF" \
+ "\xF5\x1E\x49\x29\x20\x28\x9C\xB3\x38\x51\xEB\xF0\x3C\xCF\x77\xD5\xFD\x17\x00\x00" \
+ "\x00\x00\x00\x00";
+
+
+ScriptC_mono::ScriptC_mono(RenderScript *rs, const char *cacheDir, size_t cacheDirLength) :
+ ScriptC(rs, mono, sizeof(mono) - 1, "mono", 4, cacheDir, cacheDirLength) {
+
+ printf("sizeof text %i", sizeof(mono));
+
+
+
+}
+
+void ScriptC_mono::forEach_root(const Allocation *ain, const Allocation *aout) {
+ forEach(0, ain, aout, NULL, 0);
+}
+
diff --git a/libs/rs/tests/ScriptC_mono.h b/libs/rs/tests/ScriptC_mono.h
new file mode 100644
index 0000000..7e4f601
--- /dev/null
+++ b/libs/rs/tests/ScriptC_mono.h
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2008-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.
+ */
+
+#include "ScriptC.h"
+
+class ScriptC_mono : protected ScriptC {
+public:
+ ScriptC_mono(RenderScript *rs, const char *cacheDir, size_t cacheDirLength);
+
+ void forEach_root(const Allocation *ain, const Allocation *aout);
+
+};
+
diff --git a/libs/rs/tests/compute.cpp b/libs/rs/tests/compute.cpp
index 28b135f..42eaa52 100644
--- a/libs/rs/tests/compute.cpp
+++ b/libs/rs/tests/compute.cpp
@@ -4,6 +4,8 @@
#include "Type.h"
#include "Allocation.h"
+#include "ScriptC_mono.h"
+
int main(int argc, char** argv)
{
@@ -23,12 +25,31 @@ int main(int argc, char** argv)
printf("Type %p\n", t);
- const Allocation *a1 = Allocation::createSized(rs, e, 1000);
+ Allocation *a1 = Allocation::createSized(rs, e, 1000);
printf("Allocation %p\n", a1);
+ Allocation *ain = Allocation::createTyped(rs, t);
+ Allocation *aout = Allocation::createTyped(rs, t);
+ printf("Allocation %p %p\n", ain, aout);
+
+ ScriptC_mono * sc = new ScriptC_mono(rs, NULL, 0);
+ printf("new script\n");
+
+ uint32_t *buf = new uint32_t[t->getCount()];
+ for (uint32_t ct=0; ct < t->getCount(); ct++) {
+ buf[ct] = ct | (ct << 16);
+ }
+ //ain->copy1DRangeFrom(0, 128*128, (int32_t *)buf, 128*128*4);
+ ain->copy1DRangeFromUnchecked(0, t->getCount(), buf, t->getCount()*4);
+
+
+
+ sc->forEach_root(ain, aout);
+ printf("for each done\n");
printf("Deleting stuff\n");
+ delete sc;
delete t;
delete a1;
delete e;