Loading rs/java/android/renderscript/ScriptGroup.java +4 −2 Original line number Diff line number Diff line Loading @@ -278,6 +278,8 @@ public final class ScriptGroup extends BaseObj { public ValueAndSize(RenderScript rs, Object obj) { if (obj instanceof Allocation) { value = ((Allocation)obj).getID(rs); // Special value for size to tell the runtime and driver that // the value is an Allocation size = -1; } else if (obj instanceof Boolean) { value = ((Boolean)obj).booleanValue() ? 1 : 0; Loading @@ -289,10 +291,10 @@ public final class ScriptGroup extends BaseObj { value = ((Long)obj).longValue(); size = 8; } else if (obj instanceof Float) { value = ((Float)obj).longValue(); value = Float.floatToRawIntBits(((Float)obj).floatValue()); size = 4; } else if (obj instanceof Double) { value = ((Double)obj).longValue(); value = Double.doubleToRawLongBits(((Double)obj).doubleValue()); size = 8; } } Loading rs/jni/android_renderscript_RenderScript.cpp +6 −24 Original line number Diff line number Diff line Loading @@ -393,7 +393,6 @@ nClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong kernelID, size_t numValues, numDependencies; RsScriptFieldID* fieldIDs; uintptr_t* values; RsClosure* depClosures; RsScriptFieldID* depFieldIDs; Loading Loading @@ -430,15 +429,6 @@ nClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong kernelID, fieldIDs[i] = (RsScriptFieldID)jFieldIDs[i]; } values = (uintptr_t*)alloca(sizeof(uintptr_t) * numValues); if (values == nullptr) { goto exit; } for (size_t i = 0; i < numValues; i++) { values[i] = (uintptr_t)jValues[i]; } depClosures = (RsClosure*)alloca(sizeof(RsClosure) * numDependencies); if (depClosures == nullptr) { goto exit; Loading @@ -459,7 +449,7 @@ nClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong kernelID, ret = (jlong)(uintptr_t)rsClosureCreate( (RsContext)con, (RsScriptKernelID)kernelID, (RsAllocation)returnValue, fieldIDs, numValues, values, numValues, fieldIDs, numValues, jValues, numValues, (int*)jSizes, numValues, depClosures, numDependencies, depFieldIDs, numDependencies); Loading Loading @@ -511,7 +501,6 @@ nInvokeClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong invokeID, size_t numValues; RsScriptFieldID* fieldIDs; uintptr_t* values; if (fieldIDs_length != values_length || values_length != sizes_length) { ALOGE("Unmatched field IDs, values, and sizes in closure creation."); Loading @@ -534,18 +523,9 @@ nInvokeClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong invokeID, fieldIDs[i] = (RsScriptFieldID)jFieldIDs[i]; } values = (uintptr_t*)alloca(sizeof(uintptr_t) * numValues); if (values == nullptr) { goto exit; } for (size_t i = 0; i < numValues; i++) { values[i] = (uintptr_t)jValues[i]; } ret = (jlong)(uintptr_t)rsInvokeClosureCreate( (RsContext)con, (RsScriptInvokeID)invokeID, jParams, jParamLength, fieldIDs, numValues, values, numValues, fieldIDs, numValues, jValues, numValues, (int*)jSizes, numValues); exit: Loading @@ -561,15 +541,17 @@ exit: static void nClosureSetArg(JNIEnv *_env, jobject _this, jlong con, jlong closureID, jint index, jlong value, jint size) { // Size is signed with -1 indicating the value is an Allocation rsClosureSetArg((RsContext)con, (RsClosure)closureID, (uint32_t)index, (uintptr_t)value, (size_t)size); (uintptr_t)value, size); } static void nClosureSetGlobal(JNIEnv *_env, jobject _this, jlong con, jlong closureID, jlong fieldID, jlong value, jint size) { // Size is signed with -1 indicating the value is an Allocation rsClosureSetGlobal((RsContext)con, (RsClosure)closureID, (RsScriptFieldID)fieldID, (uintptr_t)value, (size_t)size); (RsScriptFieldID)fieldID, (int64_t)value, size); } static long Loading Loading
rs/java/android/renderscript/ScriptGroup.java +4 −2 Original line number Diff line number Diff line Loading @@ -278,6 +278,8 @@ public final class ScriptGroup extends BaseObj { public ValueAndSize(RenderScript rs, Object obj) { if (obj instanceof Allocation) { value = ((Allocation)obj).getID(rs); // Special value for size to tell the runtime and driver that // the value is an Allocation size = -1; } else if (obj instanceof Boolean) { value = ((Boolean)obj).booleanValue() ? 1 : 0; Loading @@ -289,10 +291,10 @@ public final class ScriptGroup extends BaseObj { value = ((Long)obj).longValue(); size = 8; } else if (obj instanceof Float) { value = ((Float)obj).longValue(); value = Float.floatToRawIntBits(((Float)obj).floatValue()); size = 4; } else if (obj instanceof Double) { value = ((Double)obj).longValue(); value = Double.doubleToRawLongBits(((Double)obj).doubleValue()); size = 8; } } Loading
rs/jni/android_renderscript_RenderScript.cpp +6 −24 Original line number Diff line number Diff line Loading @@ -393,7 +393,6 @@ nClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong kernelID, size_t numValues, numDependencies; RsScriptFieldID* fieldIDs; uintptr_t* values; RsClosure* depClosures; RsScriptFieldID* depFieldIDs; Loading Loading @@ -430,15 +429,6 @@ nClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong kernelID, fieldIDs[i] = (RsScriptFieldID)jFieldIDs[i]; } values = (uintptr_t*)alloca(sizeof(uintptr_t) * numValues); if (values == nullptr) { goto exit; } for (size_t i = 0; i < numValues; i++) { values[i] = (uintptr_t)jValues[i]; } depClosures = (RsClosure*)alloca(sizeof(RsClosure) * numDependencies); if (depClosures == nullptr) { goto exit; Loading @@ -459,7 +449,7 @@ nClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong kernelID, ret = (jlong)(uintptr_t)rsClosureCreate( (RsContext)con, (RsScriptKernelID)kernelID, (RsAllocation)returnValue, fieldIDs, numValues, values, numValues, fieldIDs, numValues, jValues, numValues, (int*)jSizes, numValues, depClosures, numDependencies, depFieldIDs, numDependencies); Loading Loading @@ -511,7 +501,6 @@ nInvokeClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong invokeID, size_t numValues; RsScriptFieldID* fieldIDs; uintptr_t* values; if (fieldIDs_length != values_length || values_length != sizes_length) { ALOGE("Unmatched field IDs, values, and sizes in closure creation."); Loading @@ -534,18 +523,9 @@ nInvokeClosureCreate(JNIEnv *_env, jobject _this, jlong con, jlong invokeID, fieldIDs[i] = (RsScriptFieldID)jFieldIDs[i]; } values = (uintptr_t*)alloca(sizeof(uintptr_t) * numValues); if (values == nullptr) { goto exit; } for (size_t i = 0; i < numValues; i++) { values[i] = (uintptr_t)jValues[i]; } ret = (jlong)(uintptr_t)rsInvokeClosureCreate( (RsContext)con, (RsScriptInvokeID)invokeID, jParams, jParamLength, fieldIDs, numValues, values, numValues, fieldIDs, numValues, jValues, numValues, (int*)jSizes, numValues); exit: Loading @@ -561,15 +541,17 @@ exit: static void nClosureSetArg(JNIEnv *_env, jobject _this, jlong con, jlong closureID, jint index, jlong value, jint size) { // Size is signed with -1 indicating the value is an Allocation rsClosureSetArg((RsContext)con, (RsClosure)closureID, (uint32_t)index, (uintptr_t)value, (size_t)size); (uintptr_t)value, size); } static void nClosureSetGlobal(JNIEnv *_env, jobject _this, jlong con, jlong closureID, jlong fieldID, jlong value, jint size) { // Size is signed with -1 indicating the value is an Allocation rsClosureSetGlobal((RsContext)con, (RsClosure)closureID, (RsScriptFieldID)fieldID, (uintptr_t)value, (size_t)size); (RsScriptFieldID)fieldID, (int64_t)value, size); } static long Loading