Fix bug with bad conversion of java strings to C strings for object names. Update test app to test object defines.
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index ffd03d5..266c455 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -17,7 +17,7 @@
#include "rsDevice.h"
#include "rsContext.h"
#include "rsThreadIO.h"
-
+#include "utils/String8.h"
using namespace android;
using namespace android::renderscript;
@@ -246,10 +246,10 @@
pv->setupGL();
}
-void Context::assignName(ObjectBase *obj, const char *name)
+void Context::assignName(ObjectBase *obj, const char *name, uint32_t len)
{
rsAssert(!obj->getName());
- obj->setName(name);
+ obj->setName(name, len);
mNames.add(obj);
}
@@ -273,6 +273,19 @@
return NULL;
}
+void Context::appendNameDefines(String8 *str) const
+{
+ char buf[256];
+ for (size_t ct=0; ct < mNames.size(); ct++) {
+ str->append("#define NAMED_");
+ str->append(mNames[ct]->getName());
+ str->append(" ");
+ sprintf(buf, "%i\n", (int)mNames[ct]);
+ str->append(buf);
+ }
+}
+
+
///////////////////////////////////////////////////////////////////////////////////////////
//
@@ -316,10 +329,10 @@
rsc->setVertex(pv);
}
-void rsi_AssignName(Context *rsc, void * obj, const char *name)
+void rsi_AssignName(Context *rsc, void * obj, const char *name, uint32_t len)
{
ObjectBase *ob = static_cast<ObjectBase *>(obj);
- rsc->assignName(ob, name);
+ rsc->assignName(ob, name, len);
}