2016-07-15 11 views
2

렌더의 모든 셀을 렌더러의 다른 할당으로 복사하려고했습니다. 로이드 현상 API 참조에서 이런 방법 그의 서명지원되지 않는 메소드 호출 rsAllocationCopy1DRange in android.support.v8.renderscript

공극 rsAllocationCopy1DRange이다 (rs_allocation의 dstAlloc가 dstOff uint32_t, dstMip uint32_t, srcMip uint32_t, srcOff uint32_t, rs_allocation의 srcAlloc 카운트 uint32_t) rsAllocationCopy1DRange을 얻었다;

.
방법에 대한 구글의 참조 링크는 https://developer.android.com/guide/topics/renderscript/reference/rs_allocation_data.html

하지만 난이 스크립트를 실행할 때 그것은

내 RS 스크립트

이하 android.support.v8.renderscript 오류가 지원되지 않는 방법 rsAllocationCopy1DRange에 전화를 보여줍니다
#pragma version(1) 
#pragma rs java_package_name(com.ravikant.rs) 
#pragma rs_fp_relaxed 

int width; 
int height; 

rs_allocation stateArr; 
rs_allocation stateNextArr; 

void __attribute__((kernel)) _copy(int32_t in) 
{ 
    int len=width*height; 
    rsAllocationCopy1DRange(stateArr,0,0,len,stateNextArr,0,0); 
} 

및 자바 코드는

float[] sideArr=new float[width*height}; 
Arrays.fill(sideArr,1); 
Allocation stateArrAlloc = Allocation.createSized(rs, Element.F32(rs), sideArr.length); 
Allocation stateNextArrAlloc = Allocation.createSized(rs, Element.F32(rs), sideArr.length); 
stateArrAlloc.copyFrom(sideArr); 
stateNextArrAlloc.copyFrom(sideArr); 

scriptC_copycells.set_width(width); 
scriptC_copycells.set_height(height); 
scriptC_copycells.set_stateArr(stateArrAlloc); 
scriptC_copycells.set_stateNextArr(stateNextArrAlloc); 
scriptC_copycells.forEach__copy(stateArrAlloc); 
,536,913,632입니다 10

오류에 대한 로그캣 출력은

E/AndroidRuntime: FATAL EXCEPTION: RSMessageThread 
Process: com.ravikant.rs, PID: 2321 
android.support.v8.renderscript.RSRuntimeException: Fatal error 4097, 
details: Error: Call to unsupported function rsAllocationCopy1DRange in kernel at android.support.v8.renderscript.RenderScript$MessageThread.run(RenderScript.java:1313) 
+0

해결 방법이 있습니까? 나도 같은 문제에 직면 해있다. –

답변

2

입니다. 버그는 logcat에서 올바르게 발생합니다. RenderScript 커널 내부에서 이런 종류의 호출을 할 수 없습니다. invokable 함수 안에서만이 호출을 할 수 있습니다. 또는 Java API를 사용하여 사물의 측면에서이 사본을 수행 할 수 있습니다.