From 6b32fab1dbfd8bc1cc176557fe0a7b2ebd4966bd Mon Sep 17 00:00:00 2001 From: Shih-wei Liao Date: Fri, 10 Dec 2010 01:03:59 -0800 Subject: 1. Add Context to a RenderScript or RenderScriptGL instance. This is to allow RenderScript to better interact with the Android environment. E.g., per-app cache. 2. Plumbing, testing. 3. Added getApplicationContext in RenderScript.java. Change-Id: I85edeebe38825e20b2e86f4f4815689dfc332ef9 --- libs/rs/rsScriptC.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libs/rs/rsScriptC.cpp') diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index b3dbf115b6f7..507430dfabc9 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -402,7 +402,7 @@ static BCCvoid* symbolLookup(BCCvoid* pContext, const BCCchar* name) { extern const char rs_runtime_lib_bc[]; extern unsigned rs_runtime_lib_bc_size; -void ScriptCState::runCompiler(Context *rsc, ScriptC *s, const char *resName) { +void ScriptCState::runCompiler(Context *rsc, ScriptC *s, const char *resName, const char *cacheDir) { { s->mBccScript = bccCreateScript(); s->mEnviroment.mIsThreadable = true; @@ -413,7 +413,8 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s, const char *resName) { if (bccReadBC(s->mBccScript, s->mEnviroment.mScriptText, s->mEnviroment.mScriptTextLength, - resName) >= 0) { + resName, + cacheDir) >= 0) { //bccLinkBC(s->mBccScript, rs_runtime_lib_bc, rs_runtime_lib_bc_size); bccCompileBC(s->mBccScript); } else { @@ -534,7 +535,7 @@ void rsi_ScriptCSetText(Context *rsc, const char *text, uint32_t len) { ss->mScript->mEnviroment.mScriptTextLength = len; } -RsScript rsi_ScriptCCreate(Context * rsc, const char *resName) +RsScript rsi_ScriptCCreate(Context * rsc, const char *resName, const char *cacheDir) { ScriptCState *ss = &rsc->mScriptC; @@ -542,7 +543,7 @@ RsScript rsi_ScriptCCreate(Context * rsc, const char *resName) ss->mScript.clear(); s->incUserRef(); - ss->runCompiler(rsc, s.get(), resName); + ss->runCompiler(rsc, s.get(), resName, cacheDir); ss->clear(rsc); return s.get(); } -- cgit v1.2.3-59-g8ed1b