概览
下面的函数可用于从脚本创建分配 (Allocation)。
这些函数可以直接或间接从可调用函数中调用。如果某些控制流路径可能导致从 RenderScript 内核函数调用这些函数,则会生成编译器错误。
摘要
函数 | |
---|---|
rsCreateAllocation | 创建给定类型的 rs_allocation 对象。 |
rsCreateElement | 创建指定数据类型的 rs_element 对象 |
rsCreatePixelElement | 创建指定数据类型和数据种类的 rs_element 对象 |
rsCreateType | 创建具有指定元素和形状属性的 rs_type 对象 |
rsCreateVectorElement | 创建指定数据类型和向量宽度的 rs_element 对象 |
函数
rsCreateAllocation : 创建给定类型的 rs_allocation 对象。
rs_allocation rsCreateAllocation(rs_type type); | Added in API level 24 |
rs_allocation rsCreateAllocation(rs_type type, rs_allocation_mipmap_control mipmap, uint32_t usages, void* ptr); | Added in API level 24 |
rs_allocation rsCreateAllocation(rs_type type, uint32_t usage); | Added in API level 24 |
rs_allocation rsCreateAllocation_char(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_char(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_char(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_char2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_char2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_char2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_char3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_char3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_char3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_char4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_char4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_char4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_double(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_double(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_double(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_double2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_double2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_double2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_double3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_double3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_double3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_double4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_double4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_double4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_float(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_float(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_float(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_float2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_float2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_float2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_float3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_float3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_float3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_float4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_float4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_float4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_half(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_half(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_half(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_half2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_half2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_half2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_half3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_half3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_half3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_half4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_half4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_half4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_int(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_int(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_int(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_int2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_int2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_int2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_int3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_int3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_int3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_int4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_int4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_int4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_long(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_long(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_long(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_long2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_long2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_long2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_long3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_long3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_long3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_long4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_long4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_long4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_short(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_short(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_short(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_short2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_short2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_short2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_short3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_short3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_short3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_short4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_short4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_short4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_uchar4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_uint4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_ulong4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort2(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort2(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort3(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort3(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort4(uint32_t dimX); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort4(uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_allocation rsCreateAllocation_ushort4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
参数
type | 分配 (Allocation) 的类型 |
---|---|
usage | 分配 (Allocation) 的用途标志 |
mipmap | |
usages | |
ptr | |
dimX | |
dimY | |
dimZ |
创建给定类型和用途的 rs_allocation 对象。
RS_ALLOCATION_USAGE_SCRIPT 和 RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE 是从 RenderScript 脚本中创建的分配 (Allocation) 唯一支持的用途标志。
你还可以使用 rsCreateAllocation_
例如,rsCreateAllocation_int4() 返回指定尺寸的 int4 数据类型的分配 (Allocation)。
rsCreateElement : 创建指定数据类型的 rs_element 对象
rs_element rsCreateElement(int32_t data_type, int32_t data_kind, bool isNormalized, uint32_t vecSize); | Added in API level 24 |
rs_element rsCreateElement(rs_data_type data_type); | Added in API level 24 |
参数
data_type | 元素 (Element) 的数据类型 |
---|---|
data_kind | |
isNormalized | |
vecSize |
创建指定数据类型的 rs_element 对象。元素的 data kind 将设置为 RS_KIND_USER,vector_width 将设置为 1,表示非向量。
rsCreatePixelElement : 创建指定数据类型和数据种类的 rs_element 对象
rs_element rsCreatePixelElement(rs_data_type data_type, rs_data_kind data_kind); | Added in API level 24 |
参数
data_type | 元素 (Element) 的数据类型 |
---|---|
data_kind | 元素 (Element) 的数据种类 |
创建指定数据类型和数据种类的 rs_element 对象。元素的 vector_width 将设置为 1,表示非向量。
rsCreateType : 创建具有指定元素和形状属性的 rs_type 对象
rs_type rsCreateType(rs_element element, uint32_t dimX); | Added in API level 24 |
rs_type rsCreateType(rs_element element, uint32_t dimX, uint32_t dimY); | Added in API level 24 |
rs_type rsCreateType(rs_element element, uint32_t dimX, uint32_t dimY, uint32_t dimZ); | Added in API level 24 |
rs_type rsCreateType(rs_element element, uint32_t dimX, uint32_t dimY, uint32_t dimZ, bool mipmaps, bool faces, rs_yuv_format yuv_format); | Added in API level 24 |
参数
element | 与类型关联的元素 (Element) |
---|---|
dimX | 沿 X 维度的尺寸 |
dimY | 沿 Y 维度的尺寸 |
dimZ | 沿 Z 维度的尺寸 |
mipmaps | 指示类型是否具有 mipmap 链的标志 |
faces | 指示类型是否为 cubemap 的标志 |
yuv_format | 类型的 YUV 布局 |
创建具有指定元素和形状属性的 rs_type 对象。
dimX 指定 X 维度的尺寸。
dimY(如果存在且非零)表示存在 Y 维度并指示其尺寸。
dimZ(如果存在且非零)表示存在 Z 维度并指示其尺寸。
mipmaps 表示是否存在细节级别 (LOD)。
faces 表示是否存在 cubemap 面。
yuv_format 表示关联的 YUV 格式(或 RS_YUV_NONE)。
rsCreateVectorElement : 创建指定数据类型和向量宽度的 rs_element 对象
rs_element rsCreateVectorElement(rs_data_type data_type, uint32_t vector_width); | Added in API level 24 |
参数
data_type | 元素 (Element) 的数据类型 |
---|---|
vector_width | 向量宽度(2、3 或 4) |
创建指定数据类型和向量宽度的 rs_element 对象。vector_width 的值必须为 2、3 或 4。元素的 data kind 将设置为 RS_KIND_USER。