diff options
author | Miao Wang <miaowang@google.com> | 2015-01-14 10:03:07 -0800 |
---|---|---|
committer | Miao Wang <miaowang@google.com> | 2015-02-03 15:02:19 -0800 |
commit | f3213d7fd648da98bb3b03204eaf90f03c31926b (patch) | |
tree | 4d721fb9117027f44893499aae3989b3a1cd2971 /cpu_ref/rsCpuScript.cpp | |
parent | efecde77eed8fbb8a87707df5e78c8cab4a6e8bb (diff) | |
download | rs-f3213d7fd648da98bb3b03204eaf90f03c31926b.tar.gz |
Make rsContext be able to have info about the path of native libs
for 64bit Renderscript compat lib.
- Native lib path stored in Java and queried from JNI.
- Then set to Context during context creation.
Change-Id: I3c997cf849efb7b9a0b0ac35d5b62289d70e7434
Diffstat (limited to 'cpu_ref/rsCpuScript.cpp')
-rw-r--r-- | cpu_ref/rsCpuScript.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp index 3190d79b..94a1db8b 100644 --- a/cpu_ref/rsCpuScript.cpp +++ b/cpu_ref/rsCpuScript.cpp @@ -113,10 +113,9 @@ static int copyFile(const char *dstFile, const char *srcFile) { static std::string findSharedObjectName(const char *cacheDir, const char *resName) { - #ifndef RS_SERVER std::string scriptSOName(cacheDir); -#ifdef RS_COMPATIBILITY_LIB +#if defined(RS_COMPATIBILITY_LIB) && !defined(__LP64__) size_t cutPos = scriptSOName.rfind("cache"); if (cutPos != std::string::npos) { scriptSOName.erase(cutPos); @@ -126,11 +125,11 @@ static std::string findSharedObjectName(const char *cacheDir, scriptSOName.append("/lib/librs."); #else scriptSOName.append("/librs."); -#endif +#endif // RS_COMPATIBILITY_LIB #else std::string scriptSOName("lib"); -#endif +#endif // RS_SERVER scriptSOName.append(resName); scriptSOName.append(".so"); @@ -329,10 +328,15 @@ bool SharedLibraryUtils::createSharedLibrary(const char *cacheDir, const char *r #endif // RS_COMPATIBILITY_LIB -void* SharedLibraryUtils::loadSharedLibrary(const char *cacheDir, const char *resName) { + +void* SharedLibraryUtils::loadSharedLibrary(const char *cacheDir, const char *resName, const char *nativeLibDir) { void *loaded = nullptr; +#if defined(RS_COMPATIBILITY_LIB) && defined(__LP64__) + std::string scriptSOName = findSharedObjectName(nativeLibDir, resName); +#else std::string scriptSOName = findSharedObjectName(cacheDir, resName); +#endif // We should check if we can load the library from the standard app // location for shared libraries first. @@ -825,8 +829,8 @@ bool RsdCpuScriptImpl::init(char const *resName, char const *cacheDir, goto error; } #else // RS_COMPATIBILITY_LIB is defined - - mScriptSO = SharedLibraryUtils::loadSharedLibrary(cacheDir, resName); + const char *nativeLibDir = mCtx->getContext()->getNativeLibDir(); + mScriptSO = SharedLibraryUtils::loadSharedLibrary(cacheDir, resName, nativeLibDir); if (!mScriptSO) { goto error; |