简体   繁体   English

从Android RenderScript获取计算值

[英]Get computated values from Android RenderScript

I tried to make the source example from [1], because I want to exchange data from Java to Renderscript and vice versa using the data type "integer". 我尝试从[1]制作源示例,因为我想使用数据类型“整数”从Java到Renderscript交换数据,反之亦然。 Everything in this example is working fine, but I cannot get the data back from RenderScript to Java. 此示例中的所有内容都可以正常工作,但是我无法将数据从RenderScript还原回Java。 I can see the calculated value in the Debug output but using return mScript.get_numberC(); 我可以在Debug输出中看到计算出的值,但是使用return mScript.get_numberC(); will return 0. I was also trying [2], but that won't work too. 将返回0。我也在尝试[2],但是那也行不通。 So is there any possibility to receive data from RenderScript, without using Allocation? 那么是否有可能在不使用分配的情况下从RenderScript接收数据? Another question would be how I can pass with Allocations 2 Integer Arrays over to RenderScript and to get one calculated array back without using rsPackColorTo8888(mono) ? 另一个问题是我如何将分配2整数数组传递给RenderScript,并在不使用rsPackColorTo8888(mono)情况下获得一个计算出的数组? Because my application won't be graphics relevant. 因为我的应用程序与图形无关。

[1] How to pass array values to and from Android RenderScript using Allocations [1] 如何使用分配与Android RenderScript之间传递数组值

[2] How to exchange data between renderscript and android framework? [2] 如何在renderscript和android框架之间交换数据?

This is actually expected behavior in API 17; 这实际上是API 17中的预期行为。 you can only receive the last value set by Java. 您只能接收Java设置的最后一个值。 In order to pass computed values back to Java, you have to encapsulate them in an Allocation. 为了将计算值传递回Java,您必须将它们封装在Allocation中。

We're looking at changing this in an upcoming release (in the sense that I have it mostly done right now :) ). 我们正在考虑在即将发布的版本中对此进行更改(从某种意义上说,我现在基本上已经完成了:))。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM