Home | History | Annotate | Download | only in script_api
      1 #
      2 # Copyright (C) 2015 The Android Open Source Project
      3 #
      4 # Licensed under the Apache License, Version 2.0 (the "License");
      5 # you may not use this file except in compliance with the License.
      6 # You may obtain a copy of the License at
      7 #
      8 #      http://www.apache.org/licenses/LICENSE-2.0
      9 #
     10 # Unless required by applicable law or agreed to in writing, software
     11 # distributed under the License is distributed on an "AS IS" BASIS,
     12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13 # See the License for the specific language governing permissions and
     14 # limitations under the License.
     15 #
     16 
     17 header:
     18 summary: Allocation Creation Functions
     19 description:
     20  The functions below can be used to create Allocations from a Script.
     21 
     22  These functions can be called directly or indirectly from an invokable
     23  function.  If some control-flow path can result in a call to these functions
     24  from a RenderScript kernel function, a compiler error will be generated.
     25 end:
     26 
     27 function: rsCreateElement
     28 version: 24
     29 ret: rs_element
     30 arg: rs_data_type data_type, "Data type of the Element"
     31 summary: Creates an rs_element object of the specified data type
     32 description:
     33   Creates an rs_element object of the specified data type.  The data kind of
     34   the Element will be set to RS_KIND_USER and vector_width will be set to 1,
     35   indicating non-vector.
     36 test: none
     37 end:
     38 
     39 function: rsCreateVectorElement
     40 version: 24
     41 ret: rs_element
     42 arg: rs_data_type data_type, "Data type of the Element"
     43 arg: uint32_t vector_width, "Vector width (either 2, 3, or 4)"
     44 summary: Creates an rs_element object of the specified data type and vector width
     45 description:
     46   Creates an rs_element object of the specified data type and vector width.
     47   Value of vector_width must be 2, 3 or 4.  The data kind of the Element will
     48   be set to RS_KIND_USER.
     49 test: none
     50 end:
     51 
     52 function: rsCreatePixelElement
     53 version: 24
     54 ret: rs_element
     55 arg: rs_data_type data_type, "Data type of the Element"
     56 arg: rs_data_kind data_kind, "Data kind of the Element"
     57 summary: Creates an rs_element object of the specified data type and data kind
     58 description:
     59   Creates an rs_element object of the specified data type and data kind.  The
     60   vector_width of the Element will be set to 1, indicating non-vector.
     61 test: none
     62 end:
     63 
     64 function: rsCreateElement
     65 version: 24
     66 internal: true
     67 ret: rs_element
     68 arg: int32_t data_type
     69 arg: int32_t data_kind
     70 arg: bool isNormalized
     71 arg: uint32_t vecSize
     72 test: none
     73 end:
     74 
     75 function: rsCreateType
     76 version: 24
     77 ret: rs_type
     78 arg: rs_element element, "Element to be associated with the Type"
     79 arg: uint32_t dimX, "Size along the X dimension"
     80 arg: uint32_t dimY, "Size along the Y dimension"
     81 arg: uint32_t dimZ, "Size along the Z dimension"
     82 arg: bool mipmaps, "Flag indicating if the Type has a mipmap chain"
     83 arg: bool faces, "Flag indicating if the Type is a cubemap"
     84 arg: rs_yuv_format yuv_format, "YUV layout for the Type"
     85 summary: Creates an rs_type object with the specified Element and shape attributes
     86 description:
     87   Creates an rs_type object with the specified Element and shape attributes.
     88 
     89   dimX specifies the size of the X dimension.
     90 
     91   dimY, if present and non-zero, indicates that the Y dimension is present and
     92   indicates its size.
     93 
     94   dimZ, if present and non-zero, indicates that the Z dimension is present and
     95   indicates its size.
     96 
     97   mipmaps indicates the presence of level of detail (LOD).
     98 
     99   faces indicates the  presence of cubemap faces.
    100 
    101   yuv_format indicates the associated YUV format (or RS_YUV_NONE).
    102 test: none
    103 end:
    104 
    105 function: rsCreateType
    106 version: 24
    107 ret: rs_type
    108 arg: rs_element element
    109 arg: uint32_t dimX
    110 arg: uint32_t dimY
    111 arg: uint32_t dimZ
    112 test:none
    113 end:
    114 
    115 function: rsCreateType
    116 version: 24
    117 ret: rs_type
    118 arg: rs_element element
    119 arg: uint32_t dimX
    120 arg: uint32_t dimY
    121 test:none
    122 end:
    123 
    124 function: rsCreateType
    125 version: 24
    126 ret: rs_type
    127 arg: rs_element element
    128 arg: uint32_t dimX
    129 test:none
    130 end:
    131 
    132 function: rsCreateAllocation
    133 version: 24
    134 ret: rs_allocation
    135 arg: rs_type type, "Type of the Allocation"
    136 arg: uint32_t usage, "Usage flag for the allocation"
    137 summary: Create an rs_allocation object of given Type.
    138 description:
    139   Creates an rs_allocation object of the given Type and usage.
    140 
    141   RS_ALLOCATION_USAGE_SCRIPT and RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE are the
    142   only supported usage flags for Allocations created from within a RenderScript
    143   Script.
    144 
    145   You can also use rsCreateAllocation_<type><width> wrapper functions to directly
    146   create Allocations of scalar and vector numerical types without creating
    147   intermediate rs_element or rs_type objects.
    148 
    149   E.g. rsCreateAllocation_int4() returns an Allocation of int4 data type of
    150   specified dimensions.
    151 test: none
    152 end:
    153 
    154 function: rsCreateAllocation
    155 version: 24
    156 ret: rs_allocation
    157 arg: rs_type type
    158 test: none
    159 end:
    160 
    161 function: rsCreateAllocation
    162 version: 24
    163 internal: true
    164 ret: rs_allocation
    165 arg: rs_type type
    166 arg: rs_allocation_mipmap_control mipmap
    167 arg: uint32_t usages
    168 arg: void* ptr
    169 test: none
    170 end:
    171 
    172 function: rsCreateAllocation_#1
    173 version: 24
    174 t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
    175 ret: rs_allocation
    176 arg: uint32_t dimX
    177 arg: uint32_t dimY
    178 arg: uint32_t dimZ
    179 inline:
    180   rs_element e = rsCreateElement(RS_TYPE_#RST_1);
    181   rs_type t = rsCreateType(e, dimX, dimY, dimZ);
    182   return rsCreateAllocation(t);
    183 test: none
    184 end:
    185 
    186 function: rsCreateAllocation_#2#1
    187 version: 24
    188 w: 2, 3, 4
    189 t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
    190 ret: rs_allocation
    191 arg: uint32_t dimX
    192 arg: uint32_t dimY
    193 arg: uint32_t dimZ
    194 inline:
    195   rs_element e = rsCreateVectorElement(RS_TYPE_#RST_2, #1);
    196   rs_type t = rsCreateType(e, dimX, dimY, dimZ);
    197   return rsCreateAllocation(t);
    198 test: none
    199 end:
    200 
    201 function: rsCreateAllocation_#1
    202 version: 24
    203 t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
    204 ret: rs_allocation
    205 arg: uint32_t dimX
    206 arg: uint32_t dimY
    207 inline:
    208   rs_element e = rsCreateElement(RS_TYPE_#RST_1);
    209   rs_type t = rsCreateType(e, dimX, dimY);
    210   return rsCreateAllocation(t);
    211 test: none
    212 end:
    213 
    214 function: rsCreateAllocation_#2#1
    215 version: 24
    216 w: 2, 3, 4
    217 t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
    218 ret: rs_allocation
    219 arg: uint32_t dimX
    220 arg: uint32_t dimY
    221 inline:
    222   rs_element e = rsCreateVectorElement(RS_TYPE_#RST_2, #1);
    223   rs_type t = rsCreateType(e, dimX, dimY);
    224   return rsCreateAllocation(t);
    225 test: none
    226 end:
    227 
    228 function: rsCreateAllocation_#1
    229 version: 24
    230 t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
    231 ret: rs_allocation
    232 arg: uint32_t dimX
    233 inline:
    234   rs_element e = rsCreateElement(RS_TYPE_#RST_1);
    235   rs_type t = rsCreateType(e, dimX);
    236   return rsCreateAllocation(t);
    237 test: none
    238 end:
    239 
    240 function: rsCreateAllocation_#2#1
    241 version: 24
    242 w: 2, 3, 4
    243 t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
    244 ret: rs_allocation
    245 arg: uint32_t dimX
    246 inline:
    247   rs_element e = rsCreateVectorElement(RS_TYPE_#RST_2, #1);
    248   rs_type t = rsCreateType(e, dimX);
    249   return rsCreateAllocation(t);
    250 test: none
    251 end:
    252