summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-05-17 14:55:34 -0700
committerJason Sams <rjsams@android.com>2010-05-17 14:55:34 -0700
commitce92d4baf7a5bce097228fdd4498601764cd4014 (patch)
treecb18dc86df54c5740f1b061d7e0eeda1a0d83314
parent568613e5c043c473e5e6632b3a38de2a97864908 (diff)
downloadrs-ce92d4baf7a5bce097228fdd4498601764cd4014.tar.gz
Remove more pieces of setRoot. Add pointer to allocation lookup for scripts.
Change-Id: I2c3075d2056f02bb834bfad403dc72da991f3156
-rw-r--r--java/Film/src/com/android/film/FilmRS.java1
-rw-r--r--rs.spec4
-rw-r--r--rsScript.cpp11
-rw-r--r--rsScriptC.cpp16
-rw-r--r--rsScriptC.h2
-rw-r--r--rsScriptC_Lib.cpp10
-rw-r--r--scriptc/rs_math.rsh1
7 files changed, 29 insertions, 16 deletions
diff --git a/java/Film/src/com/android/film/FilmRS.java b/java/Film/src/com/android/film/FilmRS.java
index e2daabe2..e26b051c 100644
--- a/java/Film/src/com/android/film/FilmRS.java
+++ b/java/Film/src/com/android/film/FilmRS.java
@@ -217,7 +217,6 @@ public class FilmRS {
ScriptC.Builder sb = new ScriptC.Builder(mRS);
sb.setScript(mRes, R.raw.filmstrip);
- //sb.setRoot(true);
//sb.setType(mStripPositionType, "Pos", 1);
mScriptStrip = sb.create();
mScriptStrip.setClearColor(0.0f, 0.0f, 0.0f, 1.0f);
diff --git a/rs.spec b/rs.spec
index 2aa12da1..4ad25aeb 100644
--- a/rs.spec
+++ b/rs.spec
@@ -293,10 +293,6 @@ ScriptInvokeV {
togglePlay
}
-ScriptSetRoot {
- param bool isRoot
- }
-
ScriptSetVarI {
param RsScript s
param uint32_t slot
diff --git a/rsScript.cpp b/rsScript.cpp
index 1dd9554f..b0bbb22a 100644
--- a/rsScript.cpp
+++ b/rsScript.cpp
@@ -97,12 +97,6 @@ void rsi_ScriptSetType(Context * rsc, RsType vt, uint32_t slot, bool writable, c
LOGE("rsi_ScriptSetType");
}
-void rsi_ScriptSetInvoke(Context *rsc, const char *name, uint32_t slot)
-{
- LOGE("rsi_ScriptSetInvoke");
-}
-
-
void rsi_ScriptInvoke(Context *rsc, RsScript vs, uint32_t slot)
{
//LOGE("rsi_ScriptInvoke %i", slot);
@@ -177,11 +171,6 @@ void rsi_ScriptInvokeV(Context *rsc, RsScript vs, uint32_t slot, const void *dat
}
-void rsi_ScriptSetRoot(Context * rsc, bool isRoot)
-{
- LOGE("rsi_ScriptSetRoot");
-}
-
void rsi_ScriptSetVarI(Context *rsc, RsScript vs, uint32_t slot, int value)
{
Script *s = static_cast<Script *>(vs);
diff --git a/rsScriptC.cpp b/rsScriptC.cpp
index e9ba2267..8a60d1ef 100644
--- a/rsScriptC.cpp
+++ b/rsScriptC.cpp
@@ -71,6 +71,22 @@ void ScriptC::setupScript()
}
}
+const Allocation *ScriptC::ptrToAllocation(const void *ptr) const
+{
+ if (!ptr) {
+ return NULL;
+ }
+ for (uint32_t ct=0; ct < mEnviroment.mFieldCount; ct++) {
+ if (!mSlots[ct].get())
+ continue;
+ if (mSlots[ct]->getPtr() == ptr) {
+ return mSlots[ct].get();
+ }
+ }
+ LOGE("ScriptC::ptrToAllocation, failed to find %p", ptr);
+ return NULL;
+}
+
uint32_t ScriptC::run(Context *rsc, uint32_t launchIndex)
{
diff --git a/rsScriptC.h b/rsScriptC.h
index c23fb731..3cb9a0ba 100644
--- a/rsScriptC.h
+++ b/rsScriptC.h
@@ -52,6 +52,8 @@ public:
BCCscript* mBccScript;
+ const Allocation *ptrToAllocation(const void *) const;
+
virtual void setupScript();
virtual uint32_t run(Context *, uint32_t launchID);
};
diff --git a/rsScriptC_Lib.cpp b/rsScriptC_Lib.cpp
index 0e094748..19dfaffc 100644
--- a/rsScriptC_Lib.cpp
+++ b/rsScriptC_Lib.cpp
@@ -1113,6 +1113,14 @@ int SC_divsi3(int a, int b)
return a / b;
}
+int SC_getAllocation(const void *ptr)
+{
+ GET_TLS();
+ const Allocation *alloc = sc->ptrToAllocation(ptr);
+ return (int)alloc;
+}
+
+
//////////////////////////////////////////////////////////////////////////////
// Class implementation
//////////////////////////////////////////////////////////////////////////////
@@ -1368,6 +1376,8 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
{ "debugPi", (void *)&SC_debugPi },
{ "scriptCall", (void *)&SC_scriptCall },
+ { "rsGetAllocation", (void *)&SC_getAllocation },
+
{ NULL, NULL }
};
diff --git a/scriptc/rs_math.rsh b/scriptc/rs_math.rsh
index 48ab0666..1d2f1e43 100644
--- a/scriptc/rs_math.rsh
+++ b/scriptc/rs_math.rsh
@@ -650,4 +650,5 @@ extern void matrixRotate(void *mat, float rot, float x, float y, float z);
extern void matrixScale(void *mat, float x, float y, float z);
extern void matrixTranslate(void *mat, float x, float y, float z);
+extern rs_allocation rsGetAllocation(const void *);