summaryrefslogtreecommitdiff
path: root/rsScriptC.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rsScriptC.cpp')
-rw-r--r--rsScriptC.cpp47
1 files changed, 27 insertions, 20 deletions
diff --git a/rsScriptC.cpp b/rsScriptC.cpp
index 521aa2c8..d2d5b1fd 100644
--- a/rsScriptC.cpp
+++ b/rsScriptC.cpp
@@ -53,18 +53,9 @@ using namespace android::renderscript;
ScriptC * sc = (ScriptC *) tls->mScript
ScriptC::ScriptC(Context *rsc) : Script(rsc) {
-#if !defined(RS_COMPATIBILITY_LIB) && !defined(ANDROID_RS_SERIALIZE)
- BT = nullptr;
-#endif
}
ScriptC::~ScriptC() {
-#if !defined(RS_COMPATIBILITY_LIB) && !defined(ANDROID_RS_SERIALIZE)
- if (BT) {
- delete BT;
- BT = nullptr;
- }
-#endif
if (mInitialized) {
mRSC->mHal.funcs.script.invokeFreeChildren(mRSC, this);
mRSC->mHal.funcs.script.destroy(mRSC, this);
@@ -254,7 +245,7 @@ void ScriptC::runReduce(Context *rsc, uint32_t slot, const Allocation *ain,
ATRACE_CALL();
if (slot >= mHal.info.exportedReduceCount) {
- rsc->setError(RS_ERROR_BAD_SCRIPT, "The reduce kernel index is out of bounds");
+ rsc->setError(RS_ERROR_BAD_SCRIPT, "The simple reduce kernel index is out of bounds");
return;
}
if (mRSC->hadFatalError()) return;
@@ -268,6 +259,27 @@ void ScriptC::runReduce(Context *rsc, uint32_t slot, const Allocation *ain,
rsc->mHal.funcs.script.invokeReduce(rsc, this, slot, ain, aout, sc);
}
+void ScriptC::runReduceNew(Context *rsc, uint32_t slot,
+ const Allocation ** ains, size_t inLen,
+ Allocation *aout, const RsScriptCall *sc) {
+ // TODO: Record the name of the kernel in the tracing information.
+ ATRACE_CALL();
+
+ if (slot >= mHal.info.exportedReduceNewCount) {
+ rsc->setError(RS_ERROR_BAD_SCRIPT, "The general reduce kernel index is out of bounds");
+ return;
+ }
+ if (mRSC->hadFatalError()) return;
+
+ setupScript(rsc);
+
+ if (rsc->props.mLogScripts) {
+ ALOGV("%p ScriptC::runReduceNew invoking slot %i, ptr %p", rsc, slot, this);
+ }
+
+ rsc->mHal.funcs.script.invokeReduceNew(rsc, this, slot, ains, inLen, aout, sc);
+}
+
void ScriptC::Invoke(Context *rsc, uint32_t slot, const void *data, size_t len) {
ATRACE_CALL();
@@ -353,19 +365,14 @@ bool ScriptC::runCompiler(Context *rsc,
// Bug 19734267
mApiLevel = sdkVersion;
- if (BT) {
- delete BT;
- }
- BT = new bcinfo::BitcodeTranslator((const char *)bitcode, bitcodeLen,
- sdkVersion);
- if (!BT->translate()) {
+ bcinfo::BitcodeTranslator BT((const char *)bitcode, bitcodeLen,
+ sdkVersion);
+ if (!BT.translate()) {
ALOGE("Failed to translate bitcode from version: %u", sdkVersion);
- delete BT;
- BT = nullptr;
return false;
}
- bitcode = (const uint8_t *) BT->getTranslatedBitcode();
- bitcodeLen = BT->getTranslatedBitcodeSize();
+ bitcode = (const uint8_t *) BT.getTranslatedBitcode();
+ bitcodeLen = BT.getTranslatedBitcodeSize();
if (kDebugBitcode) {
if (!dumpBitcodeFile(cacheDir, resName, "after", bitcode, bitcodeLen)) {