ฟังก์ชันการสร้างการจัดสรร RenderScript

ภาพรวม

ฟังก์ชันด้านล่างนี้สามารถใช้เพื่อสร้างการจัดสรรจากสคริปต์

ฟังก์ชันเหล่านี้สามารถเรียกใช้โดยตรงหรือโดยอ้อมจากฟังก์ชันที่เรียกใช้ได้ หากเส้นทางการไหลของการควบคุมบางเส้นทางทําให้เกิดการเรียกใช้ฟังก์ชันเหล่านี้จากฟังก์ชันเคอร์เนลของ 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); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation(rs_type type, rs_allocation_mipmap_control mipmap, uint32_t usages, void* ptr); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation(rs_type type, uint32_t usage); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_char4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_double4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_float4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_half4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_int4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_long4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_short4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uchar4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_uint4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ulong4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort2(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort2(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort2(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort3(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort3(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort3(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort4(uint32_t dimX); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort4(uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_allocation rsCreateAllocation_ushort4(uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 24
พารามิเตอร์
ประเภทประเภทของการจัดสรร
การใช้งานFlag การใช้งานสําหรับการจัดสรร
Mipmap
การใช้งาน
ptr
dimX
dimY
dimZ

สร้างออบเจ็กต์ rs_allocation ของประเภทและการใช้งานที่ระบุ

RS_ALLOCATION_USAGE_SCRIPT และ RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE เป็น Flag การใช้งานที่รองรับเพียง 2 รายการสําหรับ Allocation ที่สร้างขึ้นจากภายในสคริปต์ RenderScript

นอกจากนี้ คุณยังใช้ฟังก์ชัน Wrapper ของ rsCreateAllocation_ เพื่อสร้าง Allocation ของประเภทตัวเลขเชิงเดี่ยวและเวกเตอร์ได้โดยตรงโดยไม่ต้องสร้างออบเจ็กต์ rs_element หรือ rs_type ระดับกลาง

เช่น rsCreateAllocation_int4() จะแสดงผล Allocation ประเภทข้อมูล int4 ของมิติข้อมูลที่ระบุ

rsCreateElement : สร้างออบเจ็กต์ rs_element ของประเภทข้อมูลที่ระบุ

rs_element rsCreateElement(int32_t data_type, int32_t data_kind, bool isNormalized, uint32_t vecSize); เพิ่มใน API ระดับ 24
rs_element rsCreateElement(rs_data_type data_type); เพิ่มใน API ระดับ 24
พารามิเตอร์
data_typeประเภทข้อมูลขององค์ประกอบ
data_kind
isNormalized
vecSize

สร้างออบเจ็กต์ rs_element ของประเภทข้อมูลที่ระบุ ระบบจะตั้งค่าประเภทข้อมูลขององค์ประกอบเป็น RS_KIND_USER และตั้งค่า vector_width เป็น 1 ซึ่งบ่งบอกว่าไม่ใช่เวกเตอร์

rsCreatePixelElement : สร้างออบเจ็กต์ rs_element ของประเภทข้อมูลและประเภทข้อมูลตามที่ระบุ

rs_element rsCreatePixelElement(rs_data_type data_type, rs_data_kind data_kind); เพิ่มใน API ระดับ 24
พารามิเตอร์
data_typeประเภทข้อมูลขององค์ประกอบ
data_kindประเภทข้อมูลขององค์ประกอบ

สร้างออบเจ็กต์ rs_element ของประเภทข้อมูลและประเภทข้อมูลที่ระบุ ระบบจะตั้งค่า vector_width ขององค์ประกอบเป็น 1 ซึ่งบ่งบอกว่าไม่ใช่เวกเตอร์

rsCreateType : สร้างออบเจ็กต์ rs_type ที่มีแอตทริบิวต์องค์ประกอบและรูปร่างที่ระบุ

rs_type rsCreateType(rs_element element, uint32_t dimX); เพิ่มใน API ระดับ 24
rs_type rsCreateType(rs_element element, uint32_t dimX, uint32_t dimY); เพิ่มใน API ระดับ 24
rs_type rsCreateType(rs_element element, uint32_t dimX, uint32_t dimY, uint32_t dimZ); เพิ่มใน API ระดับ 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); เพิ่มใน API ระดับ 24
พารามิเตอร์
องค์ประกอบองค์ประกอบที่จะเชื่อมโยงกับประเภท
dimXขนาดตามมิติข้อมูล X
dimYขนาดตามมิติข้อมูล Y
dimZขนาดตามมิติข้อมูล Z
Mipmapการแจ้งที่ระบุว่าประเภทมีเชน mipmap หรือไม่
ใบหน้าการแจ้งที่ระบุว่าประเภทเป็น Cubemap หรือไม่
yuv_formatเลย์เอาต์ YUV สำหรับประเภท

สร้างออบเจ็กต์ rs_type ที่มีแอตทริบิวต์องค์ประกอบและรูปร่างที่ระบุ

dimX ระบุขนาดของมิติข้อมูล X

dimY หากมีและไม่ใช่ 0 แสดงว่ามิติข้อมูล Y มีอยู่และระบุขนาดของมิติข้อมูล

dimZ หากมีและไม่ใช่ 0 แสดงว่ามิติข้อมูล Z มีอยู่และระบุขนาดของมิติข้อมูล

มิpmap บ่งบอกถึงระดับรายละเอียด (LOD)

faces ระบุถึงจํานวนใบหน้าของภาพลูกบาศก์

yuv_format ระบุรูปแบบ YUV ที่เชื่อมโยง (หรือ RS_YUV_NONE)

rsCreateVectorElement : สร้างออบเจ็กต์ rs_element ของประเภทข้อมูลและเวกเตอร์ความกว้างที่ระบุ

rs_element rsCreateVectorElement(rs_data_type data_type, uint32_t vector_width); เพิ่มใน API ระดับ 24
พารามิเตอร์
data_typeประเภทข้อมูลขององค์ประกอบ
vector_widthความกว้างของเวกเตอร์ (2, 3 หรือ 4)

สร้างออบเจ็กต์ rs_element ของประเภทข้อมูลและเวกเตอร์ความกว้างที่ระบุ ค่าของ vector_width ต้องเท่ากับ 2, 3 หรือ 4 ระบบจะตั้งค่าประเภทข้อมูลของเอลิเมนต์เป็น RS_KIND_USER