Android 如何从外部Renderscript分配中访问类型化数据?

Android 如何从外部Renderscript分配中访问类型化数据?,android,renderscript,Android,Renderscript,我通过以下方式创建类型化RS分配: mRS = RenderScript.create(mContext); Element.Builder eb = new Element.Builder(mRS); eb.add(Element.F32_3(mRS), "xyz"); eb.add(Element.F32_2(mRS), "uv"); Element eStride_XYZUV = eb.create(); mInAllocation = Allocation.createSized(mR

我通过以下方式创建类型化RS分配:

mRS = RenderScript.create(mContext);
Element.Builder eb = new Element.Builder(mRS);
eb.add(Element.F32_3(mRS), "xyz");
eb.add(Element.F32_2(mRS), "uv");
Element eStride_XYZUV = eb.create();

mInAllocation = Allocation.createSized(mRS, eStride_XYZUV, animLand.getArray().length / 5);
mOutAllocation = Allocation.createSized(mRS, eStride_XYZUV, animLand.getArray().length / 5);
mOutAllocation.copyTo(animLand.getArray());
animLand.getArray()
是一个浮点数组。我可以将数据复制到输入分配:

mInAllocation.copyFromUnchecked(animLand.getArray());
但是,当我尝试以这种方式从外部分配检索数据时:

mRS = RenderScript.create(mContext);
Element.Builder eb = new Element.Builder(mRS);
eb.add(Element.F32_3(mRS), "xyz");
eb.add(Element.F32_2(mRS), "uv");
Element eStride_XYZUV = eb.create();

mInAllocation = Allocation.createSized(mRS, eStride_XYZUV, animLand.getArray().length / 5);
mOutAllocation = Allocation.createSized(mRS, eStride_XYZUV, animLand.getArray().length / 5);
mOutAllocation.copyTo(animLand.getArray());
我得到一个例外:

android.renderscript.RSIllegalArgumentException: 32 bit float source does not match allocation type null
如何使用自定义
元素的数组
从输出
分配
访问数据?有一些方法可以复制到数组/位图,但仅适用于基本
元素
类型

如果我使用primitive
F32
type,它可以工作,但我希望使用类型化数据:

mInAllocation = Allocation.createSized(mRS, Element.F32(mRS), animLand.getArray().length);
mOutAllocation = Allocation.createSized(mRS, Element.F32(mRS), animLand.getArray().length);
...
mInAllocation.copyFromUnchecked(animLand.getArray());
...
mOutAllocation.copyTo(animLand.getArray());