From d5680f9ba95ec7ce212e8025774914e79982a1ee Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Wed, 10 Jun 2009 18:39:40 -0700 Subject: Fix bug with bad conversion of java strings to C strings for object names. Update test app to test object defines. --- libs/rs/rsScriptC.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libs/rs/rsScriptC.cpp') diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index ae58e5f..d29eb9f 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -19,6 +19,7 @@ #include "rsMatrix.h" #include "acc/acc.h" +#include "utils/String8.h" using namespace android; using namespace android::renderscript; @@ -433,17 +434,22 @@ void ScriptCState::clear() } + void ScriptCState::runCompiler(Context *rsc) { mAccScript = accCreateScript(); + String8 tmp; + + rsc->appendNameDefines(&tmp); - const char* scriptSource[] = {mProgram.mScriptText}; - int scriptLength[] = {mProgram.mScriptTextLength} ; - accScriptSource(mAccScript, 1, scriptSource, scriptLength); + const char* scriptSource[] = {tmp.string(), mProgram.mScriptText}; + int scriptLength[] = {tmp.length(), mProgram.mScriptTextLength} ; + accScriptSource(mAccScript, sizeof(scriptLength) / sizeof(int), scriptSource, scriptLength); accCompileScript(mAccScript); accGetScriptLabel(mAccScript, "main", (ACCvoid**) &mProgram.mScript); rsAssert(mProgram.mScript); + if (mProgram.mScript) { const static int pragmaMax = 16; ACCsizei pragmaCount; -- cgit v1.1