summaryrefslogtreecommitdiff
path: root/rsScriptC_Lib.cpp
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-07-19 15:38:19 -0700
committerJason Sams <rjsams@android.com>2010-07-19 15:38:19 -0700
commit7bf29ddc35450d8064541c42c99a1f48be6cf0dd (patch)
tree927d3787dfa54f4454c7e3ab9578aded62209671 /rsScriptC_Lib.cpp
parent0a5ecb128807fb6fd7162d3e9e1322f437bdaf8a (diff)
downloadrs-7bf29ddc35450d8064541c42c99a1f48be6cf0dd.tar.gz
Threading RS ForEach.
Change-Id: I5d6fe4db2b6ac0613394bc5a066ff90ec146d60e
Diffstat (limited to 'rsScriptC_Lib.cpp')
-rw-r--r--rsScriptC_Lib.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/rsScriptC_Lib.cpp b/rsScriptC_Lib.cpp
index 8d9ca9f0..9c29ca6f 100644
--- a/rsScriptC_Lib.cpp
+++ b/rsScriptC_Lib.cpp
@@ -329,6 +329,29 @@ static uint32_t SC_allocGetDimFaces(RsAllocation va)
return a->getType()->getDimFaces();
}
+const void * SC_getElementAtX(RsAllocation va, uint32_t x)
+{
+ const Allocation *a = static_cast<const Allocation *>(va);
+ const Type *t = a->getType();
+ const uint8_t *p = (const uint8_t *)a->getPtr();
+ return &p[t->getElementSizeBytes() * x];
+}
+
+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();
+ const uint8_t *p = (const uint8_t *)a->getPtr();
+ return &p[t->getElementSizeBytes() * (x + y*t->getDimX())];
+}
+
+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();
+ const uint8_t *p = (const uint8_t *)a->getPtr();
+ return &p[t->getElementSizeBytes() * (x + y*t->getDimX())];
+}
static void SC_debugF(const char *s, float f) {
@@ -350,6 +373,10 @@ static void SC_debugI32(const char *s, int32_t i) {
LOGE("%s %i 0x%x", s, i, i);
}
+static void SC_debugP(const char *s, const void *p) {
+ LOGE("%s %p", s, p);
+}
+
static uint32_t SC_toClient(void *data, int cmdID, int len, int waitForSpace)
{
GET_TLS();
@@ -433,12 +460,18 @@ static ScriptCState::SymbolTable_t gSyms[] = {
{ "rsAllocationGetDimFaces", (void *)&SC_allocGetDimFaces },
{ "rsGetAllocation", (void *)&SC_getAllocation },
+ { "_Z14rsGetElementAt13rs_allocationj", (void *)&SC_getElementAtX },
+ { "_Z14rsGetElementAt13rs_allocationjj", (void *)&SC_getElementAtXY },
+ { "_Z14rsGetElementAt13rs_allocationjjj", (void *)&SC_getElementAtXYZ },
+
+
// Debug
{ "_Z7rsDebugPKcf", (void *)&SC_debugF },
{ "_Z7rsDebugPKcDv2_f", (void *)&SC_debugFv2 },
{ "_Z7rsDebugPKcDv3_f", (void *)&SC_debugFv3 },
{ "_Z7rsDebugPKcDv4_f", (void *)&SC_debugFv4 },
{ "_Z7rsDebugPKci", (void *)&SC_debugI32 },
+ { "_Z7rsDebugPKcPKv", (void *)&SC_debugP },
//extern void __attribute__((overloadable))rsDebug(const char *, const void *);