diff options
author | 2009-09-25 14:51:22 -0700 | |
---|---|---|
committer | 2009-09-25 14:51:22 -0700 | |
commit | a9e7a05b84470257637c97d65f6562aa832c66ef (patch) | |
tree | 04a3175485ae7492c3387003c244953b6880c514 /libs/rs/rsScriptC.cpp | |
parent | a0cad2f5d19d95cfe496ebb82f3227dd4ed7c169 (diff) |
Improve renderscript context teardown. Track object in the system and then force their cleanup by releasing all user references once destroy context is called. Java layer will no longer send destroy notifications for objects garbage collected once a context is destroyed.
Diffstat (limited to 'libs/rs/rsScriptC.cpp')
-rw-r--r-- | libs/rs/rsScriptC.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index 22d42ac8287a..fc2744f7c662 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -33,7 +33,7 @@ using namespace android::renderscript; ScriptC * sc = (ScriptC *) tls->mScript -ScriptC::ScriptC() +ScriptC::ScriptC(Context *rsc) : Script(rsc) { mAccScript = NULL; memset(&mProgram, 0, sizeof(mProgram)); @@ -106,7 +106,7 @@ void ScriptCState::clear() } delete mScript; - mScript = new ScriptC(); + mScript = new ScriptC(NULL); mInt32Defines.clear(); mFloatDefines.clear(); @@ -391,6 +391,7 @@ RsScript rsi_ScriptCCreate(Context * rsc) ss->runCompiler(rsc, s); s->incUserRef(); + s->setContext(rsc); for (int ct=0; ct < MAX_SCRIPT_BANKS; ct++) { s->mTypes[ct].set(ss->mConstantBufferTypes[ct].get()); s->mSlotNames[ct] = ss->mSlotNames[ct]; |