Renderscript getFieldID_ exception(对于ScriptGroup)

时间:2014-04-27 10:41:08

标签: renderscript

我正在尝试在脚本组中放置两个RS过滤器。我测试了两个脚本,它们按预期工作。每个过滤器的输入是全局分配。但是,当我尝试获取任何分配的fieldID时抛出异常:

//[..] Script object has been created 
Script.KernelID kernelID = mBox3x3.getKernelID_filter(); // this works
Script.FieldID field = mBox3x3.getFieldID_gIn(); // this throws

异常跟踪是:

Caused by: java.lang.NullPointerException
            at android.support.v8.renderscript.ScriptCThunker.thunkCreateFieldID(ScriptCThunker.java:224)
            at android.support.v8.renderscript.Script.createFieldID(Script.java:130)
            at com.example.android.basicrenderscript.ScriptC_boxFilter3x3.getFieldID_gIn(ScriptC_boxFilter3x3.java:61)

该脚本是一个简单的3x3盒式过滤器。 .rs文件是:

#pragma version(1)
#pragma rs java_package_name(com.example.android.basicrenderscript)
#pragma rs_fp_relaxed
rs_allocation gIn;
uchar4 __attribute__((kernel)) filter(uint32_t x, uint32_t y) {
[...]
}

全局字段是否需要特定标志?我错过了什么?谢谢!

0 个答案:

没有答案