am 14420e29
: Merge "AArch64: Use long[] for RS id array"
* commit '14420e29abc0f16f818ddaf606515861ba69ae68': AArch64: Use long[] for RS id array
This commit is contained in:
@ -803,8 +803,6 @@ public class Element extends BaseObj {
|
|||||||
void updateFromNative() {
|
void updateFromNative() {
|
||||||
super.updateFromNative();
|
super.updateFromNative();
|
||||||
|
|
||||||
// FIXME: updateFromNative is broken in JNI for 64-bit
|
|
||||||
|
|
||||||
// we will pack mType; mKind; mNormalized; mVectorSize; NumSubElements
|
// we will pack mType; mKind; mNormalized; mVectorSize; NumSubElements
|
||||||
int[] dataBuffer = new int[5];
|
int[] dataBuffer = new int[5];
|
||||||
mRS.nElementGetNativeData(getID(mRS), dataBuffer);
|
mRS.nElementGetNativeData(getID(mRS), dataBuffer);
|
||||||
@ -831,7 +829,7 @@ public class Element extends BaseObj {
|
|||||||
mArraySizes = new int[numSubElements];
|
mArraySizes = new int[numSubElements];
|
||||||
mOffsetInBytes = new int[numSubElements];
|
mOffsetInBytes = new int[numSubElements];
|
||||||
|
|
||||||
int[] subElementIds = new int[numSubElements];
|
long[] subElementIds = new long[numSubElements];
|
||||||
mRS.nElementGetSubElements(getID(mRS), subElementIds, mElementNames, mArraySizes);
|
mRS.nElementGetSubElements(getID(mRS), subElementIds, mElementNames, mArraySizes);
|
||||||
for(int i = 0; i < numSubElements; i ++) {
|
for(int i = 0; i < numSubElements; i ++) {
|
||||||
mElements[i] = new Element(subElementIds[i], mRS);
|
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(mElementNames, 0, sin, 0, mCount);
|
||||||
java.lang.System.arraycopy(mArraySizes, 0, asin, 0, mCount);
|
java.lang.System.arraycopy(mArraySizes, 0, asin, 0, mCount);
|
||||||
|
|
||||||
// FIXME: broken for 64-bit
|
long[] ids = new long[ein.length];
|
||||||
int[] ids = new int[ein.length];
|
|
||||||
for (int ct = 0; ct < ein.length; ct++ ) {
|
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);
|
long id = mRS.nElementCreate2(ids, sin, asin);
|
||||||
return new Element(id, mRS, ein, sin, asin);
|
return new Element(id, mRS, ein, sin, asin);
|
||||||
|
@ -154,8 +154,8 @@ public class Mesh extends BaseObj {
|
|||||||
int vtxCount = mRS.nMeshGetVertexBufferCount(getID(mRS));
|
int vtxCount = mRS.nMeshGetVertexBufferCount(getID(mRS));
|
||||||
int idxCount = mRS.nMeshGetIndexCount(getID(mRS));
|
int idxCount = mRS.nMeshGetIndexCount(getID(mRS));
|
||||||
|
|
||||||
int[] vtxIDs = new int[vtxCount];
|
long[] vtxIDs = new long[vtxCount];
|
||||||
int[] idxIDs = new int[idxCount];
|
long[] idxIDs = new long[idxCount];
|
||||||
int[] primitives = new int[idxCount];
|
int[] primitives = new int[idxCount];
|
||||||
|
|
||||||
mRS.nMeshGetVertices(getID(mRS), vtxIDs, vtxCount);
|
mRS.nMeshGetVertices(getID(mRS), vtxIDs, vtxCount);
|
||||||
@ -350,8 +350,8 @@ public class Mesh extends BaseObj {
|
|||||||
**/
|
**/
|
||||||
public Mesh create() {
|
public Mesh create() {
|
||||||
mRS.validate();
|
mRS.validate();
|
||||||
int[] vtx = new int[mVertexTypeCount];
|
long[] vtx = new long[mVertexTypeCount];
|
||||||
int[] idx = new int[mIndexTypes.size()];
|
long[] idx = new long[mIndexTypes.size()];
|
||||||
int[] prim = new int[mIndexTypes.size()];
|
int[] prim = new int[mIndexTypes.size()];
|
||||||
|
|
||||||
Allocation[] vertexBuffers = new Allocation[mVertexTypeCount];
|
Allocation[] vertexBuffers = new Allocation[mVertexTypeCount];
|
||||||
@ -367,7 +367,7 @@ public class Mesh extends BaseObj {
|
|||||||
alloc = Allocation.createSized(mRS, entry.e, entry.size, mUsage);
|
alloc = Allocation.createSized(mRS, entry.e, entry.size, mUsage);
|
||||||
}
|
}
|
||||||
vertexBuffers[ct] = alloc;
|
vertexBuffers[ct] = alloc;
|
||||||
vtx[ct] = (int)alloc.getID(mRS);
|
vtx[ct] = alloc.getID(mRS);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int ct = 0; ct < mIndexTypes.size(); ct ++) {
|
for(int ct = 0; ct < mIndexTypes.size(); ct ++) {
|
||||||
@ -382,7 +382,7 @@ public class Mesh extends BaseObj {
|
|||||||
indexBuffers[ct] = alloc;
|
indexBuffers[ct] = alloc;
|
||||||
primitives[ct] = entry.prim;
|
primitives[ct] = entry.prim;
|
||||||
|
|
||||||
idx[ct] = (int)allocID;
|
idx[ct] = allocID;
|
||||||
prim[ct] = entry.prim.mID;
|
prim[ct] = entry.prim.mID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -506,8 +506,8 @@ public class Mesh extends BaseObj {
|
|||||||
public Mesh create() {
|
public Mesh create() {
|
||||||
mRS.validate();
|
mRS.validate();
|
||||||
|
|
||||||
int[] vtx = new int[mVertexTypeCount];
|
long[] vtx = new long[mVertexTypeCount];
|
||||||
int[] idx = new int[mIndexTypes.size()];
|
long[] idx = new long[mIndexTypes.size()];
|
||||||
int[] prim = new int[mIndexTypes.size()];
|
int[] prim = new int[mIndexTypes.size()];
|
||||||
|
|
||||||
Allocation[] indexBuffers = new Allocation[mIndexTypes.size()];
|
Allocation[] indexBuffers = new Allocation[mIndexTypes.size()];
|
||||||
@ -517,7 +517,7 @@ public class Mesh extends BaseObj {
|
|||||||
for(int ct = 0; ct < mVertexTypeCount; ct ++) {
|
for(int ct = 0; ct < mVertexTypeCount; ct ++) {
|
||||||
Entry entry = mVertexTypes[ct];
|
Entry entry = mVertexTypes[ct];
|
||||||
vertexBuffers[ct] = entry.a;
|
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 ++) {
|
for(int ct = 0; ct < mIndexTypes.size(); ct ++) {
|
||||||
@ -526,7 +526,7 @@ public class Mesh extends BaseObj {
|
|||||||
indexBuffers[ct] = entry.a;
|
indexBuffers[ct] = entry.a;
|
||||||
primitives[ct] = entry.prim;
|
primitives[ct] = entry.prim;
|
||||||
|
|
||||||
idx[ct] = (int)allocID;
|
idx[ct] = allocID;
|
||||||
prim[ct] = entry.prim.mID;
|
prim[ct] = entry.prim.mID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,25 +65,25 @@ public class ProgramFragment extends Program {
|
|||||||
*/
|
*/
|
||||||
public ProgramFragment create() {
|
public ProgramFragment create() {
|
||||||
mRS.validate();
|
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];
|
String[] texNames = new String[mTextureCount];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
for (int i=0; i < mInputCount; i++) {
|
for (int i=0; i < mInputCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.INPUT.mID;
|
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++) {
|
for (int i=0; i < mOutputCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.OUTPUT.mID;
|
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++) {
|
for (int i=0; i < mConstantCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.CONSTANT.mID;
|
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++) {
|
for (int i=0; i < mTextureCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
|
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
|
||||||
tmp[idx++] = (int)mTextureTypes[i].mID;
|
tmp[idx++] = mTextureTypes[i].mID;
|
||||||
texNames[i] = mTextureNames[i];
|
texNames[i] = mTextureNames[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,25 +52,25 @@ public class ProgramFragmentFixedFunction extends ProgramFragment {
|
|||||||
*/
|
*/
|
||||||
public ProgramFragmentFixedFunction create() {
|
public ProgramFragmentFixedFunction create() {
|
||||||
mRS.validate();
|
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];
|
String[] texNames = new String[mTextureCount];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
for (int i=0; i < mInputCount; i++) {
|
for (int i=0; i < mInputCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.INPUT.mID;
|
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++) {
|
for (int i=0; i < mOutputCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.OUTPUT.mID;
|
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++) {
|
for (int i=0; i < mConstantCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.CONSTANT.mID;
|
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++) {
|
for (int i=0; i < mTextureCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
|
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
|
||||||
tmp[idx++] = (int)mTextureTypes[i].mID;
|
tmp[idx++] = mTextureTypes[i].mID;
|
||||||
texNames[i] = mTextureNames[i];
|
texNames[i] = mTextureNames[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,25 +126,25 @@ public class ProgramVertex extends Program {
|
|||||||
*/
|
*/
|
||||||
public ProgramVertex create() {
|
public ProgramVertex create() {
|
||||||
mRS.validate();
|
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];
|
String[] texNames = new String[mTextureCount];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
for (int i=0; i < mInputCount; i++) {
|
for (int i=0; i < mInputCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.INPUT.mID;
|
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++) {
|
for (int i=0; i < mOutputCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.OUTPUT.mID;
|
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++) {
|
for (int i=0; i < mConstantCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.CONSTANT.mID;
|
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++) {
|
for (int i=0; i < mTextureCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
|
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
|
||||||
tmp[idx++] = (int)mTextureTypes[i].mID;
|
tmp[idx++] = mTextureTypes[i].mID;
|
||||||
texNames[i] = mTextureNames[i];
|
texNames[i] = mTextureNames[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,25 +79,25 @@ public class ProgramVertexFixedFunction extends ProgramVertex {
|
|||||||
*/
|
*/
|
||||||
public ProgramVertexFixedFunction create() {
|
public ProgramVertexFixedFunction create() {
|
||||||
mRS.validate();
|
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];
|
String[] texNames = new String[mTextureCount];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
for (int i=0; i < mInputCount; i++) {
|
for (int i=0; i < mInputCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.INPUT.mID;
|
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++) {
|
for (int i=0; i < mOutputCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.OUTPUT.mID;
|
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++) {
|
for (int i=0; i < mConstantCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.CONSTANT.mID;
|
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++) {
|
for (int i=0; i < mTextureCount; i++) {
|
||||||
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
|
tmp[idx++] = ProgramParam.TEXTURE_TYPE.mID;
|
||||||
tmp[idx++] = (int)mTextureTypes[i].mID;
|
tmp[idx++] = mTextureTypes[i].mID;
|
||||||
texNames[i] = mTextureNames[i];
|
texNames[i] = mTextureNames[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,8 +307,8 @@ public class RenderScript {
|
|||||||
validate();
|
validate();
|
||||||
return rsnElementCreate(mContext, type, kind, norm, vecSize);
|
return rsnElementCreate(mContext, type, kind, norm, vecSize);
|
||||||
}
|
}
|
||||||
native long rsnElementCreate2(long con, int[]elements, String[] names, int[] arraySizes);
|
native long rsnElementCreate2(long con, long[] elements, String[] names, int[] arraySizes);
|
||||||
synchronized long nElementCreate2(int[] elements, String[] names, int[] arraySizes) {
|
synchronized long nElementCreate2(long[] elements, String[] names, int[] arraySizes) {
|
||||||
validate();
|
validate();
|
||||||
return rsnElementCreate2(mContext, elements, names, arraySizes);
|
return rsnElementCreate2(mContext, elements, names, arraySizes);
|
||||||
}
|
}
|
||||||
@ -318,8 +318,8 @@ public class RenderScript {
|
|||||||
rsnElementGetNativeData(mContext, id, elementData);
|
rsnElementGetNativeData(mContext, id, elementData);
|
||||||
}
|
}
|
||||||
native void rsnElementGetSubElements(long con, long id,
|
native void rsnElementGetSubElements(long con, long id,
|
||||||
int[] IDs, String[] names, int[] arraySizes);
|
long[] IDs, String[] names, int[] arraySizes);
|
||||||
synchronized void nElementGetSubElements(long id, int[] IDs, String[] names, int[] arraySizes) {
|
synchronized void nElementGetSubElements(long id, long[] IDs, String[] names, int[] arraySizes) {
|
||||||
validate();
|
validate();
|
||||||
rsnElementGetSubElements(mContext, id, IDs, names, arraySizes);
|
rsnElementGetSubElements(mContext, id, IDs, names, arraySizes);
|
||||||
}
|
}
|
||||||
@ -329,14 +329,14 @@ public class RenderScript {
|
|||||||
validate();
|
validate();
|
||||||
return rsnTypeCreate(mContext, eid, x, y, z, mips, faces, yuv);
|
return rsnTypeCreate(mContext, eid, x, y, z, mips, faces, yuv);
|
||||||
}
|
}
|
||||||
native void rsnTypeGetNativeData(long con, long id, int[] typeData);
|
native void rsnTypeGetNativeData(long con, long id, long[] typeData);
|
||||||
synchronized void nTypeGetNativeData(long id, int[] typeData) {
|
synchronized void nTypeGetNativeData(long id, long[] typeData) {
|
||||||
validate();
|
validate();
|
||||||
rsnTypeGetNativeData(mContext, id, typeData);
|
rsnTypeGetNativeData(mContext, id, typeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
native long rsnAllocationCreateTyped(long con, 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, int pointer) {
|
synchronized long nAllocationCreateTyped(long type, int mip, int usage, long pointer) {
|
||||||
validate();
|
validate();
|
||||||
return rsnAllocationCreateTyped(mContext, type, mip, usage, pointer);
|
return rsnAllocationCreateTyped(mContext, type, mip, usage, pointer);
|
||||||
}
|
}
|
||||||
@ -704,8 +704,8 @@ public class RenderScript {
|
|||||||
return rsnScriptFieldIDCreate(mContext, sid, slot);
|
return rsnScriptFieldIDCreate(mContext, sid, slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
native long rsnScriptGroupCreate(long con, 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(int[] kernels, int[] src, int[] dstk, int[] dstf, int[] types) {
|
synchronized long nScriptGroupCreate(long[] kernels, long[] src, long[] dstk, long[] dstf, long[] types) {
|
||||||
validate();
|
validate();
|
||||||
return rsnScriptGroupCreate(mContext, kernels, src, dstk, dstf, types);
|
return rsnScriptGroupCreate(mContext, kernels, src, dstk, dstf, types);
|
||||||
}
|
}
|
||||||
@ -768,19 +768,19 @@ public class RenderScript {
|
|||||||
validate();
|
validate();
|
||||||
rsnProgramBindSampler(mContext, vpf, slot, s);
|
rsnProgramBindSampler(mContext, vpf, slot, s);
|
||||||
}
|
}
|
||||||
native long rsnProgramFragmentCreate(long con, String shader, String[] texNames, int[] params);
|
native long rsnProgramFragmentCreate(long con, String shader, String[] texNames, long[] params);
|
||||||
synchronized long nProgramFragmentCreate(String shader, String[] texNames, int[] params) {
|
synchronized long nProgramFragmentCreate(String shader, String[] texNames, long[] params) {
|
||||||
validate();
|
validate();
|
||||||
return rsnProgramFragmentCreate(mContext, shader, texNames, params);
|
return rsnProgramFragmentCreate(mContext, shader, texNames, params);
|
||||||
}
|
}
|
||||||
native long rsnProgramVertexCreate(long con, String shader, String[] texNames, int[] params);
|
native long rsnProgramVertexCreate(long con, String shader, String[] texNames, long[] params);
|
||||||
synchronized long nProgramVertexCreate(String shader, String[] texNames, int[] params) {
|
synchronized long nProgramVertexCreate(String shader, String[] texNames, long[] params) {
|
||||||
validate();
|
validate();
|
||||||
return rsnProgramVertexCreate(mContext, shader, texNames, params);
|
return rsnProgramVertexCreate(mContext, shader, texNames, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
native long rsnMeshCreate(long con, int[] vtx, int[] idx, int[] prim);
|
native long rsnMeshCreate(long con, long[] vtx, long[] idx, int[] prim);
|
||||||
synchronized long nMeshCreate(int[] vtx, int[] idx, int[] prim) {
|
synchronized long nMeshCreate(long[] vtx, long[] idx, int[] prim) {
|
||||||
validate();
|
validate();
|
||||||
return rsnMeshCreate(mContext, vtx, idx, prim);
|
return rsnMeshCreate(mContext, vtx, idx, prim);
|
||||||
}
|
}
|
||||||
@ -794,13 +794,13 @@ public class RenderScript {
|
|||||||
validate();
|
validate();
|
||||||
return rsnMeshGetIndexCount(mContext, id);
|
return rsnMeshGetIndexCount(mContext, id);
|
||||||
}
|
}
|
||||||
native void rsnMeshGetVertices(long con, long id, int[] vtxIds, int vtxIdCount);
|
native void rsnMeshGetVertices(long con, long id, long[] vtxIds, int vtxIdCount);
|
||||||
synchronized void nMeshGetVertices(long id, int[] vtxIds, int vtxIdCount) {
|
synchronized void nMeshGetVertices(long id, long[] vtxIds, int vtxIdCount) {
|
||||||
validate();
|
validate();
|
||||||
rsnMeshGetVertices(mContext, id, vtxIds, vtxIdCount);
|
rsnMeshGetVertices(mContext, id, vtxIds, vtxIdCount);
|
||||||
}
|
}
|
||||||
native void rsnMeshGetIndices(long con, 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, int[] idxIds, int[] primitives, int vtxIdCount) {
|
synchronized void nMeshGetIndices(long id, long[] idxIds, int[] primitives, int vtxIdCount) {
|
||||||
validate();
|
validate();
|
||||||
rsnMeshGetIndices(mContext, id, idxIds, primitives, vtxIdCount);
|
rsnMeshGetIndices(mContext, id, idxIds, primitives, vtxIdCount);
|
||||||
}
|
}
|
||||||
|
@ -380,7 +380,6 @@ public final class ScriptGroup extends BaseObj {
|
|||||||
* @return ScriptGroup The new ScriptGroup
|
* @return ScriptGroup The new ScriptGroup
|
||||||
*/
|
*/
|
||||||
public ScriptGroup create() {
|
public ScriptGroup create() {
|
||||||
// FIXME: this is broken for 64-bit
|
|
||||||
|
|
||||||
if (mNodes.size() == 0) {
|
if (mNodes.size() == 0) {
|
||||||
throw new RSInvalidStateException("Empty script groups are not allowed");
|
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> inputs = new ArrayList<IO>();
|
||||||
ArrayList<IO> outputs = new ArrayList<IO>();
|
ArrayList<IO> outputs = new ArrayList<IO>();
|
||||||
|
|
||||||
int[] kernels = new int[mKernelCount];
|
long[] kernels = new long[mKernelCount];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (int ct=0; ct < mNodes.size(); ct++) {
|
for (int ct=0; ct < mNodes.size(); ct++) {
|
||||||
Node n = mNodes.get(ct);
|
Node n = mNodes.get(ct);
|
||||||
for (int ct2=0; ct2 < n.mKernels.size(); ct2++) {
|
for (int ct2=0; ct2 < n.mKernels.size(); ct2++) {
|
||||||
final Script.KernelID kid = n.mKernels.get(ct2);
|
final Script.KernelID kid = n.mKernels.get(ct2);
|
||||||
kernels[idx++] = (int)kid.getID(mRS);
|
kernels[idx++] = kid.getID(mRS);
|
||||||
|
|
||||||
boolean hasInput = false;
|
boolean hasInput = false;
|
||||||
boolean hasOutput = false;
|
boolean hasOutput = false;
|
||||||
@ -428,21 +427,21 @@ public final class ScriptGroup extends BaseObj {
|
|||||||
throw new RSRuntimeException("Count mismatch, should not happen.");
|
throw new RSRuntimeException("Count mismatch, should not happen.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] src = new int[mLines.size()];
|
long[] src = new long[mLines.size()];
|
||||||
int[] dstk = new int[mLines.size()];
|
long[] dstk = new long[mLines.size()];
|
||||||
int[] dstf = new int[mLines.size()];
|
long[] dstf = new long[mLines.size()];
|
||||||
int[] types = new int[mLines.size()];
|
long[] types = new long[mLines.size()];
|
||||||
|
|
||||||
for (int ct=0; ct < mLines.size(); ct++) {
|
for (int ct=0; ct < mLines.size(); ct++) {
|
||||||
ConnectLine cl = mLines.get(ct);
|
ConnectLine cl = mLines.get(ct);
|
||||||
src[ct] = (int)cl.mFrom.getID(mRS);
|
src[ct] = cl.mFrom.getID(mRS);
|
||||||
if (cl.mToK != null) {
|
if (cl.mToK != null) {
|
||||||
dstk[ct] = (int)cl.mToK.getID(mRS);
|
dstk[ct] = cl.mToK.getID(mRS);
|
||||||
}
|
}
|
||||||
if (cl.mToF != null) {
|
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);
|
long id = mRS.nScriptGroupCreate(kernels, src, dstk, dstf, types);
|
||||||
|
@ -196,20 +196,18 @@ public class Type extends BaseObj {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
void updateFromNative() {
|
void updateFromNative() {
|
||||||
// FIXME: rsaTypeGetNativeData needs 32-bit and 64-bit paths
|
// We have 6 integer/long to obtain mDimX; mDimY; mDimZ;
|
||||||
|
|
||||||
// We have 6 integer to obtain mDimX; mDimY; mDimZ;
|
|
||||||
// mDimLOD; mDimFaces; mElement;
|
// mDimLOD; mDimFaces; mElement;
|
||||||
int[] dataBuffer = new int[6];
|
long[] dataBuffer = new long[6];
|
||||||
mRS.nTypeGetNativeData((int)getID(mRS), dataBuffer);
|
mRS.nTypeGetNativeData(getID(mRS), dataBuffer);
|
||||||
|
|
||||||
mDimX = dataBuffer[0];
|
mDimX = (int)dataBuffer[0];
|
||||||
mDimY = dataBuffer[1];
|
mDimY = (int)dataBuffer[1];
|
||||||
mDimZ = dataBuffer[2];
|
mDimZ = (int)dataBuffer[2];
|
||||||
mDimMipmaps = dataBuffer[3] == 1 ? true : false;
|
mDimMipmaps = dataBuffer[3] == 1 ? true : false;
|
||||||
mDimFaces = dataBuffer[4] == 1 ? true : false;
|
mDimFaces = dataBuffer[4] == 1 ? true : false;
|
||||||
|
|
||||||
int elementID = dataBuffer[5];
|
long elementID = dataBuffer[5];
|
||||||
if(elementID != 0) {
|
if(elementID != 0) {
|
||||||
mElement = new Element(elementID, mRS);
|
mElement = new Element(elementID, mRS);
|
||||||
mElement.updateFromNative();
|
mElement.updateFromNative();
|
||||||
|
@ -412,13 +412,21 @@ nElementCreate(JNIEnv *_env, jobject _this, jlong con, jlong type, jint kind, jb
|
|||||||
|
|
||||||
static jlong
|
static jlong
|
||||||
nElementCreate2(JNIEnv *_env, jobject _this, jlong con,
|
nElementCreate2(JNIEnv *_env, jobject _this, jlong con,
|
||||||
jintArray _ids, jobjectArray _names, jintArray _arraySizes)
|
jlongArray _ids, jobjectArray _names, jintArray _arraySizes)
|
||||||
{
|
{
|
||||||
int fieldCount = _env->GetArrayLength(_ids);
|
int fieldCount = _env->GetArrayLength(_ids);
|
||||||
LOG_API("nElementCreate2, con(%p)", (RsContext)con);
|
LOG_API("nElementCreate2, con(%p)", (RsContext)con);
|
||||||
|
|
||||||
jint *ids = _env->GetIntArrayElements(_ids, NULL);
|
jlong *jIds = _env->GetLongArrayElements(_ids, NULL);
|
||||||
jint *arraySizes = _env->GetIntArrayElements(_arraySizes, NULL);
|
jint *jArraySizes = _env->GetIntArrayElements(_arraySizes, NULL);
|
||||||
|
|
||||||
|
RsElement *ids = (RsElement*)malloc(fieldCount * sizeof(RsElement));
|
||||||
|
uint32_t *arraySizes = (uint32_t *)malloc(fieldCount * sizeof(uint32_t));
|
||||||
|
|
||||||
|
for(int i = 0; i < fieldCount; i ++) {
|
||||||
|
ids[i] = (RsElement)jIds[i];
|
||||||
|
arraySizes[i] = (uint32_t)jArraySizes[i];
|
||||||
|
}
|
||||||
|
|
||||||
AutoJavaStringArrayToUTF8 names(_env, _names, fieldCount);
|
AutoJavaStringArrayToUTF8 names(_env, _names, fieldCount);
|
||||||
|
|
||||||
@ -426,12 +434,15 @@ nElementCreate2(JNIEnv *_env, jobject _this, jlong con,
|
|||||||
size_t *sizeArray = names.c_str_len();
|
size_t *sizeArray = names.c_str_len();
|
||||||
|
|
||||||
jlong id = (jlong)rsElementCreate2((RsContext)con,
|
jlong id = (jlong)rsElementCreate2((RsContext)con,
|
||||||
(RsElement *)ids, fieldCount,
|
(const RsElement *)ids, fieldCount,
|
||||||
nameArray, fieldCount * sizeof(size_t), sizeArray,
|
nameArray, fieldCount * sizeof(size_t), sizeArray,
|
||||||
(const uint32_t *)arraySizes, fieldCount);
|
(const uint32_t *)arraySizes, fieldCount);
|
||||||
|
|
||||||
_env->ReleaseIntArrayElements(_ids, ids, JNI_ABORT);
|
free(ids);
|
||||||
_env->ReleaseIntArrayElements(_arraySizes, arraySizes, JNI_ABORT);
|
free(arraySizes);
|
||||||
|
_env->ReleaseLongArrayElements(_ids, jIds, JNI_ABORT);
|
||||||
|
_env->ReleaseIntArrayElements(_arraySizes, jArraySizes, JNI_ABORT);
|
||||||
|
|
||||||
return (jlong)id;
|
return (jlong)id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,30 +459,33 @@ nElementGetNativeData(JNIEnv *_env, jobject _this, jlong con, jlong id, jintArra
|
|||||||
rsaElementGetNativeData((RsContext)con, (RsElement)id, elementData, dataSize);
|
rsaElementGetNativeData((RsContext)con, (RsElement)id, elementData, dataSize);
|
||||||
|
|
||||||
for(jint i = 0; i < dataSize; i ++) {
|
for(jint i = 0; i < dataSize; i ++) {
|
||||||
_env->SetIntArrayRegion(_elementData, i, 1, (const jint*)&elementData[i]);
|
const jint data = (jint)elementData[i];
|
||||||
|
_env->SetIntArrayRegion(_elementData, i, 1, &data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nElementGetSubElements(JNIEnv *_env, jobject _this, jlong con, jlong id,
|
nElementGetSubElements(JNIEnv *_env, jobject _this, jlong con, jlong id,
|
||||||
jintArray _IDs,
|
jlongArray _IDs,
|
||||||
jobjectArray _names,
|
jobjectArray _names,
|
||||||
jintArray _arraySizes)
|
jintArray _arraySizes)
|
||||||
{
|
{
|
||||||
int dataSize = _env->GetArrayLength(_IDs);
|
uint32_t dataSize = _env->GetArrayLength(_IDs);
|
||||||
LOG_API("nElementGetSubElements, con(%p)", (RsContext)con);
|
LOG_API("nElementGetSubElements, con(%p)", (RsContext)con);
|
||||||
|
|
||||||
uint32_t *ids = (uint32_t *)malloc((uint32_t)dataSize * sizeof(uint32_t));
|
uintptr_t *ids = (uintptr_t*)malloc(dataSize * sizeof(uintptr_t));
|
||||||
const char **names = (const char **)malloc((uint32_t)dataSize * sizeof(const char *));
|
const char **names = (const char **)malloc(dataSize * sizeof(const char *));
|
||||||
uint32_t *arraySizes = (uint32_t *)malloc((uint32_t)dataSize * sizeof(uint32_t));
|
size_t *arraySizes = (size_t *)malloc(dataSize * sizeof(size_t));
|
||||||
|
|
||||||
rsaElementGetSubElements((RsContext)con, (RsElement)id, ids, names, arraySizes, (uint32_t)dataSize);
|
rsaElementGetSubElements((RsContext)con, (RsElement)id, ids, names, arraySizes, (uint32_t)dataSize);
|
||||||
|
|
||||||
for(jint i = 0; i < dataSize; i++) {
|
for(uint32_t i = 0; i < dataSize; i++) {
|
||||||
|
const jlong id = (jlong)ids[i];
|
||||||
|
const jint arraySize = (jint)arraySizes[i];
|
||||||
_env->SetObjectArrayElement(_names, i, _env->NewStringUTF(names[i]));
|
_env->SetObjectArrayElement(_names, i, _env->NewStringUTF(names[i]));
|
||||||
_env->SetIntArrayRegion(_IDs, i, 1, (const jint*)&ids[i]);
|
_env->SetLongArrayRegion(_IDs, i, 1, &id);
|
||||||
_env->SetIntArrayRegion(_arraySizes, i, 1, (const jint*)&arraySizes[i]);
|
_env->SetIntArrayRegion(_arraySizes, i, 1, &arraySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(ids);
|
free(ids);
|
||||||
@ -492,7 +506,7 @@ nTypeCreate(JNIEnv *_env, jobject _this, jlong con, jlong eid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nTypeGetNativeData(JNIEnv *_env, jobject _this, jlong con, jlong id, jintArray _typeData)
|
nTypeGetNativeData(JNIEnv *_env, jobject _this, jlong con, jlong id, jlongArray _typeData)
|
||||||
{
|
{
|
||||||
// We are packing 6 items: mDimX; mDimY; mDimZ;
|
// We are packing 6 items: mDimX; mDimY; mDimZ;
|
||||||
// mDimLOD; mDimFaces; mElement; into typeData
|
// mDimLOD; mDimFaces; mElement; into typeData
|
||||||
@ -501,21 +515,22 @@ nTypeGetNativeData(JNIEnv *_env, jobject _this, jlong con, jlong id, jintArray _
|
|||||||
assert(elementCount == 6);
|
assert(elementCount == 6);
|
||||||
LOG_API("nTypeGetNativeData, con(%p)", (RsContext)con);
|
LOG_API("nTypeGetNativeData, con(%p)", (RsContext)con);
|
||||||
|
|
||||||
uint32_t typeData[6];
|
uintptr_t typeData[6];
|
||||||
rsaTypeGetNativeData((RsContext)con, (RsType)id, typeData, 6);
|
rsaTypeGetNativeData((RsContext)con, (RsType)id, typeData, 6);
|
||||||
|
|
||||||
for(jint i = 0; i < elementCount; i ++) {
|
for(jint i = 0; i < elementCount; i ++) {
|
||||||
_env->SetIntArrayRegion(_typeData, i, 1, (const jint*)&typeData[i]);
|
const jlong data = (jlong)typeData[i];
|
||||||
|
_env->SetLongArrayRegion(_typeData, i, 1, &data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------
|
// -----------------------------------
|
||||||
|
|
||||||
static jlong
|
static jlong
|
||||||
nAllocationCreateTyped(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mips, jint usage, jint pointer)
|
nAllocationCreateTyped(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mips, jint usage, jlong pointer)
|
||||||
{
|
{
|
||||||
LOG_API("nAllocationCreateTyped, con(%p), type(%p), mip(%i), usage(%i), ptr(%p)", (RsContext)con, (RsElement)type, mips, usage, (void *)pointer);
|
LOG_API("nAllocationCreateTyped, con(%p), type(%p), mip(%i), usage(%i), ptr(%p)", (RsContext)con, (RsElement)type, mips, usage, (void *)pointer);
|
||||||
return (jlong) rsAllocationCreateTyped((RsContext)con, (RsType)type, (RsAllocationMipmapControl)mips, (uint32_t)usage, (uint32_t)pointer);
|
return (jlong) rsAllocationCreateTyped((RsContext)con, (RsType)type, (RsAllocationMipmapControl)mips, (uint32_t)usage, (uintptr_t)pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -601,7 +616,7 @@ nAllocationCreateBitmapBackedAllocation(JNIEnv *_env, jobject _this, jlong con,
|
|||||||
const void* ptr = bitmap.getPixels();
|
const void* ptr = bitmap.getPixels();
|
||||||
jlong id = (jlong)rsAllocationCreateTyped((RsContext)con,
|
jlong id = (jlong)rsAllocationCreateTyped((RsContext)con,
|
||||||
(RsType)type, (RsAllocationMipmapControl)mip,
|
(RsType)type, (RsAllocationMipmapControl)mip,
|
||||||
(uint32_t)usage, (size_t)ptr);
|
(uint32_t)usage, (uintptr_t)ptr);
|
||||||
bitmap.unlockPixels();
|
bitmap.unlockPixels();
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -1196,34 +1211,63 @@ nScriptFieldIDCreate(JNIEnv *_env, jobject _this, jlong con, jlong sid, jint slo
|
|||||||
}
|
}
|
||||||
|
|
||||||
static jlong
|
static jlong
|
||||||
nScriptGroupCreate(JNIEnv *_env, jobject _this, jlong con, jintArray _kernels, jintArray _src,
|
nScriptGroupCreate(JNIEnv *_env, jobject _this, jlong con, jlongArray _kernels, jlongArray _src,
|
||||||
jintArray _dstk, jintArray _dstf, jintArray _types)
|
jlongArray _dstk, jlongArray _dstf, jlongArray _types)
|
||||||
{
|
{
|
||||||
LOG_API("nScriptGroupCreate, con(%p)", (RsContext)con);
|
LOG_API("nScriptGroupCreate, con(%p)", (RsContext)con);
|
||||||
|
|
||||||
jint kernelsLen = _env->GetArrayLength(_kernels) * sizeof(int);
|
jint kernelsLen = _env->GetArrayLength(_kernels);
|
||||||
jint *kernelsPtr = _env->GetIntArrayElements(_kernels, NULL);
|
jlong *jKernelsPtr = _env->GetLongArrayElements(_kernels, NULL);
|
||||||
jint srcLen = _env->GetArrayLength(_src) * sizeof(int);
|
RsScriptKernelID* kernelsPtr = (RsScriptKernelID*) malloc(sizeof(RsScriptKernelID) * kernelsLen);
|
||||||
jint *srcPtr = _env->GetIntArrayElements(_src, NULL);
|
for(int i = 0; i < kernelsLen; ++i) {
|
||||||
jint dstkLen = _env->GetArrayLength(_dstk) * sizeof(int);
|
kernelsPtr[i] = (RsScriptKernelID)jKernelsPtr[i];
|
||||||
jint *dstkPtr = _env->GetIntArrayElements(_dstk, NULL);
|
}
|
||||||
jint dstfLen = _env->GetArrayLength(_dstf) * sizeof(int);
|
|
||||||
jint *dstfPtr = _env->GetIntArrayElements(_dstf, NULL);
|
|
||||||
jint typesLen = _env->GetArrayLength(_types) * sizeof(int);
|
|
||||||
jint *typesPtr = _env->GetIntArrayElements(_types, NULL);
|
|
||||||
|
|
||||||
int id = (int)rsScriptGroupCreate((RsContext)con,
|
jint srcLen = _env->GetArrayLength(_src);
|
||||||
(RsScriptKernelID *)kernelsPtr, kernelsLen,
|
jlong *jSrcPtr = _env->GetLongArrayElements(_src, NULL);
|
||||||
(RsScriptKernelID *)srcPtr, srcLen,
|
RsScriptKernelID* srcPtr = (RsScriptKernelID*) malloc(sizeof(RsScriptKernelID) * srcLen);
|
||||||
(RsScriptKernelID *)dstkPtr, dstkLen,
|
for(int i = 0; i < srcLen; ++i) {
|
||||||
(RsScriptFieldID *)dstfPtr, dstfLen,
|
srcPtr[i] = (RsScriptKernelID)jSrcPtr[i];
|
||||||
(RsType *)typesPtr, typesLen);
|
}
|
||||||
|
|
||||||
_env->ReleaseIntArrayElements(_kernels, kernelsPtr, 0);
|
jint dstkLen = _env->GetArrayLength(_dstk);
|
||||||
_env->ReleaseIntArrayElements(_src, srcPtr, 0);
|
jlong *jDstkPtr = _env->GetLongArrayElements(_dstk, NULL);
|
||||||
_env->ReleaseIntArrayElements(_dstk, dstkPtr, 0);
|
RsScriptKernelID* dstkPtr = (RsScriptKernelID*) malloc(sizeof(RsScriptKernelID) * dstkLen);
|
||||||
_env->ReleaseIntArrayElements(_dstf, dstfPtr, 0);
|
for(int i = 0; i < dstkLen; ++i) {
|
||||||
_env->ReleaseIntArrayElements(_types, typesPtr, 0);
|
dstkPtr[i] = (RsScriptKernelID)jDstkPtr[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
jint dstfLen = _env->GetArrayLength(_dstf);
|
||||||
|
jlong *jDstfPtr = _env->GetLongArrayElements(_dstf, NULL);
|
||||||
|
RsScriptKernelID* dstfPtr = (RsScriptKernelID*) malloc(sizeof(RsScriptKernelID) * dstfLen);
|
||||||
|
for(int i = 0; i < dstfLen; ++i) {
|
||||||
|
dstfPtr[i] = (RsScriptKernelID)jDstfPtr[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
jint typesLen = _env->GetArrayLength(_types);
|
||||||
|
jlong *jTypesPtr = _env->GetLongArrayElements(_types, NULL);
|
||||||
|
RsType* typesPtr = (RsType*) malloc(sizeof(RsType) * typesLen);
|
||||||
|
for(int i = 0; i < typesLen; ++i) {
|
||||||
|
typesPtr[i] = (RsType)jTypesPtr[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
jlong id = (jlong)rsScriptGroupCreate((RsContext)con,
|
||||||
|
(RsScriptKernelID *)kernelsPtr, kernelsLen * sizeof(RsScriptKernelID),
|
||||||
|
(RsScriptKernelID *)srcPtr, srcLen * sizeof(RsScriptKernelID),
|
||||||
|
(RsScriptKernelID *)dstkPtr, dstkLen * sizeof(RsScriptKernelID),
|
||||||
|
(RsScriptFieldID *)dstfPtr, dstfLen * sizeof(RsScriptKernelID),
|
||||||
|
(RsType *)typesPtr, typesLen * sizeof(RsType));
|
||||||
|
|
||||||
|
free(kernelsPtr);
|
||||||
|
free(srcPtr);
|
||||||
|
free(dstkPtr);
|
||||||
|
free(dstfPtr);
|
||||||
|
free(typesPtr);
|
||||||
|
_env->ReleaseLongArrayElements(_kernels, jKernelsPtr, 0);
|
||||||
|
_env->ReleaseLongArrayElements(_src, jSrcPtr, 0);
|
||||||
|
_env->ReleaseLongArrayElements(_dstk, jDstkPtr, 0);
|
||||||
|
_env->ReleaseLongArrayElements(_dstf, jDstfPtr, 0);
|
||||||
|
_env->ReleaseLongArrayElements(_types, jTypesPtr, 0);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1292,10 +1336,10 @@ nProgramBindSampler(JNIEnv *_env, jobject _this, jlong con, jlong vpf, jint slot
|
|||||||
|
|
||||||
static jlong
|
static jlong
|
||||||
nProgramFragmentCreate(JNIEnv *_env, jobject _this, jlong con, jstring shader,
|
nProgramFragmentCreate(JNIEnv *_env, jobject _this, jlong con, jstring shader,
|
||||||
jobjectArray texNames, jintArray params)
|
jobjectArray texNames, jlongArray params)
|
||||||
{
|
{
|
||||||
AutoJavaStringToUTF8 shaderUTF(_env, shader);
|
AutoJavaStringToUTF8 shaderUTF(_env, shader);
|
||||||
jint *paramPtr = _env->GetIntArrayElements(params, NULL);
|
jlong *jParamPtr = _env->GetLongArrayElements(params, NULL);
|
||||||
jint paramLen = _env->GetArrayLength(params);
|
jint paramLen = _env->GetArrayLength(params);
|
||||||
|
|
||||||
int texCount = _env->GetArrayLength(texNames);
|
int texCount = _env->GetArrayLength(texNames);
|
||||||
@ -1305,11 +1349,16 @@ nProgramFragmentCreate(JNIEnv *_env, jobject _this, jlong con, jstring shader,
|
|||||||
|
|
||||||
LOG_API("nProgramFragmentCreate, con(%p), paramLen(%i)", (RsContext)con, paramLen);
|
LOG_API("nProgramFragmentCreate, con(%p), paramLen(%i)", (RsContext)con, paramLen);
|
||||||
|
|
||||||
|
uintptr_t * paramPtr = (uintptr_t*) malloc(sizeof(uintptr_t) * paramLen);
|
||||||
|
for(int i = 0; i < paramLen; ++i) {
|
||||||
|
paramPtr[i] = (uintptr_t)jParamPtr[i];
|
||||||
|
}
|
||||||
jlong ret = (jlong)rsProgramFragmentCreate((RsContext)con, shaderUTF.c_str(), shaderUTF.length(),
|
jlong ret = (jlong)rsProgramFragmentCreate((RsContext)con, shaderUTF.c_str(), shaderUTF.length(),
|
||||||
nameArray, texCount, sizeArray,
|
nameArray, texCount, sizeArray,
|
||||||
(uint32_t *)paramPtr, paramLen);
|
paramPtr, paramLen);
|
||||||
|
|
||||||
_env->ReleaseIntArrayElements(params, paramPtr, JNI_ABORT);
|
free(paramPtr);
|
||||||
|
_env->ReleaseLongArrayElements(params, jParamPtr, JNI_ABORT);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1318,10 +1367,10 @@ nProgramFragmentCreate(JNIEnv *_env, jobject _this, jlong con, jstring shader,
|
|||||||
|
|
||||||
static jlong
|
static jlong
|
||||||
nProgramVertexCreate(JNIEnv *_env, jobject _this, jlong con, jstring shader,
|
nProgramVertexCreate(JNIEnv *_env, jobject _this, jlong con, jstring shader,
|
||||||
jobjectArray texNames, jintArray params)
|
jobjectArray texNames, jlongArray params)
|
||||||
{
|
{
|
||||||
AutoJavaStringToUTF8 shaderUTF(_env, shader);
|
AutoJavaStringToUTF8 shaderUTF(_env, shader);
|
||||||
jint *paramPtr = _env->GetIntArrayElements(params, NULL);
|
jlong *jParamPtr = _env->GetLongArrayElements(params, NULL);
|
||||||
jint paramLen = _env->GetArrayLength(params);
|
jint paramLen = _env->GetArrayLength(params);
|
||||||
|
|
||||||
LOG_API("nProgramVertexCreate, con(%p), paramLen(%i)", (RsContext)con, paramLen);
|
LOG_API("nProgramVertexCreate, con(%p), paramLen(%i)", (RsContext)con, paramLen);
|
||||||
@ -1331,11 +1380,17 @@ nProgramVertexCreate(JNIEnv *_env, jobject _this, jlong con, jstring shader,
|
|||||||
const char ** nameArray = names.c_str();
|
const char ** nameArray = names.c_str();
|
||||||
size_t* sizeArray = names.c_str_len();
|
size_t* sizeArray = names.c_str_len();
|
||||||
|
|
||||||
|
uintptr_t * paramPtr = (uintptr_t*) malloc(sizeof(uintptr_t) * paramLen);
|
||||||
|
for(int i = 0; i < paramLen; ++i) {
|
||||||
|
paramPtr[i] = (uintptr_t)jParamPtr[i];
|
||||||
|
}
|
||||||
|
|
||||||
jlong ret = (jlong)rsProgramVertexCreate((RsContext)con, shaderUTF.c_str(), shaderUTF.length(),
|
jlong ret = (jlong)rsProgramVertexCreate((RsContext)con, shaderUTF.c_str(), shaderUTF.length(),
|
||||||
nameArray, texCount, sizeArray,
|
nameArray, texCount, sizeArray,
|
||||||
(uint32_t *)paramPtr, paramLen);
|
paramPtr, paramLen);
|
||||||
|
|
||||||
_env->ReleaseIntArrayElements(params, paramPtr, JNI_ABORT);
|
free(paramPtr);
|
||||||
|
_env->ReleaseLongArrayElements(params, jParamPtr, JNI_ABORT);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1416,24 +1471,36 @@ nPathCreate(JNIEnv *_env, jobject _this, jlong con, jint prim, jboolean isStatic
|
|||||||
}
|
}
|
||||||
|
|
||||||
static jlong
|
static jlong
|
||||||
nMeshCreate(JNIEnv *_env, jobject _this, jlong con, jintArray _vtx, jintArray _idx, jintArray _prim)
|
nMeshCreate(JNIEnv *_env, jobject _this, jlong con, jlongArray _vtx, jlongArray _idx, jintArray _prim)
|
||||||
{
|
{
|
||||||
LOG_API("nMeshCreate, con(%p)", (RsContext)con);
|
LOG_API("nMeshCreate, con(%p)", (RsContext)con);
|
||||||
|
|
||||||
jint vtxLen = _env->GetArrayLength(_vtx);
|
jint vtxLen = _env->GetArrayLength(_vtx);
|
||||||
jint *vtxPtr = _env->GetIntArrayElements(_vtx, NULL);
|
jlong *jVtxPtr = _env->GetLongArrayElements(_vtx, NULL);
|
||||||
|
RsAllocation* vtxPtr = (RsAllocation*) malloc(sizeof(RsAllocation) * vtxLen);
|
||||||
|
for(int i = 0; i < vtxLen; ++i) {
|
||||||
|
vtxPtr[i] = (RsAllocation)(uintptr_t)jVtxPtr[i];
|
||||||
|
}
|
||||||
|
|
||||||
jint idxLen = _env->GetArrayLength(_idx);
|
jint idxLen = _env->GetArrayLength(_idx);
|
||||||
jint *idxPtr = _env->GetIntArrayElements(_idx, NULL);
|
jlong *jIdxPtr = _env->GetLongArrayElements(_idx, NULL);
|
||||||
|
RsAllocation* idxPtr = (RsAllocation*) malloc(sizeof(RsAllocation) * idxLen);
|
||||||
|
for(int i = 0; i < idxLen; ++i) {
|
||||||
|
idxPtr[i] = (RsAllocation)(uintptr_t)jIdxPtr[i];
|
||||||
|
}
|
||||||
|
|
||||||
jint primLen = _env->GetArrayLength(_prim);
|
jint primLen = _env->GetArrayLength(_prim);
|
||||||
jint *primPtr = _env->GetIntArrayElements(_prim, NULL);
|
jint *primPtr = _env->GetIntArrayElements(_prim, NULL);
|
||||||
|
|
||||||
int id = (int)rsMeshCreate((RsContext)con,
|
jlong id = (jlong)rsMeshCreate((RsContext)con,
|
||||||
(RsAllocation *)vtxPtr, vtxLen,
|
(RsAllocation *)vtxPtr, vtxLen,
|
||||||
(RsAllocation *)idxPtr, idxLen,
|
(RsAllocation *)idxPtr, idxLen,
|
||||||
(uint32_t *)primPtr, primLen);
|
(uint32_t *)primPtr, primLen);
|
||||||
|
|
||||||
_env->ReleaseIntArrayElements(_vtx, vtxPtr, 0);
|
free(vtxPtr);
|
||||||
_env->ReleaseIntArrayElements(_idx, idxPtr, 0);
|
free(idxPtr);
|
||||||
|
_env->ReleaseLongArrayElements(_vtx, jVtxPtr, 0);
|
||||||
|
_env->ReleaseLongArrayElements(_idx, jIdxPtr, 0);
|
||||||
_env->ReleaseIntArrayElements(_prim, primPtr, 0);
|
_env->ReleaseIntArrayElements(_prim, primPtr, 0);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -1457,7 +1524,7 @@ nMeshGetIndexCount(JNIEnv *_env, jobject _this, jlong con, jlong mesh)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nMeshGetVertices(JNIEnv *_env, jobject _this, jlong con, jlong mesh, jintArray _ids, int numVtxIDs)
|
nMeshGetVertices(JNIEnv *_env, jobject _this, jlong con, jlong mesh, jlongArray _ids, jint numVtxIDs)
|
||||||
{
|
{
|
||||||
LOG_API("nMeshGetVertices, con(%p), Mesh(%p)", (RsContext)con, (RsMesh)mesh);
|
LOG_API("nMeshGetVertices, con(%p), Mesh(%p)", (RsContext)con, (RsMesh)mesh);
|
||||||
|
|
||||||
@ -1465,14 +1532,15 @@ nMeshGetVertices(JNIEnv *_env, jobject _this, jlong con, jlong mesh, jintArray _
|
|||||||
rsaMeshGetVertices((RsContext)con, (RsMesh)mesh, allocs, (uint32_t)numVtxIDs);
|
rsaMeshGetVertices((RsContext)con, (RsMesh)mesh, allocs, (uint32_t)numVtxIDs);
|
||||||
|
|
||||||
for(jint i = 0; i < numVtxIDs; i ++) {
|
for(jint i = 0; i < numVtxIDs; i ++) {
|
||||||
_env->SetIntArrayRegion(_ids, i, 1, (const jint*)&allocs[i]);
|
const jlong alloc = (jlong)allocs[i];
|
||||||
|
_env->SetLongArrayRegion(_ids, i, 1, &alloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(allocs);
|
free(allocs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
nMeshGetIndices(JNIEnv *_env, jobject _this, jlong con, jlong mesh, jintArray _idxIds, jintArray _primitives, int numIndices)
|
nMeshGetIndices(JNIEnv *_env, jobject _this, jlong con, jlong mesh, jlongArray _idxIds, jintArray _primitives, jint numIndices)
|
||||||
{
|
{
|
||||||
LOG_API("nMeshGetVertices, con(%p), Mesh(%p)", (RsContext)con, (RsMesh)mesh);
|
LOG_API("nMeshGetVertices, con(%p), Mesh(%p)", (RsContext)con, (RsMesh)mesh);
|
||||||
|
|
||||||
@ -1482,8 +1550,10 @@ nMeshGetIndices(JNIEnv *_env, jobject _this, jlong con, jlong mesh, jintArray _i
|
|||||||
rsaMeshGetIndices((RsContext)con, (RsMesh)mesh, allocs, prims, (uint32_t)numIndices);
|
rsaMeshGetIndices((RsContext)con, (RsMesh)mesh, allocs, prims, (uint32_t)numIndices);
|
||||||
|
|
||||||
for(jint i = 0; i < numIndices; i ++) {
|
for(jint i = 0; i < numIndices; i ++) {
|
||||||
_env->SetIntArrayRegion(_idxIds, i, 1, (const jint*)&allocs[i]);
|
const jlong alloc = (jlong)allocs[i];
|
||||||
_env->SetIntArrayRegion(_primitives, i, 1, (const jint*)&prims[i]);
|
const jint prim = (jint)prims[i];
|
||||||
|
_env->SetLongArrayRegion(_idxIds, i, 1, &alloc);
|
||||||
|
_env->SetIntArrayRegion(_primitives, i, 1, &prim);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(allocs);
|
free(allocs);
|
||||||
@ -1536,14 +1606,14 @@ static JNINativeMethod methods[] = {
|
|||||||
{"rsnFontCreateFromAsset", "(JLandroid/content/res/AssetManager;Ljava/lang/String;FI)J", (void*)nFontCreateFromAsset },
|
{"rsnFontCreateFromAsset", "(JLandroid/content/res/AssetManager;Ljava/lang/String;FI)J", (void*)nFontCreateFromAsset },
|
||||||
|
|
||||||
{"rsnElementCreate", "(JJIZI)J", (void*)nElementCreate },
|
{"rsnElementCreate", "(JJIZI)J", (void*)nElementCreate },
|
||||||
{"rsnElementCreate2", "(J[I[Ljava/lang/String;[I)J", (void*)nElementCreate2 },
|
{"rsnElementCreate2", "(J[J[Ljava/lang/String;[I)J", (void*)nElementCreate2 },
|
||||||
{"rsnElementGetNativeData", "(JJ[I)V", (void*)nElementGetNativeData },
|
{"rsnElementGetNativeData", "(JJ[I)V", (void*)nElementGetNativeData },
|
||||||
{"rsnElementGetSubElements", "(JJ[I[Ljava/lang/String;[I)V", (void*)nElementGetSubElements },
|
{"rsnElementGetSubElements", "(JJ[J[Ljava/lang/String;[I)V", (void*)nElementGetSubElements },
|
||||||
|
|
||||||
{"rsnTypeCreate", "(JJIIIZZI)J", (void*)nTypeCreate },
|
{"rsnTypeCreate", "(JJIIIZZI)J", (void*)nTypeCreate },
|
||||||
{"rsnTypeGetNativeData", "(JJ[I)V", (void*)nTypeGetNativeData },
|
{"rsnTypeGetNativeData", "(JJ[J)V", (void*)nTypeGetNativeData },
|
||||||
|
|
||||||
{"rsnAllocationCreateTyped", "(JJIII)J", (void*)nAllocationCreateTyped },
|
{"rsnAllocationCreateTyped", "(JJIIJ)J", (void*)nAllocationCreateTyped },
|
||||||
{"rsnAllocationCreateFromBitmap", "(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCreateFromBitmap },
|
{"rsnAllocationCreateFromBitmap", "(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCreateFromBitmap },
|
||||||
{"rsnAllocationCreateBitmapBackedAllocation", "(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCreateBitmapBackedAllocation },
|
{"rsnAllocationCreateBitmapBackedAllocation", "(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCreateBitmapBackedAllocation },
|
||||||
{"rsnAllocationCubeCreateFromBitmap","(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCubeCreateFromBitmap },
|
{"rsnAllocationCubeCreateFromBitmap","(JJILandroid/graphics/Bitmap;I)J", (void*)nAllocationCubeCreateFromBitmap },
|
||||||
@ -1594,7 +1664,7 @@ static JNINativeMethod methods[] = {
|
|||||||
{"rsnScriptIntrinsicCreate", "(JIJ)J", (void*)nScriptIntrinsicCreate },
|
{"rsnScriptIntrinsicCreate", "(JIJ)J", (void*)nScriptIntrinsicCreate },
|
||||||
{"rsnScriptKernelIDCreate", "(JJII)J", (void*)nScriptKernelIDCreate },
|
{"rsnScriptKernelIDCreate", "(JJII)J", (void*)nScriptKernelIDCreate },
|
||||||
{"rsnScriptFieldIDCreate", "(JJI)J", (void*)nScriptFieldIDCreate },
|
{"rsnScriptFieldIDCreate", "(JJI)J", (void*)nScriptFieldIDCreate },
|
||||||
{"rsnScriptGroupCreate", "(J[I[I[I[I[I)J", (void*)nScriptGroupCreate },
|
{"rsnScriptGroupCreate", "(J[J[J[J[J[J)J", (void*)nScriptGroupCreate },
|
||||||
{"rsnScriptGroupSetInput", "(JJJJ)V", (void*)nScriptGroupSetInput },
|
{"rsnScriptGroupSetInput", "(JJJJ)V", (void*)nScriptGroupSetInput },
|
||||||
{"rsnScriptGroupSetOutput", "(JJJJ)V", (void*)nScriptGroupSetOutput },
|
{"rsnScriptGroupSetOutput", "(JJJJ)V", (void*)nScriptGroupSetOutput },
|
||||||
{"rsnScriptGroupExecute", "(JJ)V", (void*)nScriptGroupExecute },
|
{"rsnScriptGroupExecute", "(JJ)V", (void*)nScriptGroupExecute },
|
||||||
@ -1605,9 +1675,9 @@ static JNINativeMethod methods[] = {
|
|||||||
{"rsnProgramBindTexture", "(JJIJ)V", (void*)nProgramBindTexture },
|
{"rsnProgramBindTexture", "(JJIJ)V", (void*)nProgramBindTexture },
|
||||||
{"rsnProgramBindSampler", "(JJIJ)V", (void*)nProgramBindSampler },
|
{"rsnProgramBindSampler", "(JJIJ)V", (void*)nProgramBindSampler },
|
||||||
|
|
||||||
{"rsnProgramFragmentCreate", "(JLjava/lang/String;[Ljava/lang/String;[I)J", (void*)nProgramFragmentCreate },
|
{"rsnProgramFragmentCreate", "(JLjava/lang/String;[Ljava/lang/String;[J)J", (void*)nProgramFragmentCreate },
|
||||||
{"rsnProgramRasterCreate", "(JZI)J", (void*)nProgramRasterCreate },
|
{"rsnProgramRasterCreate", "(JZI)J", (void*)nProgramRasterCreate },
|
||||||
{"rsnProgramVertexCreate", "(JLjava/lang/String;[Ljava/lang/String;[I)J", (void*)nProgramVertexCreate },
|
{"rsnProgramVertexCreate", "(JLjava/lang/String;[Ljava/lang/String;[J)J", (void*)nProgramVertexCreate },
|
||||||
|
|
||||||
{"rsnContextBindRootScript", "(JI)V", (void*)nContextBindRootScript },
|
{"rsnContextBindRootScript", "(JI)V", (void*)nContextBindRootScript },
|
||||||
{"rsnContextBindProgramStore", "(JI)V", (void*)nContextBindProgramStore },
|
{"rsnContextBindProgramStore", "(JI)V", (void*)nContextBindProgramStore },
|
||||||
@ -1618,12 +1688,12 @@ static JNINativeMethod methods[] = {
|
|||||||
{"rsnSamplerCreate", "(JIIIIIF)J", (void*)nSamplerCreate },
|
{"rsnSamplerCreate", "(JIIIIIF)J", (void*)nSamplerCreate },
|
||||||
|
|
||||||
{"rsnPathCreate", "(JIZJJF)J", (void*)nPathCreate },
|
{"rsnPathCreate", "(JIZJJF)J", (void*)nPathCreate },
|
||||||
{"rsnMeshCreate", "(J[I[I[I)J", (void*)nMeshCreate },
|
{"rsnMeshCreate", "(J[J[J[I)J", (void*)nMeshCreate },
|
||||||
|
|
||||||
{"rsnMeshGetVertexBufferCount", "(JJ)I", (void*)nMeshGetVertexBufferCount },
|
{"rsnMeshGetVertexBufferCount", "(JJ)I", (void*)nMeshGetVertexBufferCount },
|
||||||
{"rsnMeshGetIndexCount", "(JJ)I", (void*)nMeshGetIndexCount },
|
{"rsnMeshGetIndexCount", "(JJ)I", (void*)nMeshGetIndexCount },
|
||||||
{"rsnMeshGetVertices", "(JJ[II)V", (void*)nMeshGetVertices },
|
{"rsnMeshGetVertices", "(JJ[JI)V", (void*)nMeshGetVertices },
|
||||||
{"rsnMeshGetIndices", "(JJ[I[II)V", (void*)nMeshGetIndices },
|
{"rsnMeshGetIndices", "(JJ[J[II)V", (void*)nMeshGetIndices },
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user