Remove depricated triangleMesh.
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index 1ce7083..b7cd21b 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -65,8 +65,6 @@
native int nContextCreate(int dev, Surface sur, int ver, boolean useDepth);
native void nContextDestroy(int con);
- //void rsContextBindSampler (uint32_t slot, RsSampler sampler);
- //void rsContextBindRootScript (RsScript sampler);
native void nContextBindRootScript(int script);
native void nContextBindSampler(int sampler, int slot);
native void nContextBindProgramFragmentStore(int pfs);
@@ -92,7 +90,6 @@
native void nTypeSetupFields(Type t, int[] types, int[] bits, Field[] IDs);
native int nAllocationCreateTyped(int type);
- //native int nAllocationCreateSized(int elem, int count);
native int nAllocationCreateFromBitmap(int dstFmt, boolean genMips, Bitmap bmp);
native int nAllocationCreateFromBitmapBoxed(int dstFmt, boolean genMips, Bitmap bmp);
native int nAllocationCreateFromAssetStream(int dstFmt, boolean genMips, int assetStream);
@@ -112,15 +109,6 @@
native void nAllocationSubDataFromObject(int id, Type t, int offset, Object o);
native void nAllocationSubReadFromObject(int id, Type t, int offset, Object o);
- native void nTriangleMeshBegin(int vertex, int index);
- native void nTriangleMeshAddVertex_XY (float x, float y);
- native void nTriangleMeshAddVertex_XYZ (float x, float y, float z);
- native void nTriangleMeshAddVertex_XY_ST (float x, float y, float s, float t);
- native void nTriangleMeshAddVertex_XYZ_ST (float x, float y, float z, float s, float t);
- native void nTriangleMeshAddVertex_XYZ_ST_NORM (float x, float y, float z, float s, float t, float nx, float ny, float nz);
- native void nTriangleMeshAddTriangle(int i1, int i2, int i3);
- native int nTriangleMeshCreate();
-
native void nAdapter1DBindAllocation(int ad, int alloc);
native void nAdapter1DSetConstraint(int ad, int dim, int value);
native void nAdapter1DData(int ad, int[] d);
@@ -230,49 +218,6 @@
}
//////////////////////////////////////////////////////////////////////////////////
- // Triangle Mesh
-
- public class TriangleMesh extends BaseObj {
- TriangleMesh(int id) {
- super(RenderScript.this);
- mID = id;
- }
- }
-
- public void triangleMeshBegin(Element vertex, Element index) {
- nTriangleMeshBegin(vertex.mID, index.mID);
- }
-
- public void triangleMeshAddVertex_XY(float x, float y) {
- nTriangleMeshAddVertex_XY(x, y);
- }
-
- public void triangleMeshAddVertex_XYZ(float x, float y, float z) {
- nTriangleMeshAddVertex_XYZ(x, y, z);
- }
-
- public void triangleMeshAddVertex_XY_ST(float x, float y, float s, float t) {
- nTriangleMeshAddVertex_XY_ST(x, y, s, t);
- }
-
- public void triangleMeshAddVertex_XYZ_ST(float x, float y, float z, float s, float t) {
- nTriangleMeshAddVertex_XYZ_ST(x, y, z, s, t);
- }
-
- public void triangleMeshAddVertex_XYZ_ST_NORM(float x, float y, float z, float s, float t, float nx, float ny, float nz) {
- nTriangleMeshAddVertex_XYZ_ST_NORM(x, y, z, s, t, nx, ny, nz);
- }
-
- public void triangleMeshAddTriangle(int i1, int i2, int i3) {
- nTriangleMeshAddTriangle(i1, i2, i3);
- }
-
- public TriangleMesh triangleMeshCreate() {
- int id = nTriangleMeshCreate();
- return new TriangleMesh(id);
- }
-
- //////////////////////////////////////////////////////////////////////////////////
// File
public class File extends BaseObj {
@@ -301,32 +246,31 @@
///////////////////////////////////////////////////////////////////////////////////
// Root state
- public void contextBindRootScript(Script s) {
- int id = 0;
- if(s != null) {
- id = s.mID;
+ private int safeID(BaseObj o) {
+ if(o != null) {
+ return o.mID;
}
- nContextBindRootScript(id);
+ return 0;
}
- //public void contextBindSampler(Sampler s, int slot) {
- //nContextBindSampler(s.mID);
- //}
-
- public void contextBindProgramFragmentStore(ProgramStore pfs) {
- nContextBindProgramFragmentStore(pfs.mID);
+ public void contextBindRootScript(Script s) {
+ nContextBindRootScript(safeID(s));
}
- public void contextBindProgramFragment(ProgramFragment pf) {
- nContextBindProgramFragment(pf.mID);
+ public void contextBindProgramFragmentStore(ProgramStore p) {
+ nContextBindProgramFragmentStore(safeID(p));
}
- public void contextBindProgramRaster(ProgramRaster pf) {
- nContextBindProgramRaster(pf.mID);
+ public void contextBindProgramFragment(ProgramFragment p) {
+ nContextBindProgramFragment(safeID(p));
}
- public void contextBindProgramVertex(ProgramVertex pf) {
- nContextBindProgramVertex(pf.mID);
+ public void contextBindProgramRaster(ProgramRaster p) {
+ nContextBindProgramRaster(safeID(p));
+ }
+
+ public void contextBindProgramVertex(ProgramVertex p) {
+ nContextBindProgramVertex(safeID(p));
}
}
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 4a8f8a3..f86d86a 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -603,76 +603,6 @@
free(bufAlloc);
}
-// -----------------------------------
-
-static void
-nTriangleMeshBegin(JNIEnv *_env, jobject _this, jint v, jint i)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nTriangleMeshBegin, con(%p), vertex(%p), index(%p)", con, (RsElement)v, (RsElement)i);
- rsTriangleMeshBegin(con, (RsElement)v, (RsElement)i);
-}
-
-static void
-nTriangleMeshAddVertex_XY(JNIEnv *_env, jobject _this, jfloat x, jfloat y)
-{
- float v[] = {x, y};
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nTriangleMeshAddVertex_XY, con(%p), x(%f), y(%f)", con, x, y);
- rsTriangleMeshAddVertex(con, v);
-}
-
-static void
-nTriangleMeshAddVertex_XYZ(JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z)
-{
- float v[] = {x, y, z};
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nTriangleMeshAddVertex_XYZ, con(%p), x(%f), y(%f), z(%f)", con, x, y, z);
- rsTriangleMeshAddVertex(con, v);
-}
-
-static void
-nTriangleMeshAddVertex_XY_ST(JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat s, jfloat t)
-{
- float v[] = {s, t, x, y};
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nTriangleMeshAddVertex_XY_ST, con(%p), x(%f), y(%f), s(%f), t(%f)", con, x, y, s, t);
- rsTriangleMeshAddVertex(con, v);
-}
-
-static void
-nTriangleMeshAddVertex_XYZ_ST(JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z, jfloat s, jfloat t)
-{
- float v[] = {s, t, x, y, z};
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nTriangleMeshAddVertex_XYZ_ST, con(%p), x(%f), y(%f), z(%f), s(%f), t(%f)", con, x, y, z, s, t);
- rsTriangleMeshAddVertex(con, v);
-}
-
-static void
-nTriangleMeshAddVertex_XYZ_ST_NORM(JNIEnv *_env, jobject _this, jfloat x, jfloat y, jfloat z, jfloat s, jfloat t, jfloat nx, jfloat ny, jfloat nz)
-{
- float v[] = {nx, ny, nz, s, t, x, y, z};
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nTriangleMeshAddVertex_XYZ_ST, con(%p), x(%f), y(%f), z(%f), s(%f), t(%f)", con, x, y, z, s, t);
- rsTriangleMeshAddVertex(con, v);
-}
-
-static void
-nTriangleMeshAddTriangle(JNIEnv *_env, jobject _this, jint i1, jint i2, jint i3)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nTriangleMeshAddTriangle, con(%p), i1(%i), i2(%i), i3(%i)", con, i1, i2, i3);
- rsTriangleMeshAddTriangle(con, i1, i2, i3);
-}
-
-static jint
-nTriangleMeshCreate(JNIEnv *_env, jobject _this)
-{
- RsContext con = (RsContext)(_env->GetIntField(_this, gContextId));
- LOG_API("nTriangleMeshCreate, con(%p)", con);
- return (jint) rsTriangleMeshCreate(con);
-}
// -----------------------------------
@@ -1385,15 +1315,6 @@
{"nAllocationSubDataFromObject", "(ILandroid/renderscript/Type;ILjava/lang/Object;)V", (void*)nAllocationSubDataFromObject },
{"nAllocationSubReadFromObject", "(ILandroid/renderscript/Type;ILjava/lang/Object;)V", (void*)nAllocationSubReadFromObject },
-{"nTriangleMeshBegin", "(II)V", (void*)nTriangleMeshBegin },
-{"nTriangleMeshAddVertex_XY", "(FF)V", (void*)nTriangleMeshAddVertex_XY },
-{"nTriangleMeshAddVertex_XYZ", "(FFF)V", (void*)nTriangleMeshAddVertex_XYZ },
-{"nTriangleMeshAddVertex_XY_ST", "(FFFF)V", (void*)nTriangleMeshAddVertex_XY_ST },
-{"nTriangleMeshAddVertex_XYZ_ST", "(FFFFF)V", (void*)nTriangleMeshAddVertex_XYZ_ST },
-{"nTriangleMeshAddVertex_XYZ_ST_NORM", "(FFFFFFFF)V", (void*)nTriangleMeshAddVertex_XYZ_ST_NORM },
-{"nTriangleMeshAddTriangle", "(III)V", (void*)nTriangleMeshAddTriangle },
-{"nTriangleMeshCreate", "()I", (void*)nTriangleMeshCreate },
-
{"nAdapter1DBindAllocation", "(II)V", (void*)nAdapter1DBindAllocation },
{"nAdapter1DSetConstraint", "(III)V", (void*)nAdapter1DSetConstraint },
{"nAdapter1DData", "(I[I)V", (void*)nAdapter1DData_i },