summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsScriptC.cpp
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2011-08-01 15:02:34 -0700
committerStephen Hines <srhines@google.com>2011-08-03 18:46:56 -0700
commit4382467a80dd12c6362d57edca7f2367f7ae877c (patch)
treef91d338f48444ccb373040ba356910c3fc52c8df /libs/rs/rsScriptC.cpp
parent00451ed2d1f21945766bc0c59e762ef39cb391b8 (diff)
downloadframeworks_base-4382467a80dd12c6362d57edca7f2367f7ae877c.zip
frameworks_base-4382467a80dd12c6362d57edca7f2367f7ae877c.tar.gz
frameworks_base-4382467a80dd12c6362d57edca7f2367f7ae877c.tar.bz2
Start using bcinfo components within librs.
BUG=4942491 Change-Id: I3a46783511c4954bac9eadbbbefe5abf85498c16
Diffstat (limited to 'libs/rs/rsScriptC.cpp')
-rw-r--r--libs/rs/rsScriptC.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index e8b1014..dccf71f 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -19,6 +19,10 @@
#include "utils/Timers.h"
#include "utils/StopWatch.h"
+#ifndef ANDROID_RS_SERIALIZE
+#include <bcinfo/BitcodeTranslator.h>
+#endif
+
using namespace android;
using namespace android::renderscript;
@@ -28,9 +32,18 @@ using namespace android::renderscript;
ScriptC * sc = (ScriptC *) tls->mScript
ScriptC::ScriptC(Context *rsc) : Script(rsc) {
+#ifndef ANDROID_RS_SERIALIZE
+ BT = NULL;
+#endif
}
ScriptC::~ScriptC() {
+#ifndef ANDROID_RS_SERIALIZE
+ if (BT) {
+ delete BT;
+ BT = NULL;
+ }
+#endif
mRSC->mHal.funcs.script.destroy(mRSC, this);
}
@@ -181,6 +194,22 @@ bool ScriptC::runCompiler(Context *rsc,
size_t bitcodeLen) {
//LOGE("runCompiler %p %p %p %p %p %i", rsc, this, resName, cacheDir, bitcode, bitcodeLen);
+#ifndef ANDROID_RS_SERIALIZE
+ uint32_t sdkVersion = rsc->getTargetSdkVersion();
+ if (BT) {
+ delete BT;
+ }
+ BT = new bcinfo::BitcodeTranslator((const char *)bitcode, bitcodeLen,
+ sdkVersion);
+ if (!BT->translate()) {
+ LOGE("Failed to translate bitcode from version: %u", sdkVersion);
+ delete BT;
+ BT = NULL;
+ return false;
+ }
+ bitcode = (const uint8_t *) BT->getTranslatedBitcode();
+ bitcodeLen = BT->getTranslatedBitcodeSize();
+#endif
rsc->mHal.funcs.script.init(rsc, this, resName, cacheDir, bitcode, bitcodeLen, 0);