From 5ef3dddd0dbc271fdbcfe45cdca5b1edc9aed296 Mon Sep 17 00:00:00 2001 From: Stephen Hines Date: Mon, 17 Jan 2011 17:31:58 -0800 Subject: Remove erroneous log message. This change also enables pragmas to be checked for scripts that do not have a root() function. Change-Id: I4f41300b623581483970050680ac96c54f99d34a --- libs/rs/rsScriptC.cpp | 151 ++++++++++++++++++++++++-------------------------- 1 file changed, 72 insertions(+), 79 deletions(-) (limited to 'libs/rs') diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index 1ab2109..042f6c7 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -471,45 +471,42 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s, const char *resName, const char *cacheDir) { - { - s->mBccScript = bccCreateScript(); + s->mBccScript = bccCreateScript(); - s->mEnviroment.mIsThreadable = true; + s->mEnviroment.mIsThreadable = true; - bccRegisterSymbolCallback(s->mBccScript, symbolLookup, s); + bccRegisterSymbolCallback(s->mBccScript, symbolLookup, s); - if (bccReadBC(s->mBccScript, - resName, - s->mEnviroment.mScriptText, - s->mEnviroment.mScriptTextLength, 0) != 0) { - LOGE("bcc: FAILS to read bitcode"); - // Handle Fatal Error - } + if (bccReadBC(s->mBccScript, + resName, + s->mEnviroment.mScriptText, + s->mEnviroment.mScriptTextLength, 0) != 0) { + LOGE("bcc: FAILS to read bitcode"); + // Handle Fatal Error + } #if 1 - if (bccLinkBC(s->mBccScript, - resName, - NULL /*rs_runtime_lib_bc*/, - 1 /*rs_runtime_lib_bc_size*/ - /*"1" means skip buffer here, and let libbcc decide*/, - 0) != 0) { - LOGE("bcc: FAILS to link bitcode"); - // Handle Fatal Error - } + if (bccLinkBC(s->mBccScript, + resName, + NULL /*rs_runtime_lib_bc*/, + 1 /*rs_runtime_lib_bc_size*/ + /*"1" means skip buffer here, and let libbcc decide*/, + 0) != 0) { + LOGE("bcc: FAILS to link bitcode"); + // Handle Fatal Error + } #endif - char *cachePath = genCacheFileName(cacheDir, resName, ".oBCC"); + char *cachePath = genCacheFileName(cacheDir, resName, ".oBCC"); - if (bccPrepareExecutable(s->mBccScript, cachePath, 0) != 0) { - LOGE("bcc: FAILS to prepare executable"); - // Handle Fatal Error - } + if (bccPrepareExecutable(s->mBccScript, cachePath, 0) != 0) { + LOGE("bcc: FAILS to prepare executable"); + // Handle Fatal Error + } - free(cachePath); + free(cachePath); - s->mProgram.mRoot = reinterpret_cast(bccGetFuncAddr(s->mBccScript, "root")); - s->mProgram.mInit = reinterpret_cast(bccGetFuncAddr(s->mBccScript, "init")); - } - LOGV("%p ScriptCState::runCompiler root %p, init %p", rsc, s->mProgram.mRoot, s->mProgram.mInit); + s->mProgram.mRoot = reinterpret_cast(bccGetFuncAddr(s->mBccScript, "root")); + s->mProgram.mInit = reinterpret_cast(bccGetFuncAddr(s->mBccScript, "init")); if (s->mProgram.mInit) { s->mProgram.mInit(); @@ -537,66 +534,62 @@ void ScriptCState::runCompiler(Context *rsc, s->mEnviroment.mFragmentStore.set(rsc->getDefaultProgramStore()); s->mEnviroment.mRaster.set(rsc->getDefaultProgramRaster()); - if (s->mProgram.mRoot) { - const static int pragmaMax = 16; - size_t pragmaCount = bccGetPragmaCount(s->mBccScript); - char const *keys[pragmaMax]; - char const *values[pragmaMax]; - bccGetPragmaList(s->mBccScript, pragmaMax, keys, values); + const static int pragmaMax = 16; + size_t pragmaCount = bccGetPragmaCount(s->mBccScript); + char const *keys[pragmaMax]; + char const *values[pragmaMax]; + bccGetPragmaList(s->mBccScript, pragmaMax, keys, values); - for (size_t i=0; i < pragmaCount; ++i) { - //LOGE("pragma %s %s", keys[i], values[i]); - if (!strcmp(keys[i], "version")) { + for (size_t i=0; i < pragmaCount; ++i) { + //LOGE("pragma %s %s", keys[i], values[i]); + if (!strcmp(keys[i], "version")) { + // TODO: Verify that version is correct + continue; + } + + if (!strcmp(keys[i], "stateVertex")) { + if (!strcmp(values[i], "default")) { continue; } - - if (!strcmp(keys[i], "stateVertex")) { - if (!strcmp(values[i], "default")) { - continue; - } - if (!strcmp(values[i], "parent")) { - s->mEnviroment.mVertex.clear(); - continue; - } - LOGE("Unreconized value %s passed to stateVertex", values[i]); + if (!strcmp(values[i], "parent")) { + s->mEnviroment.mVertex.clear(); + continue; } + LOGE("Unreconized value %s passed to stateVertex", values[i]); + } - if (!strcmp(keys[i], "stateRaster")) { - if (!strcmp(values[i], "default")) { - continue; - } - if (!strcmp(values[i], "parent")) { - s->mEnviroment.mRaster.clear(); - continue; - } - LOGE("Unreconized value %s passed to stateRaster", values[i]); + if (!strcmp(keys[i], "stateRaster")) { + if (!strcmp(values[i], "default")) { + continue; } + if (!strcmp(values[i], "parent")) { + s->mEnviroment.mRaster.clear(); + continue; + } + LOGE("Unreconized value %s passed to stateRaster", values[i]); + } - if (!strcmp(keys[i], "stateFragment")) { - if (!strcmp(values[i], "default")) { - continue; - } - if (!strcmp(values[i], "parent")) { - s->mEnviroment.mFragment.clear(); - continue; - } - LOGE("Unreconized value %s passed to stateFragment", values[i]); + if (!strcmp(keys[i], "stateFragment")) { + if (!strcmp(values[i], "default")) { + continue; + } + if (!strcmp(values[i], "parent")) { + s->mEnviroment.mFragment.clear(); + continue; } + LOGE("Unreconized value %s passed to stateFragment", values[i]); + } - if (!strcmp(keys[i], "stateStore")) { - if (!strcmp(values[i], "default")) { - continue; - } - if (!strcmp(values[i], "parent")) { - s->mEnviroment.mFragmentStore.clear(); - continue; - } - LOGE("Unreconized value %s passed to stateStore", values[i]); + if (!strcmp(keys[i], "stateStore")) { + if (!strcmp(values[i], "default")) { + continue; } + if (!strcmp(values[i], "parent")) { + s->mEnviroment.mFragmentStore.clear(); + continue; + } + LOGE("Unreconized value %s passed to stateStore", values[i]); } - } else { - LOGE("bcc: FAILS to prepare executable"); - // Handle Fatal Error } } -- cgit v1.1