Fix invokables to make sure script pointers are setup before invoking function calls. Reduce app startup time up to 1s.
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 108ae5a..bff337c 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -46,6 +46,15 @@
}
}
+void ScriptC::setupScript()
+{
+ for (int ct=0; ct < MAX_SCRIPT_BANKS; ct++) {
+ if (mProgram.mSlotPointers[ct]) {
+ *mProgram.mSlotPointers[ct] = mSlots[ct]->getPtr();
+ }
+ }
+}
+
bool ScriptC::run(Context *rsc, uint32_t launchIndex)
{
@@ -66,12 +75,7 @@
mEnviroment.mStartTimeMillis
= nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_MONOTONIC));
}
-
- for (int ct=0; ct < MAX_SCRIPT_BANKS; ct++) {
- if (mProgram.mSlotPointers[ct]) {
- *mProgram.mSlotPointers[ct] = mSlots[ct]->getPtr();
- }
- }
+ setupScript();
bool ret = false;
tls->mScript = this;