diff options
author | Jason Sams <rjsams@android.com> | 2010-08-16 12:41:48 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2010-08-16 12:41:48 -0700 |
commit | 02f62aa7d110b025b1867cb200891196f98b2628 (patch) | |
tree | 461280a32163624a6db6eee9b068b4e3eb87a18a /libs/rs/rsScriptC_Lib.cpp | |
parent | 93af2e48a7af71cee18781b64150abed7b057e2a (diff) |
Support reference operations in RS scripts.
Change-Id: I9cb5f3cb71823ab24ca51bf0167a0f52cf0691f9
Diffstat (limited to 'libs/rs/rsScriptC_Lib.cpp')
-rw-r--r-- | libs/rs/rsScriptC_Lib.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp index ac32810b0176..5a2b6baaf425 100644 --- a/libs/rs/rsScriptC_Lib.cpp +++ b/libs/rs/rsScriptC_Lib.cpp @@ -239,7 +239,7 @@ static uint32_t SC_allocGetDimFaces(RsAllocation va) return a->getType()->getDimFaces(); } -const void * SC_getElementAtX(RsAllocation va, uint32_t x) +static const void * SC_getElementAtX(RsAllocation va, uint32_t x) { const Allocation *a = static_cast<const Allocation *>(va); const Type *t = a->getType(); @@ -247,7 +247,7 @@ const void * SC_getElementAtX(RsAllocation va, uint32_t x) return &p[t->getElementSizeBytes() * x]; } -const void * SC_getElementAtXY(RsAllocation va, uint32_t x, uint32_t y) +static const void * SC_getElementAtXY(RsAllocation va, uint32_t x, uint32_t y) { const Allocation *a = static_cast<const Allocation *>(va); const Type *t = a->getType(); @@ -255,7 +255,7 @@ const void * SC_getElementAtXY(RsAllocation va, uint32_t x, uint32_t y) return &p[t->getElementSizeBytes() * (x + y*t->getDimX())]; } -const void * SC_getElementAtXYZ(RsAllocation va, uint32_t x, uint32_t y, uint32_t z) +static const void * SC_getElementAtXYZ(RsAllocation va, uint32_t x, uint32_t y, uint32_t z) { const Allocation *a = static_cast<const Allocation *>(va); const Type *t = a->getType(); @@ -263,6 +263,20 @@ const void * SC_getElementAtXYZ(RsAllocation va, uint32_t x, uint32_t y, uint32_ return &p[t->getElementSizeBytes() * (x + y*t->getDimX())]; } +static void SC_setObject(void **vdst, void * vsrc) { + static_cast<ObjectBase *>(vsrc)->incSysRef(); + static_cast<ObjectBase *>(vdst[0])->decSysRef(); + *vdst = vsrc; +} +static void SC_clearObject(void **vdst) { + static_cast<ObjectBase *>(vdst[0])->decSysRef(); + *vdst = NULL; +} +static bool SC_isObject(RsAllocation vsrc) { + return vsrc != NULL; +} + + static void SC_debugF(const char *s, float f) { LOGE("%s %f, 0x%08x", s, f, *((int *) (&f))); @@ -405,6 +419,11 @@ static ScriptCState::SymbolTable_t gSyms[] = { { "_Z14rsGetElementAt13rs_allocationjj", (void *)&SC_getElementAtXY }, { "_Z14rsGetElementAt13rs_allocationjjj", (void *)&SC_getElementAtXYZ }, + { "_Z11rsSetObjectP13rs_allocation13rs_allocation", (void *)&SC_setObject }, + { "_Z13rsClearObjectP13rs_allocation", (void *)&SC_clearObject }, + { "_Z10rsIsObject13rs_allocation", (void *)&SC_isObject }, + + // Debug { "_Z7rsDebugPKcf", (void *)&SC_debugF }, { "_Z7rsDebugPKcff", (void *)&SC_debugFv2 }, |