Add LinkRuntimeCallback() and supporting functions to RS compiler.
Change-Id: I7745406a94ba74896ee98752a3de106d2672159d
diff --git a/lib/Renderscript/RSCompilerDriver.cpp b/lib/Renderscript/RSCompilerDriver.cpp
index 7963408..474b884 100644
--- a/lib/Renderscript/RSCompilerDriver.cpp
+++ b/lib/Renderscript/RSCompilerDriver.cpp
@@ -331,7 +331,8 @@
const char *pResName,
const char *pBitcode,
size_t pBitcodeSize,
- const char *pRuntimePath) {
+ const char *pRuntimePath,
+ RSLinkRuntimeCallback pLinkRuntimeCallback) {
android::StopWatch build_time("bcc: RSCompilerDriver::build time");
//===--------------------------------------------------------------------===//
// Check parameters.
@@ -398,6 +399,8 @@
return NULL;
}
+ script->setLinkRuntimeCallback(pLinkRuntimeCallback);
+
// Read information from bitcode wrapper.
bcinfo::BitcodeWrapper wrapper(pBitcode, pBitcodeSize);
script->setCompilerVersion(wrapper.getCompilerVersion());
diff --git a/lib/Renderscript/RSScript.cpp b/lib/Renderscript/RSScript.cpp
index 53c8946..d4db9fa 100644
--- a/lib/Renderscript/RSScript.cpp
+++ b/lib/Renderscript/RSScript.cpp
@@ -47,6 +47,11 @@
return false;
}
+ if (NULL != pScript.mLinkRuntimeCallback) {
+ pScript.mLinkRuntimeCallback(&pScript,
+ &pScript.getSource().getModule(), &libclcore_source->getModule());
+ }
+
if (!pScript.getSource().merge(*libclcore_source,
/* pPreserveSource */false)) {
ALOGE("Failed to link Renderscript library '%s'!", core_lib);
@@ -59,7 +64,8 @@
RSScript::RSScript(Source &pSource)
: Script(pSource), mInfo(NULL), mCompilerVersion(0),
- mOptimizationLevel(kOptLvl3) { }
+ mOptimizationLevel(kOptLvl3), mLinkRuntimeCallback(NULL),
+ mEmbedInfo(false) { }
bool RSScript::doReset() {
mInfo = NULL;
diff --git a/lib/Renderscript/runtime/rs_structs.h b/lib/Renderscript/runtime/rs_structs.h
index a61ebea..4ee066e 100644
--- a/lib/Renderscript/runtime/rs_structs.h
+++ b/lib/Renderscript/runtime/rs_structs.h
@@ -1,5 +1,5 @@
-#ifndef _RS_CORE_H_
-#define _RS_CORE_H_
+#ifndef _RS_STRUCTS_H_
+#define _RS_STRUCTS_H_
/*****************************************************************************
* CAUTION