OSDN Git Service

[RenderScript] Enable untyped variants of Allocation-copy functions for FLOAT_16
authorPirama Arumuga Nainar <pirama@google.com>
Wed, 2 Mar 2016 04:37:19 +0000 (20:37 -0800)
committerPirama Arumuga Nainar <pirama@google.com>
Thu, 3 Mar 2016 02:16:45 +0000 (18:16 -0800)
http://b/27251511

Handle FLOAT_16 case to PER_ARRAY_TYPE macro to enable untyped variants
of Allocation-copy functions.

Untyped variants of Allocation-copy functions call
validateObjectIsPrimitiveArray(), with checkType parameter set to true,
to validate and obtain the Element type of the Allocation.  When
checkType is true, validateObjectIsPrimitiveArray() returns the actual
Element type of the Allocation (instead of the canonical SIGNED type).
Because of this, FLOAT_16 element type can reach the JNI layer,
necessitating this change to PER_ARRAY_TYPE macro.

Change-Id: I3651e5ae0ab0cd6bb4ad3157841e2910ac8699dc

rs/jni/android_renderscript_RenderScript.cpp

index 3bef19e..4e667c6 100644 (file)
@@ -151,6 +151,7 @@ void UNUSED(T... t) {}
         return;                                                                         \
     case RS_TYPE_SIGNED_16:                                                             \
     case RS_TYPE_UNSIGNED_16:                                                           \
+    case RS_TYPE_FLOAT_16:                                                              \
         len = _env->GetArrayLength((jshortArray)data);                                  \
         ptr = _env->GetShortArrayElements((jshortArray)data, flag);                     \
         if (ptr == nullptr) {                                                           \