diff options
| author | Stephen Hines <srhines@google.com> | 2011-11-23 13:58:13 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-11-23 13:58:13 -0800 |
| commit | e70be7e04945cc2bcc82b03b968b3abef3bd554a (patch) | |
| tree | 717309821e3f31a956f90a8add6f3bc7544d1257 /rsScriptC.cpp | |
| parent | bf7423aaf76e12a90a7b4e347e0b276d68f798dc (diff) | |
| parent | f8d4469e2f51740bd7c0e48f6da024a75c4ef372 (diff) | |
Merge "Add support for handling a bitcode wrapper to librs."
Diffstat (limited to 'rsScriptC.cpp')
| -rw-r--r-- | rsScriptC.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/rsScriptC.cpp b/rsScriptC.cpp index a5b19027..ce3c643c 100644 --- a/rsScriptC.cpp +++ b/rsScriptC.cpp @@ -21,6 +21,7 @@ #ifndef ANDROID_RS_SERIALIZE #include <bcinfo/BitcodeTranslator.h> +#include <bcinfo/BitcodeWrapper.h> #endif using namespace android; @@ -198,7 +199,24 @@ bool ScriptC::runCompiler(Context *rsc, //LOGE("runCompiler %p %p %p %p %p %i", rsc, this, resName, cacheDir, bitcode, bitcodeLen); #ifndef ANDROID_RS_SERIALIZE - uint32_t sdkVersion = rsc->getTargetSdkVersion(); + uint32_t sdkVersion = 0; + bcinfo::BitcodeWrapper bcWrapper((const char *)bitcode, bitcodeLen); + if (!bcWrapper.unwrap()) { + LOGE("Bitcode is not in proper container format (raw or wrapper)"); + return false; + } + + rsAssert(bcWrapper.getHeaderVersion() == 0); + if (bcWrapper.getBCFileType() == bcinfo::BC_WRAPPER) { + sdkVersion = bcWrapper.getTargetAPI(); + } + + if (sdkVersion == 0) { + // This signals that we didn't have a wrapper containing information + // about the bitcode. + sdkVersion = rsc->getTargetSdkVersion(); + } + if (BT) { delete BT; } |
