diff options
author | Ashok Bhat <ashok.bhat@arm.com> | 2014-02-12 09:54:43 +0000 |
---|---|---|
committer | David Butcher <david.butcher@arm.com> | 2014-02-12 23:09:03 +0000 |
commit | 9807155b11a25fb6068edc9b1cd82928ac2f05de (patch) | |
tree | 7ef87913f77fea3bf054023d17fe871668f4c4c1 /rs/java | |
parent | 89492190b39e301d8203d0a9a9f6b11120c16ecb (diff) | |
download | frameworks_base-9807155b11a25fb6068edc9b1cd82928ac2f05de.zip frameworks_base-9807155b11a25fb6068edc9b1cd82928ac2f05de.tar.gz frameworks_base-9807155b11a25fb6068edc9b1cd82928ac2f05de.tar.bz2 |
AArch64: Use long[] for RS id array
Change-Id: Ia5145a547c0d13c7d6f1bb4d8f5472be62481bd9
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Diffstat (limited to 'rs/java')
-rw-r--r-- | rs/java/android/renderscript/Element.java | 9 | ||||
-rw-r--r-- | rs/java/android/renderscript/Mesh.java | 20 | ||||
-rw-r--r-- | rs/java/android/renderscript/ProgramFragment.java | 10 | ||||
-rw-r--r-- | rs/java/android/renderscript/ProgramFragmentFixedFunction.java | 10 | ||||
-rw-r--r-- | rs/java/android/renderscript/ProgramVertex.java | 10 | ||||
-rw-r--r-- | rs/java/android/renderscript/ProgramVertexFixedFunction.java | 10 | ||||
-rw-r--r-- | rs/java/android/renderscript/RenderScript.java | 40 | ||||
-rw-r--r-- | rs/java/android/renderscript/ScriptGroup.java | 21 | ||||
-rw-r--r-- | rs/java/android/renderscript/Type.java | 16 |
9 files changed, 70 insertions, 76 deletions
diff --git a/rs/java/android/renderscript/Element.java b/rs/java/android/renderscript/Element.java index 2932770..aa5d687 100644 --- a/rs/java/android/renderscript/Element.java +++ b/rs/java/android/renderscript/Element.java @@ -803,8 +803,6 @@ public class Element extends BaseObj { void updateFromNative() { super.updateFromNative(); - // FIXME: updateFromNative is broken in JNI for 64-bit - // we will pack mType; mKind; mNormalized; mVectorSize; NumSubElements int[] dataBuffer = new int[5]; mRS.nElementGetNativeData(getID(mRS), dataBuffer); @@ -831,7 +829,7 @@ public class Element extends BaseObj { mArraySizes = new int[numSubElements]; mOffsetInBytes = new int[numSubElements]; - int[] subElementIds = new int[numSubElements]; + long[] subElementIds = new long[numSubElements]; mRS.nElementGetSubElements(getID(mRS), subElementIds, mElementNames, mArraySizes); for(int i = 0; i < numSubElements; i ++) { mElements[i] = new Element(subElementIds[i], mRS); @@ -1090,10 +1088,9 @@ public class Element extends BaseObj { java.lang.System.arraycopy(mElementNames, 0, sin, 0, mCount); java.lang.System.arraycopy(mArraySizes, 0, asin, 0, mCount); - // FIXME: broken for 64-bit - int[] ids = new int[ein.length]; + long[] ids = new long[ein.length]; for (int ct = 0; ct < ein.length; ct++ ) { - ids[ct] = (int)ein[ct].getID(mRS); + ids[ct] = ein[ct].getID(mRS); } long id = mRS.nElementCreate2(ids, sin, asin); return new Element(id, mRS, ein, sin, asin); diff --git a/rs/java/android/renderscript/Mesh.java b/rs/java/android/renderscript/Mesh.java index 9ce3fb2..ca0da9d 100644 --- a/rs/java/android/renderscript/Mesh.java +++ b/rs/java/android/renderscript/Mesh.java @@ -154,8 +154,8 @@ public class Mesh extends BaseObj { int vtxCount = mRS.nMeshGetVertexBufferCount(getID(mRS)); int idxCount = mRS.nMeshGetIndexCount(getID(mRS)); - int[] vtxIDs = new int[vtxCount]; - int[] idxIDs = new int[idxCount]; + long[] vtxIDs = new long[vtxCount]; + long[] idxIDs = new long[idxCount]; int[] primitives = new int[idxCount]; mRS.nMeshGetVertices(getID(mRS), vtxIDs, vtxCount); @@ -350,8 +350,8 @@ public class Mesh extends BaseObj { **/ public Mesh create() { mRS.validate(); - int[] vtx = new int[mVertexTypeCount]; - int[] idx = new int[mIndexTypes.size()]; + long[] vtx = new long[mVertexTypeCount]; + long[] idx = new long[mIndexTypes.size()]; int[] prim = new int[mIndexTypes.size()]; Allocation[] vertexBuffers = new Allocation[mVertexTypeCount]; @@ -367,7 +367,7 @@ public class Mesh extends BaseObj { alloc = Allocation.createSized(mRS, entry.e, entry.size, mUsage); } vertexBuffers[ct] = alloc; - vtx[ct] = (int)alloc.getID(mRS); + vtx[ct] = alloc.getID(mRS); } for(int ct = 0; ct < mIndexTypes.size(); ct ++) { @@ -382,7 +382,7 @@ public class Mesh extends BaseObj { indexBuffers[ct] = alloc; primitives[ct] = entry.prim; - idx[ct] = (int)allocID; + idx[ct] = allocID; prim[ct] = entry.prim.mID; } @@ -506,8 +506,8 @@ public class Mesh extends BaseObj { public Mesh create() { mRS.validate(); - int[] vtx = new int[mVertexTypeCount]; - int[] idx = new int[mIndexTypes.size()]; + long[] vtx = new long[mVertexTypeCount]; + long[] idx = new long[mIndexTypes.size()]; int[] prim = new int[mIndexTypes.size()]; Allocation[] indexBuffers = new Allocation[mIndexTypes.size()]; @@ -517,7 +517,7 @@ public class Mesh extends BaseObj { for(int ct = 0; ct < mVertexTypeCount; ct ++) { Entry entry = mVertexTypes[ct]; vertexBuffers[ct] = entry.a; - vtx[ct] = (int)entry.a.getID(mRS); + vtx[ct] = entry.a.getID(mRS); } for(int ct = 0; ct < mIndexTypes.size(); ct ++) { @@ -526,7 +526,7 @@ public class Mesh extends BaseObj { indexBuffers[ct] = entry.a; primitives[ct] = entry.prim; - idx[ct] = (int)allocID; + idx[ct] = allocID; prim[ct] = entry.prim.mID; } diff --git a/rs/java/android/renderscript/ProgramFragment.java b/rs/java/android/renderscript/ProgramFragment.java index 5e886a3..4bb527b 100644 --- a/rs/java/android/renderscript/ProgramFragment.java +++ b/rs/java/android/renderscript/ProgramFragment.java @@ -65,25 +65,25 @@ public class ProgramFragment extends Program { */ public ProgramFragment create() { mRS.validate(); - int[] tmp = new int[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2]; + long[] tmp = new long[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2]; String[] texNames = new String[mTextureCount]; int idx = 0; for (int i=0; i < mInputCount; i++) { tmp[idx++] = ProgramParam.INPUT.mID; - tmp[idx++] = (int)mInputs[i].getID(mRS); + tmp[idx++] = mInputs[i].getID(mRS); } for (int i=0; i < mOutputCount; i++) { tmp[idx++] = ProgramParam.OUTPUT.mID; - tmp[idx++] = (int)mOutputs[i].getID(mRS); + tmp[idx++] = mOutputs[i].getID(mRS); } for (int i=0; i < mConstantCount; i++) { tmp[idx++] = ProgramParam.CONSTANT.mID; - tmp[idx++] = (int)mConstants[i].getID(mRS); + tmp[idx++] = mConstants[i].getID(mRS); } for (int i=0; i < mTextureCount; i++) { tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID; - tmp[idx++] = (int)mTextureTypes[i].mID; + tmp[idx++] = mTextureTypes[i].mID; texNames[i] = mTextureNames[i]; } diff --git a/rs/java/android/renderscript/ProgramFragmentFixedFunction.java b/rs/java/android/renderscript/ProgramFragmentFixedFunction.java index 22aed0a..2fe68be 100644 --- a/rs/java/android/renderscript/ProgramFragmentFixedFunction.java +++ b/rs/java/android/renderscript/ProgramFragmentFixedFunction.java @@ -52,25 +52,25 @@ public class ProgramFragmentFixedFunction extends ProgramFragment { */ public ProgramFragmentFixedFunction create() { mRS.validate(); - int[] tmp = new int[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2]; + long[] tmp = new long[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2]; String[] texNames = new String[mTextureCount]; int idx = 0; for (int i=0; i < mInputCount; i++) { tmp[idx++] = ProgramParam.INPUT.mID; - tmp[idx++] = (int)mInputs[i].getID(mRS); + tmp[idx++] = mInputs[i].getID(mRS); } for (int i=0; i < mOutputCount; i++) { tmp[idx++] = ProgramParam.OUTPUT.mID; - tmp[idx++] = (int)mOutputs[i].getID(mRS); + tmp[idx++] = mOutputs[i].getID(mRS); } for (int i=0; i < mConstantCount; i++) { tmp[idx++] = ProgramParam.CONSTANT.mID; - tmp[idx++] = (int)mConstants[i].getID(mRS); + tmp[idx++] = mConstants[i].getID(mRS); } for (int i=0; i < mTextureCount; i++) { tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID; - tmp[idx++] = (int)mTextureTypes[i].mID; + tmp[idx++] = mTextureTypes[i].mID; texNames[i] = mTextureNames[i]; } diff --git a/rs/java/android/renderscript/ProgramVertex.java b/rs/java/android/renderscript/ProgramVertex.java index b6886e1..d3a51de 100644 --- a/rs/java/android/renderscript/ProgramVertex.java +++ b/rs/java/android/renderscript/ProgramVertex.java @@ -126,25 +126,25 @@ public class ProgramVertex extends Program { */ public ProgramVertex create() { mRS.validate(); - int[] tmp = new int[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2]; + long[] tmp = new long[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2]; String[] texNames = new String[mTextureCount]; int idx = 0; for (int i=0; i < mInputCount; i++) { tmp[idx++] = ProgramParam.INPUT.mID; - tmp[idx++] = (int)mInputs[i].getID(mRS); + tmp[idx++] = mInputs[i].getID(mRS); } for (int i=0; i < mOutputCount; i++) { tmp[idx++] = ProgramParam.OUTPUT.mID; - tmp[idx++] = (int)mOutputs[i].getID(mRS); + tmp[idx++] = mOutputs[i].getID(mRS); } for (int i=0; i < mConstantCount; i++) { tmp[idx++] = ProgramParam.CONSTANT.mID; - tmp[idx++] = (int)mConstants[i].getID(mRS); + tmp[idx++] = mConstants[i].getID(mRS); } for (int i=0; i < mTextureCount; i++) { tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID; - tmp[idx++] = (int)mTextureTypes[i].mID; + tmp[idx++] = mTextureTypes[i].mID; texNames[i] = mTextureNames[i]; } diff --git a/rs/java/android/renderscript/ProgramVertexFixedFunction.java b/rs/java/android/renderscript/ProgramVertexFixedFunction.java index c479c77..a350154 100644 --- a/rs/java/android/renderscript/ProgramVertexFixedFunction.java +++ b/rs/java/android/renderscript/ProgramVertexFixedFunction.java @@ -79,25 +79,25 @@ public class ProgramVertexFixedFunction extends ProgramVertex { */ public ProgramVertexFixedFunction create() { mRS.validate(); - int[] tmp = new int[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2]; + long[] tmp = new long[(mInputCount + mOutputCount + mConstantCount + mTextureCount) * 2]; String[] texNames = new String[mTextureCount]; int idx = 0; for (int i=0; i < mInputCount; i++) { tmp[idx++] = ProgramParam.INPUT.mID; - tmp[idx++] = (int)mInputs[i].getID(mRS); + tmp[idx++] = mInputs[i].getID(mRS); } for (int i=0; i < mOutputCount; i++) { tmp[idx++] = ProgramParam.OUTPUT.mID; - tmp[idx++] = (int)mOutputs[i].getID(mRS); + tmp[idx++] = mOutputs[i].getID(mRS); } for (int i=0; i < mConstantCount; i++) { tmp[idx++] = ProgramParam.CONSTANT.mID; - tmp[idx++] = (int)mConstants[i].getID(mRS); + tmp[idx++] = mConstants[i].getID(mRS); } for (int i=0; i < mTextureCount; i++) { tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID; - tmp[idx++] = (int)mTextureTypes[i].mID; + tmp[idx++] = mTextureTypes[i].mID; texNames[i] = mTextureNames[i]; } diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java index 8618764..efede36 100644 --- a/rs/java/android/renderscript/RenderScript.java +++ b/rs/java/android/renderscript/RenderScript.java @@ -293,8 +293,8 @@ public class RenderScript { validate(); return rsnElementCreate(mContext, type, kind, norm, vecSize); } - native long rsnElementCreate2(long con, int[]elements, String[] names, int[] arraySizes); - synchronized long nElementCreate2(int[] elements, String[] names, int[] arraySizes) { + native long rsnElementCreate2(long con, long[] elements, String[] names, int[] arraySizes); + synchronized long nElementCreate2(long[] elements, String[] names, int[] arraySizes) { validate(); return rsnElementCreate2(mContext, elements, names, arraySizes); } @@ -304,8 +304,8 @@ public class RenderScript { rsnElementGetNativeData(mContext, id, elementData); } native void rsnElementGetSubElements(long con, long id, - int[] IDs, String[] names, int[] arraySizes); - synchronized void nElementGetSubElements(long id, int[] IDs, String[] names, int[] arraySizes) { + long[] IDs, String[] names, int[] arraySizes); + synchronized void nElementGetSubElements(long id, long[] IDs, String[] names, int[] arraySizes) { validate(); rsnElementGetSubElements(mContext, id, IDs, names, arraySizes); } @@ -315,14 +315,14 @@ public class RenderScript { validate(); return rsnTypeCreate(mContext, eid, x, y, z, mips, faces, yuv); } - native void rsnTypeGetNativeData(long con, long id, int[] typeData); - synchronized void nTypeGetNativeData(long id, int[] typeData) { + native void rsnTypeGetNativeData(long con, long id, long[] typeData); + synchronized void nTypeGetNativeData(long id, long[] typeData) { validate(); rsnTypeGetNativeData(mContext, id, typeData); } - native long rsnAllocationCreateTyped(long con, long type, int mip, int usage, int pointer); - synchronized long nAllocationCreateTyped(long type, int mip, int usage, int pointer) { + native long rsnAllocationCreateTyped(long con, long type, int mip, int usage, long pointer); + synchronized long nAllocationCreateTyped(long type, int mip, int usage, long pointer) { validate(); return rsnAllocationCreateTyped(mContext, type, mip, usage, pointer); } @@ -690,8 +690,8 @@ public class RenderScript { return rsnScriptFieldIDCreate(mContext, sid, slot); } - native long rsnScriptGroupCreate(long con, int[] kernels, int[] src, int[] dstk, int[] dstf, int[] types); - synchronized long nScriptGroupCreate(int[] kernels, int[] src, int[] dstk, int[] dstf, int[] types) { + native long rsnScriptGroupCreate(long con, long[] kernels, long[] src, long[] dstk, long[] dstf, long[] types); + synchronized long nScriptGroupCreate(long[] kernels, long[] src, long[] dstk, long[] dstf, long[] types) { validate(); return rsnScriptGroupCreate(mContext, kernels, src, dstk, dstf, types); } @@ -754,19 +754,19 @@ public class RenderScript { validate(); rsnProgramBindSampler(mContext, vpf, slot, s); } - native long rsnProgramFragmentCreate(long con, String shader, String[] texNames, int[] params); - synchronized long nProgramFragmentCreate(String shader, String[] texNames, int[] params) { + native long rsnProgramFragmentCreate(long con, String shader, String[] texNames, long[] params); + synchronized long nProgramFragmentCreate(String shader, String[] texNames, long[] params) { validate(); return rsnProgramFragmentCreate(mContext, shader, texNames, params); } - native long rsnProgramVertexCreate(long con, String shader, String[] texNames, int[] params); - synchronized long nProgramVertexCreate(String shader, String[] texNames, int[] params) { + native long rsnProgramVertexCreate(long con, String shader, String[] texNames, long[] params); + synchronized long nProgramVertexCreate(String shader, String[] texNames, long[] params) { validate(); return rsnProgramVertexCreate(mContext, shader, texNames, params); } - native long rsnMeshCreate(long con, int[] vtx, int[] idx, int[] prim); - synchronized long nMeshCreate(int[] vtx, int[] idx, int[] prim) { + native long rsnMeshCreate(long con, long[] vtx, long[] idx, int[] prim); + synchronized long nMeshCreate(long[] vtx, long[] idx, int[] prim) { validate(); return rsnMeshCreate(mContext, vtx, idx, prim); } @@ -780,13 +780,13 @@ public class RenderScript { validate(); return rsnMeshGetIndexCount(mContext, id); } - native void rsnMeshGetVertices(long con, long id, int[] vtxIds, int vtxIdCount); - synchronized void nMeshGetVertices(long id, int[] vtxIds, int vtxIdCount) { + native void rsnMeshGetVertices(long con, long id, long[] vtxIds, int vtxIdCount); + synchronized void nMeshGetVertices(long id, long[] vtxIds, int vtxIdCount) { validate(); rsnMeshGetVertices(mContext, id, vtxIds, vtxIdCount); } - native void rsnMeshGetIndices(long con, long id, int[] idxIds, int[] primitives, int vtxIdCount); - synchronized void nMeshGetIndices(long id, int[] idxIds, int[] primitives, int vtxIdCount) { + native void rsnMeshGetIndices(long con, long id, long[] idxIds, int[] primitives, int vtxIdCount); + synchronized void nMeshGetIndices(long id, long[] idxIds, int[] primitives, int vtxIdCount) { validate(); rsnMeshGetIndices(mContext, id, idxIds, primitives, vtxIdCount); } diff --git a/rs/java/android/renderscript/ScriptGroup.java b/rs/java/android/renderscript/ScriptGroup.java index 48dba30..1200a66 100644 --- a/rs/java/android/renderscript/ScriptGroup.java +++ b/rs/java/android/renderscript/ScriptGroup.java @@ -380,7 +380,6 @@ public final class ScriptGroup extends BaseObj { * @return ScriptGroup The new ScriptGroup */ public ScriptGroup create() { - // FIXME: this is broken for 64-bit if (mNodes.size() == 0) { throw new RSInvalidStateException("Empty script groups are not allowed"); @@ -395,13 +394,13 @@ public final class ScriptGroup extends BaseObj { ArrayList<IO> inputs = new ArrayList<IO>(); ArrayList<IO> outputs = new ArrayList<IO>(); - int[] kernels = new int[mKernelCount]; + long[] kernels = new long[mKernelCount]; int idx = 0; for (int ct=0; ct < mNodes.size(); ct++) { Node n = mNodes.get(ct); for (int ct2=0; ct2 < n.mKernels.size(); ct2++) { final Script.KernelID kid = n.mKernels.get(ct2); - kernels[idx++] = (int)kid.getID(mRS); + kernels[idx++] = kid.getID(mRS); boolean hasInput = false; boolean hasOutput = false; @@ -428,21 +427,21 @@ public final class ScriptGroup extends BaseObj { throw new RSRuntimeException("Count mismatch, should not happen."); } - int[] src = new int[mLines.size()]; - int[] dstk = new int[mLines.size()]; - int[] dstf = new int[mLines.size()]; - int[] types = new int[mLines.size()]; + long[] src = new long[mLines.size()]; + long[] dstk = new long[mLines.size()]; + long[] dstf = new long[mLines.size()]; + long[] types = new long[mLines.size()]; for (int ct=0; ct < mLines.size(); ct++) { ConnectLine cl = mLines.get(ct); - src[ct] = (int)cl.mFrom.getID(mRS); + src[ct] = cl.mFrom.getID(mRS); if (cl.mToK != null) { - dstk[ct] = (int)cl.mToK.getID(mRS); + dstk[ct] = cl.mToK.getID(mRS); } if (cl.mToF != null) { - dstf[ct] = (int)cl.mToF.getID(mRS); + dstf[ct] = cl.mToF.getID(mRS); } - types[ct] = (int)cl.mAllocationType.getID(mRS); + types[ct] = cl.mAllocationType.getID(mRS); } long id = mRS.nScriptGroupCreate(kernels, src, dstk, dstf, types); diff --git a/rs/java/android/renderscript/Type.java b/rs/java/android/renderscript/Type.java index 7bdd360..ce7f571 100644 --- a/rs/java/android/renderscript/Type.java +++ b/rs/java/android/renderscript/Type.java @@ -196,20 +196,18 @@ public class Type extends BaseObj { @Override void updateFromNative() { - // FIXME: rsaTypeGetNativeData needs 32-bit and 64-bit paths - - // We have 6 integer to obtain mDimX; mDimY; mDimZ; + // We have 6 integer/long to obtain mDimX; mDimY; mDimZ; // mDimLOD; mDimFaces; mElement; - int[] dataBuffer = new int[6]; - mRS.nTypeGetNativeData((int)getID(mRS), dataBuffer); + long[] dataBuffer = new long[6]; + mRS.nTypeGetNativeData(getID(mRS), dataBuffer); - mDimX = dataBuffer[0]; - mDimY = dataBuffer[1]; - mDimZ = dataBuffer[2]; + mDimX = (int)dataBuffer[0]; + mDimY = (int)dataBuffer[1]; + mDimZ = (int)dataBuffer[2]; mDimMipmaps = dataBuffer[3] == 1 ? true : false; mDimFaces = dataBuffer[4] == 1 ? true : false; - int elementID = dataBuffer[5]; + long elementID = dataBuffer[5]; if(elementID != 0) { mElement = new Element(elementID, mRS); mElement.updateFromNative(); |