Loading libs/rs/java/Fountain/res/raw/fountain.c +3 −3 Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ #pragma version(1) #pragma stateVertex(orthoWindow) #pragma stateRaster(flat) #pragma stateFragment(color) #pragma stateStore(parent) #pragma stateFragment(PgmFragBackground) #pragma stateFragmentStore(MyBlend) int main(void* con, int ft, int launchID) { Loading Loading @@ -35,7 +35,7 @@ int main(void* con, int ft, int launchID) { } } contextBindProgramFragment(con, loadI32(con, 0, 7)); //contextBindProgramFragment(con, loadI32(con, 0, 7)); drawRect(con, 0, 256, 0, 512); contextBindProgramFragment(con, loadI32(con, 0, 6)); Loading libs/rs/java/Fountain/src/com/android/fountain/FountainView.java +3 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ public class FountainView extends RSSurfaceView { mRS.programFragmentStoreBlendFunc(RenderScript.BlendSrcFunc.SRC_ALPHA, RenderScript.BlendDstFunc.ONE); mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.ALWAYS); mPFS = mRS.programFragmentStoreCreate(); mPFS.setName("MyBlend"); mRS.contextBindProgramFragmentStore(mPFS); mRS.samplerBegin(); Loading @@ -92,6 +93,7 @@ public class FountainView extends RSSurfaceView { mRS.programFragmentBegin(null, null); mPF = mRS.programFragmentCreate(); mPF.setName("PgmFragParts"); //mRS.contextBindProgramFragment(mPF); mRS.programFragmentBegin(null, null); Loading @@ -100,6 +102,7 @@ public class FountainView extends RSSurfaceView { mRS.contextBindProgramFragment(mPF2); mPF2.bindTexture(mTexture, 0); mPF2.bindSampler(mSampler, 0); mPF2.setName("PgmFragBackground"); mParams[0] = 0; mParams[1] = partCount; Loading libs/rs/java/Fountain/src/com/android/fountain/RenderScript.java +26 −2 Original line number Diff line number Diff line Loading @@ -68,6 +68,8 @@ public class RenderScript { native private void nContextBindProgramFragmentStore(int pfs); native private void nContextBindProgramFragment(int pf); native private void nAssignName(int obj, byte[] name); native private void nElementBegin(); native private void nElementAddPredefined(int predef); native private void nElementAdd(int kind, int type, int norm, int bits); Loading Loading @@ -135,6 +137,7 @@ public class RenderScript { native private void nProgramFragmentStoreBlendFunc(int src, int dst); native private void nProgramFragmentStoreDither(boolean enable); native private int nProgramFragmentStoreCreate(); native private void nProgramFragmentStoreDestroy(int pgm); native private void nProgramFragmentBegin(int in, int out); native private void nProgramFragmentBindTexture(int vpf, int slot, int a); Loading @@ -143,6 +146,7 @@ public class RenderScript { native private void nProgramFragmentSetEnvMode(int slot, int env); native private void nProgramFragmentSetTexEnable(int slot, boolean enable); native private int nProgramFragmentCreate(); native private void nProgramFragmentDestroy(int pgm); private int mDev; Loading @@ -166,6 +170,26 @@ public class RenderScript { } int mID; String mName; public void setName(String s) throws IllegalStateException, IllegalArgumentException { if(s.length() < 1) { throw new IllegalArgumentException("setName does not accept a zero length string."); } if(mName != null) { throw new IllegalArgumentException("setName object already has a name."); } try { byte[] bytes = s.getBytes("UTF-8"); nAssignName(mID, bytes); mName = s; } catch (java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } } protected void finalize() throws Throwable { if (mID != 0) { Loading Loading @@ -661,7 +685,7 @@ public class RenderScript { } public void destroy() { nScriptDestroy(mID); nProgramFragmentStoreDestroy(mID); mID = 0; } } Loading Loading @@ -712,7 +736,7 @@ public class RenderScript { } public void destroy() { nScriptDestroy(mID); nProgramFragmentDestroy(mID); mID = 0; } Loading libs/rs/jni/RenderScript_jni.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,21 @@ static void _nInit(JNIEnv *_env, jclass _this) } // --------------------------------------------------------------------------- static void nAssignName(JNIEnv *_env, jobject _this, jint obj, jbyteArray str) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nAssignName, con(%p), obj(%p)", con, obj); jint len = _env->GetArrayLength(str); jbyte * cptr = (jbyte *) _env->GetPrimitiveArrayCritical(str, 0); rsAssignName((void *)obj, (const char *)cptr); _env->ReleasePrimitiveArrayCritical(str, cptr, JNI_ABORT); } // --------------------------------------------------------------------------- static jint Loading Loading @@ -662,9 +677,18 @@ nProgramFragmentStoreCreate(JNIEnv *_env, jobject _this) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nProgramFragmentStoreCreate, con(%p)", con); return (jint)rsProgramFragmentStoreCreate(); } static void nProgramFragmentStoreDestroy(JNIEnv *_env, jobject _this, jint pgm) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nProgramFragmentStoreDestroy, con(%p), pgm(%i)", con, pgm); rsProgramFragmentStoreDestroy((RsProgramFragmentStore)pgm); } // --------------------------------------------------------------------------- static void Loading Loading @@ -723,6 +747,14 @@ nProgramFragmentCreate(JNIEnv *_env, jobject _this, jint slot, jboolean enable) return (jint)rsProgramFragmentCreate(); } static void nProgramFragmentDestroy(JNIEnv *_env, jobject _this, jint pgm) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nProgramFragmentDestroy, con(%p), pgm(%i)", con, pgm); rsProgramFragmentDestroy((RsProgramFragment)pgm); } // --------------------------------------------------------------------------- Loading Loading @@ -796,6 +828,7 @@ static JNINativeMethod methods[] = { {"nDeviceDestroy", "(I)V", (void*)nDeviceDestroy }, {"nContextCreate", "(ILandroid/view/Surface;I)I", (void*)nContextCreate }, {"nContextDestroy", "(I)V", (void*)nContextDestroy }, {"nAssignName", "(I[B)V", (void*)nAssignName }, {"nElementBegin", "()V", (void*)nElementBegin }, {"nElementAddPredefined", "(I)V", (void*)nElementAddPredefined }, Loading Loading @@ -858,6 +891,7 @@ static JNINativeMethod methods[] = { {"nProgramFragmentStoreBlendFunc", "(II)V", (void*)nProgramFragmentStoreBlendFunc }, {"nProgramFragmentStoreDither", "(Z)V", (void*)nProgramFragmentStoreDither }, {"nProgramFragmentStoreCreate", "()I", (void*)nProgramFragmentStoreCreate }, {"nProgramFragmentStoreDestroy", "(I)V", (void*)nProgramFragmentStoreDestroy }, {"nProgramFragmentBegin", "(II)V", (void*)nProgramFragmentBegin }, {"nProgramFragmentBindTexture", "(III)V", (void*)nProgramFragmentBindTexture }, Loading @@ -866,6 +900,7 @@ static JNINativeMethod methods[] = { {"nProgramFragmentSetEnvMode", "(II)V", (void*)nProgramFragmentSetEnvMode }, {"nProgramFragmentSetTexEnable", "(IZ)V", (void*)nProgramFragmentSetTexEnable }, {"nProgramFragmentCreate", "()I", (void*)nProgramFragmentCreate }, {"nProgramFragmentDestroy", "(I)V", (void*)nProgramFragmentDestroy }, {"nContextBindRootScript", "(I)V", (void*)nContextBindRootScript }, {"nContextBindProgramFragmentStore","(I)V", (void*)nContextBindProgramFragmentStore }, Loading libs/rs/rs.spec +10 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ ContextBindProgramVertex { param RsProgramVertex pgm } AssignName { param void *obj param const char *name } ElementBegin { } Loading Loading @@ -332,6 +336,9 @@ ProgramFragmentStoreCreate { ret RsProgramFragmentStore } ProgramFragmentStoreDestroy { param RsProgramFragmentStore pfs } ProgramFragmentBegin { Loading Loading @@ -370,6 +377,9 @@ ProgramFragmentCreate { ret RsProgramFragment } ProgramFragmentDestroy { param RsProgramFragment pf } ProgramVertexBegin { Loading Loading
libs/rs/java/Fountain/res/raw/fountain.c +3 −3 Original line number Diff line number Diff line Loading @@ -3,8 +3,8 @@ #pragma version(1) #pragma stateVertex(orthoWindow) #pragma stateRaster(flat) #pragma stateFragment(color) #pragma stateStore(parent) #pragma stateFragment(PgmFragBackground) #pragma stateFragmentStore(MyBlend) int main(void* con, int ft, int launchID) { Loading Loading @@ -35,7 +35,7 @@ int main(void* con, int ft, int launchID) { } } contextBindProgramFragment(con, loadI32(con, 0, 7)); //contextBindProgramFragment(con, loadI32(con, 0, 7)); drawRect(con, 0, 256, 0, 512); contextBindProgramFragment(con, loadI32(con, 0, 6)); Loading
libs/rs/java/Fountain/src/com/android/fountain/FountainView.java +3 −0 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ public class FountainView extends RSSurfaceView { mRS.programFragmentStoreBlendFunc(RenderScript.BlendSrcFunc.SRC_ALPHA, RenderScript.BlendDstFunc.ONE); mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.ALWAYS); mPFS = mRS.programFragmentStoreCreate(); mPFS.setName("MyBlend"); mRS.contextBindProgramFragmentStore(mPFS); mRS.samplerBegin(); Loading @@ -92,6 +93,7 @@ public class FountainView extends RSSurfaceView { mRS.programFragmentBegin(null, null); mPF = mRS.programFragmentCreate(); mPF.setName("PgmFragParts"); //mRS.contextBindProgramFragment(mPF); mRS.programFragmentBegin(null, null); Loading @@ -100,6 +102,7 @@ public class FountainView extends RSSurfaceView { mRS.contextBindProgramFragment(mPF2); mPF2.bindTexture(mTexture, 0); mPF2.bindSampler(mSampler, 0); mPF2.setName("PgmFragBackground"); mParams[0] = 0; mParams[1] = partCount; Loading
libs/rs/java/Fountain/src/com/android/fountain/RenderScript.java +26 −2 Original line number Diff line number Diff line Loading @@ -68,6 +68,8 @@ public class RenderScript { native private void nContextBindProgramFragmentStore(int pfs); native private void nContextBindProgramFragment(int pf); native private void nAssignName(int obj, byte[] name); native private void nElementBegin(); native private void nElementAddPredefined(int predef); native private void nElementAdd(int kind, int type, int norm, int bits); Loading Loading @@ -135,6 +137,7 @@ public class RenderScript { native private void nProgramFragmentStoreBlendFunc(int src, int dst); native private void nProgramFragmentStoreDither(boolean enable); native private int nProgramFragmentStoreCreate(); native private void nProgramFragmentStoreDestroy(int pgm); native private void nProgramFragmentBegin(int in, int out); native private void nProgramFragmentBindTexture(int vpf, int slot, int a); Loading @@ -143,6 +146,7 @@ public class RenderScript { native private void nProgramFragmentSetEnvMode(int slot, int env); native private void nProgramFragmentSetTexEnable(int slot, boolean enable); native private int nProgramFragmentCreate(); native private void nProgramFragmentDestroy(int pgm); private int mDev; Loading @@ -166,6 +170,26 @@ public class RenderScript { } int mID; String mName; public void setName(String s) throws IllegalStateException, IllegalArgumentException { if(s.length() < 1) { throw new IllegalArgumentException("setName does not accept a zero length string."); } if(mName != null) { throw new IllegalArgumentException("setName object already has a name."); } try { byte[] bytes = s.getBytes("UTF-8"); nAssignName(mID, bytes); mName = s; } catch (java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } } protected void finalize() throws Throwable { if (mID != 0) { Loading Loading @@ -661,7 +685,7 @@ public class RenderScript { } public void destroy() { nScriptDestroy(mID); nProgramFragmentStoreDestroy(mID); mID = 0; } } Loading Loading @@ -712,7 +736,7 @@ public class RenderScript { } public void destroy() { nScriptDestroy(mID); nProgramFragmentDestroy(mID); mID = 0; } Loading
libs/rs/jni/RenderScript_jni.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,21 @@ static void _nInit(JNIEnv *_env, jclass _this) } // --------------------------------------------------------------------------- static void nAssignName(JNIEnv *_env, jobject _this, jint obj, jbyteArray str) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nAssignName, con(%p), obj(%p)", con, obj); jint len = _env->GetArrayLength(str); jbyte * cptr = (jbyte *) _env->GetPrimitiveArrayCritical(str, 0); rsAssignName((void *)obj, (const char *)cptr); _env->ReleasePrimitiveArrayCritical(str, cptr, JNI_ABORT); } // --------------------------------------------------------------------------- static jint Loading Loading @@ -662,9 +677,18 @@ nProgramFragmentStoreCreate(JNIEnv *_env, jobject _this) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nProgramFragmentStoreCreate, con(%p)", con); return (jint)rsProgramFragmentStoreCreate(); } static void nProgramFragmentStoreDestroy(JNIEnv *_env, jobject _this, jint pgm) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nProgramFragmentStoreDestroy, con(%p), pgm(%i)", con, pgm); rsProgramFragmentStoreDestroy((RsProgramFragmentStore)pgm); } // --------------------------------------------------------------------------- static void Loading Loading @@ -723,6 +747,14 @@ nProgramFragmentCreate(JNIEnv *_env, jobject _this, jint slot, jboolean enable) return (jint)rsProgramFragmentCreate(); } static void nProgramFragmentDestroy(JNIEnv *_env, jobject _this, jint pgm) { RsContext con = (RsContext)(_env->GetIntField(_this, gContextId)); LOG_API("nProgramFragmentDestroy, con(%p), pgm(%i)", con, pgm); rsProgramFragmentDestroy((RsProgramFragment)pgm); } // --------------------------------------------------------------------------- Loading Loading @@ -796,6 +828,7 @@ static JNINativeMethod methods[] = { {"nDeviceDestroy", "(I)V", (void*)nDeviceDestroy }, {"nContextCreate", "(ILandroid/view/Surface;I)I", (void*)nContextCreate }, {"nContextDestroy", "(I)V", (void*)nContextDestroy }, {"nAssignName", "(I[B)V", (void*)nAssignName }, {"nElementBegin", "()V", (void*)nElementBegin }, {"nElementAddPredefined", "(I)V", (void*)nElementAddPredefined }, Loading Loading @@ -858,6 +891,7 @@ static JNINativeMethod methods[] = { {"nProgramFragmentStoreBlendFunc", "(II)V", (void*)nProgramFragmentStoreBlendFunc }, {"nProgramFragmentStoreDither", "(Z)V", (void*)nProgramFragmentStoreDither }, {"nProgramFragmentStoreCreate", "()I", (void*)nProgramFragmentStoreCreate }, {"nProgramFragmentStoreDestroy", "(I)V", (void*)nProgramFragmentStoreDestroy }, {"nProgramFragmentBegin", "(II)V", (void*)nProgramFragmentBegin }, {"nProgramFragmentBindTexture", "(III)V", (void*)nProgramFragmentBindTexture }, Loading @@ -866,6 +900,7 @@ static JNINativeMethod methods[] = { {"nProgramFragmentSetEnvMode", "(II)V", (void*)nProgramFragmentSetEnvMode }, {"nProgramFragmentSetTexEnable", "(IZ)V", (void*)nProgramFragmentSetTexEnable }, {"nProgramFragmentCreate", "()I", (void*)nProgramFragmentCreate }, {"nProgramFragmentDestroy", "(I)V", (void*)nProgramFragmentDestroy }, {"nContextBindRootScript", "(I)V", (void*)nContextBindRootScript }, {"nContextBindProgramFragmentStore","(I)V", (void*)nContextBindProgramFragmentStore }, Loading
libs/rs/rs.spec +10 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,10 @@ ContextBindProgramVertex { param RsProgramVertex pgm } AssignName { param void *obj param const char *name } ElementBegin { } Loading Loading @@ -332,6 +336,9 @@ ProgramFragmentStoreCreate { ret RsProgramFragmentStore } ProgramFragmentStoreDestroy { param RsProgramFragmentStore pfs } ProgramFragmentBegin { Loading Loading @@ -370,6 +377,9 @@ ProgramFragmentCreate { ret RsProgramFragment } ProgramFragmentDestroy { param RsProgramFragment pf } ProgramVertexBegin { Loading