xref: /aosp_15_r20/hardware/interfaces/renderscript/1.0/IContext.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2017 The Android Open Source Project
3*4d7e907cSAndroid Build Coastguard Worker *
4*4d7e907cSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
5*4d7e907cSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
6*4d7e907cSAndroid Build Coastguard Worker * You may obtain a copy of the License at
7*4d7e907cSAndroid Build Coastguard Worker *
8*4d7e907cSAndroid Build Coastguard Worker *      http://www.apache.org/licenses/LICENSE-2.0
9*4d7e907cSAndroid Build Coastguard Worker *
10*4d7e907cSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
11*4d7e907cSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
12*4d7e907cSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*4d7e907cSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
14*4d7e907cSAndroid Build Coastguard Worker * limitations under the License.
15*4d7e907cSAndroid Build Coastguard Worker */
16*4d7e907cSAndroid Build Coastguard Worker
17*4d7e907cSAndroid Build Coastguard Workerpackage [email protected];
18*4d7e907cSAndroid Build Coastguard Worker
19*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::types;
20*4d7e907cSAndroid Build Coastguard Worker
21*4d7e907cSAndroid Build Coastguard Worker// TODO: is there any way to keep this documentation in sync with the
22*4d7e907cSAndroid Build Coastguard Worker// corresponding Java doc?
23*4d7e907cSAndroid Build Coastguard Worker//
24*4d7e907cSAndroid Build Coastguard Worker// TODO: Some of the documentation was taken from Java docs, whereas others were
25*4d7e907cSAndroid Build Coastguard Worker// undocumented. Because of this, there's somewhat two different styles of
26*4d7e907cSAndroid Build Coastguard Worker// comments. Look into having a consistent convention.
27*4d7e907cSAndroid Build Coastguard Worker//
28*4d7e907cSAndroid Build Coastguard Worker// TODO: There was some confusion as to why some paramters use vec<> and others
29*4d7e907cSAndroid Build Coastguard Worker// use Ptr/Size. The convention is that vec<> is used whenever the paramter is
30*4d7e907cSAndroid Build Coastguard Worker// only an input parameter. HIDL is not supposed to include any output
31*4d7e907cSAndroid Build Coastguard Worker// parameters, so a more explicit Ptr/Size is used.
32*4d7e907cSAndroid Build Coastguard Worker
33*4d7e907cSAndroid Build Coastguard Workerinterface IContext {
34*4d7e907cSAndroid Build Coastguard Worker
35*4d7e907cSAndroid Build Coastguard Worker    /**
36*4d7e907cSAndroid Build Coastguard Worker     * TODO: Do we need to define "selectors"? It may be a property of the
37*4d7e907cSAndroid Build Coastguard Worker     * "adapted allocation" that's returned.
38*4d7e907cSAndroid Build Coastguard Worker     *
39*4d7e907cSAndroid Build Coastguard Worker     * Creates an arbitrary window into the base allocation. The type describes
40*4d7e907cSAndroid Build Coastguard Worker     * the shape of the window. Any dimensions present in the type must be
41*4d7e907cSAndroid Build Coastguard Worker     * equal to or smaller than the dimensions in the source allocation. A
42*4d7e907cSAndroid Build Coastguard Worker     * dimension present in the allocation that is not present in the type must
43*4d7e907cSAndroid Build Coastguard Worker     * be constrained away with the selectors. If a dimension is present in
44*4d7e907cSAndroid Build Coastguard Worker     * both the type and allocation, one of two things must happen. If the type
45*4d7e907cSAndroid Build Coastguard Worker     * is smaller than the allocation, a window must be created, the selected
46*4d7e907cSAndroid Build Coastguard Worker     * value in the adapter for that dimension must act as the base address,
47*4d7e907cSAndroid Build Coastguard Worker     * and the type must describe the size of the view starting at that point.
48*4d7e907cSAndroid Build Coastguard Worker     * If the type and allocation dimension are of the same size, then setting
49*4d7e907cSAndroid Build Coastguard Worker     * the selector for the dimension must be an error.
50*4d7e907cSAndroid Build Coastguard Worker     *
51*4d7e907cSAndroid Build Coastguard Worker     * @param type Type describing data layout
52*4d7e907cSAndroid Build Coastguard Worker     * @param baseAlloc Allocation
53*4d7e907cSAndroid Build Coastguard Worker     * @return subAlloc AllocationAdapter
54*4d7e907cSAndroid Build Coastguard Worker     */
55*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
56*4d7e907cSAndroid Build Coastguard Worker    allocationAdapterCreate(Type type, Allocation baseAlloc)
57*4d7e907cSAndroid Build Coastguard Worker                 generates (AllocationAdapter subAlloc);
58*4d7e907cSAndroid Build Coastguard Worker
59*4d7e907cSAndroid Build Coastguard Worker    /**
60*4d7e907cSAndroid Build Coastguard Worker     * TODO: Need to relate "offset" back to the terminology in
61*4d7e907cSAndroid Build Coastguard Worker     * allocationAdapterCreate() -- the latter uses the terms "selector" and
62*4d7e907cSAndroid Build Coastguard Worker     * "selected value". Can we use consistent terminology? Are "offset" and
63*4d7e907cSAndroid Build Coastguard Worker     * "selector" actually two different things?
64*4d7e907cSAndroid Build Coastguard Worker     *
65*4d7e907cSAndroid Build Coastguard Worker     * TODO: Explain the flattened layout in the offsets vec
66*4d7e907cSAndroid Build Coastguard Worker     *
67*4d7e907cSAndroid Build Coastguard Worker     * Sets the offsets for an Allocation Adapter.
68*4d7e907cSAndroid Build Coastguard Worker     *
69*4d7e907cSAndroid Build Coastguard Worker     * @param alloc AllocationAdapter
70*4d7e907cSAndroid Build Coastguard Worker     * @param offsets Collection of offsets
71*4d7e907cSAndroid Build Coastguard Worker     */
72*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
73*4d7e907cSAndroid Build Coastguard Worker    allocationAdapterOffset(AllocationAdapter alloc, vec<uint32_t> offsets);
74*4d7e907cSAndroid Build Coastguard Worker
75*4d7e907cSAndroid Build Coastguard Worker    /**
76*4d7e907cSAndroid Build Coastguard Worker     * TODO: add more explanation here.
77*4d7e907cSAndroid Build Coastguard Worker     *
78*4d7e907cSAndroid Build Coastguard Worker     * Returns the Type of the Allocation.
79*4d7e907cSAndroid Build Coastguard Worker     *
80*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation
81*4d7e907cSAndroid Build Coastguard Worker     * @return type Allocation's Type
82*4d7e907cSAndroid Build Coastguard Worker     */
83*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
84*4d7e907cSAndroid Build Coastguard Worker    allocationGetType(Allocation allocation) generates (Type type);
85*4d7e907cSAndroid Build Coastguard Worker
86*4d7e907cSAndroid Build Coastguard Worker    /**
87*4d7e907cSAndroid Build Coastguard Worker     * TODO: more clarification needed describing if the pointer can be aliased
88*4d7e907cSAndroid Build Coastguard Worker     * or if the data can outlive the allocation.
89*4d7e907cSAndroid Build Coastguard Worker     *
90*4d7e907cSAndroid Build Coastguard Worker     * Creates an Allocation for use by scripts with a given Type and a backing
91*4d7e907cSAndroid Build Coastguard Worker     * pointer. For use with ALLOCATION_USAGE_SHARED.
92*4d7e907cSAndroid Build Coastguard Worker     *
93*4d7e907cSAndroid Build Coastguard Worker     * @param type Type describing data layout
94*4d7e907cSAndroid Build Coastguard Worker     * @param mips AllocationMipmapControl specifies desired mipmap behavior for
95*4d7e907cSAndroid Build Coastguard Worker     *             the allocation
96*4d7e907cSAndroid Build Coastguard Worker     * @param usage Bit field specifying how the Allocation is utilized
97*4d7e907cSAndroid Build Coastguard Worker     * @param ptr Pointer to client-side data
98*4d7e907cSAndroid Build Coastguard Worker     * @return allocation Created Allocation
99*4d7e907cSAndroid Build Coastguard Worker     */
100*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
101*4d7e907cSAndroid Build Coastguard Worker    allocationCreateTyped(Type type, AllocationMipmapControl mips,
102*4d7e907cSAndroid Build Coastguard Worker                          bitfield<AllocationUsageType> usage, Ptr ptr)
103*4d7e907cSAndroid Build Coastguard Worker               generates (Allocation allocation);
104*4d7e907cSAndroid Build Coastguard Worker
105*4d7e907cSAndroid Build Coastguard Worker    /**
106*4d7e907cSAndroid Build Coastguard Worker     * Creates an Allocation from a Bitmap.
107*4d7e907cSAndroid Build Coastguard Worker     *
108*4d7e907cSAndroid Build Coastguard Worker     * @param type Type describing data layout
109*4d7e907cSAndroid Build Coastguard Worker     * @param mips AllocationMipmapControl specifies desired mipmap behavior for
110*4d7e907cSAndroid Build Coastguard Worker     *             the allocation
111*4d7e907cSAndroid Build Coastguard Worker     * @param bitmap Bitmap source for the allocation data
112*4d7e907cSAndroid Build Coastguard Worker     * @param usage Bit field specifying how the Allocation is utilized
113*4d7e907cSAndroid Build Coastguard Worker     * @return allocation Created Allocation containing bitmap data
114*4d7e907cSAndroid Build Coastguard Worker     */
115*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
116*4d7e907cSAndroid Build Coastguard Worker    allocationCreateFromBitmap(Type type, AllocationMipmapControl mips,
117*4d7e907cSAndroid Build Coastguard Worker                               vec<uint8_t> bitmap,
118*4d7e907cSAndroid Build Coastguard Worker                               bitfield<AllocationUsageType> usage)
119*4d7e907cSAndroid Build Coastguard Worker                    generates (Allocation allocation);
120*4d7e907cSAndroid Build Coastguard Worker
121*4d7e907cSAndroid Build Coastguard Worker    /**
122*4d7e907cSAndroid Build Coastguard Worker     * Creates a Cubemapped Allocation from a Bitmap.
123*4d7e907cSAndroid Build Coastguard Worker     *
124*4d7e907cSAndroid Build Coastguard Worker     * @param type Type describing data layout
125*4d7e907cSAndroid Build Coastguard Worker     * @param mips AllocationMipmapControl specifies desired mipmap behavior
126*4d7e907cSAndroid Build Coastguard Worker     *             for the allocation
127*4d7e907cSAndroid Build Coastguard Worker     * @param bitmap Bitmap with cubemap faces layed out in the following
128*4d7e907cSAndroid Build Coastguard Worker     *               format: right, left, top, bottom, front, back
129*4d7e907cSAndroid Build Coastguard Worker     * @param usage Bit field specifying how the Allocation is used
130*4d7e907cSAndroid Build Coastguard Worker     * @return allocation Created Allocation containing cubemap data
131*4d7e907cSAndroid Build Coastguard Worker     */
132*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
133*4d7e907cSAndroid Build Coastguard Worker    allocationCubeCreateFromBitmap(Type type, AllocationMipmapControl mips,
134*4d7e907cSAndroid Build Coastguard Worker                                   vec<uint8_t> bitmap,
135*4d7e907cSAndroid Build Coastguard Worker                                   bitfield<AllocationUsageType> usage)
136*4d7e907cSAndroid Build Coastguard Worker                        generates (Allocation allocation);
137*4d7e907cSAndroid Build Coastguard Worker
138*4d7e907cSAndroid Build Coastguard Worker    /**
139*4d7e907cSAndroid Build Coastguard Worker     * Returns the handle to a raw buffer that is being managed by the screen
140*4d7e907cSAndroid Build Coastguard Worker     * compositor. This operation is only valid for Allocations with
141*4d7e907cSAndroid Build Coastguard Worker     * USAGE_IO_INPUT.
142*4d7e907cSAndroid Build Coastguard Worker     *
143*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation
144*4d7e907cSAndroid Build Coastguard Worker     * @return nativeWindow NativeWindow object associated with allocation
145*4d7e907cSAndroid Build Coastguard Worker     */
146*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
147*4d7e907cSAndroid Build Coastguard Worker    allocationGetNativeWindow(Allocation allocation)
148*4d7e907cSAndroid Build Coastguard Worker                   generates (NativeWindow nativeWindow);
149*4d7e907cSAndroid Build Coastguard Worker
150*4d7e907cSAndroid Build Coastguard Worker    /**
151*4d7e907cSAndroid Build Coastguard Worker     * TODO: more clarification needed
152*4d7e907cSAndroid Build Coastguard Worker     *
153*4d7e907cSAndroid Build Coastguard Worker     * Sets the NativeWindow of an Allocation. This operation is only valid
154*4d7e907cSAndroid Build Coastguard Worker     * for Allocations with USAGE_IO_INPUT.
155*4d7e907cSAndroid Build Coastguard Worker     *
156*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be modified
157*4d7e907cSAndroid Build Coastguard Worker     * @pram nativeWindow NativeWindow to associate with allocation
158*4d7e907cSAndroid Build Coastguard Worker     */
159*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
160*4d7e907cSAndroid Build Coastguard Worker    allocationSetNativeWindow(Allocation allocation, NativeWindow nativewindow);
161*4d7e907cSAndroid Build Coastguard Worker
162*4d7e907cSAndroid Build Coastguard Worker    /**
163*4d7e907cSAndroid Build Coastguard Worker     * Initialize BufferQueue with specified max number of buffers.
164*4d7e907cSAndroid Build Coastguard Worker     *
165*4d7e907cSAndroid Build Coastguard Worker     * @param alloc Allocation
166*4d7e907cSAndroid Build Coastguard Worker     * @param numBuffer Maximum number of buffers
167*4d7e907cSAndroid Build Coastguard Worker     */
168*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
169*4d7e907cSAndroid Build Coastguard Worker    allocationSetupBufferQueue(Allocation alloc, uint32_t numBuffer);
170*4d7e907cSAndroid Build Coastguard Worker
171*4d7e907cSAndroid Build Coastguard Worker    /**
172*4d7e907cSAndroid Build Coastguard Worker     * TODO: clearly define baseAlloc vs subAlloc
173*4d7e907cSAndroid Build Coastguard Worker     *
174*4d7e907cSAndroid Build Coastguard Worker     * Shares the BufferQueue with another Allocation. Both must be
175*4d7e907cSAndroid Build Coastguard Worker     * USAGE_IO_INPUT Allocations.
176*4d7e907cSAndroid Build Coastguard Worker     *
177*4d7e907cSAndroid Build Coastguard Worker     * @param baseAlloc Base Allocation
178*4d7e907cSAndroid Build Coastguard Worker     * @param subAlloc Allocation to use the same buffer queue as the Base
179*4d7e907cSAndroid Build Coastguard Worker     *                 Allocation
180*4d7e907cSAndroid Build Coastguard Worker     */
181*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
182*4d7e907cSAndroid Build Coastguard Worker    allocationShareBufferQueue(Allocation baseAlloc, Allocation subAlloc);
183*4d7e907cSAndroid Build Coastguard Worker
184*4d7e907cSAndroid Build Coastguard Worker    /**
185*4d7e907cSAndroid Build Coastguard Worker     * Copies from the Allocation into a Bitmap. The bitmap must match the
186*4d7e907cSAndroid Build Coastguard Worker     * dimensions of the Allocation.
187*4d7e907cSAndroid Build Coastguard Worker     *
188*4d7e907cSAndroid Build Coastguard Worker     * HIDL is always running in Passthrough mode for RenderScript, so the
189*4d7e907cSAndroid Build Coastguard Worker     * buffer is modified directly by the driver.
190*4d7e907cSAndroid Build Coastguard Worker     *
191*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation
192*4d7e907cSAndroid Build Coastguard Worker     * @param data Buffer to be copied into
193*4d7e907cSAndroid Build Coastguard Worker     * @param sizeBytes Size of the buffer pointed to by "data"
194*4d7e907cSAndroid Build Coastguard Worker     */
195*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
196*4d7e907cSAndroid Build Coastguard Worker    allocationCopyToBitmap(Allocation allocation, Ptr data, Size sizeBytes);
197*4d7e907cSAndroid Build Coastguard Worker
198*4d7e907cSAndroid Build Coastguard Worker    /**
199*4d7e907cSAndroid Build Coastguard Worker     * TODO: should we consolidate all [123]DWrite functions or [123]DRead
200*4d7e907cSAndroid Build Coastguard Worker     * functions into the same API call? Our current plan is to be very similar
201*4d7e907cSAndroid Build Coastguard Worker     * to the dispatch table API. How much should we deviate from the original
202*4d7e907cSAndroid Build Coastguard Worker     * API?
203*4d7e907cSAndroid Build Coastguard Worker     * TODO: better description on Vec3/Vec4 and padding.
204*4d7e907cSAndroid Build Coastguard Worker     *
205*4d7e907cSAndroid Build Coastguard Worker     * Copies data into a 1D region of this Allocation.
206*4d7e907cSAndroid Build Coastguard Worker     *
207*4d7e907cSAndroid Build Coastguard Worker     * When this HAL entry is executed, all Vec3 elements have been explicitly
208*4d7e907cSAndroid Build Coastguard Worker     * padded as Vec4 elements.
209*4d7e907cSAndroid Build Coastguard Worker     *
210*4d7e907cSAndroid Build Coastguard Worker     * The size of the region is: count * Element's size.
211*4d7e907cSAndroid Build Coastguard Worker     *
212*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be modified
213*4d7e907cSAndroid Build Coastguard Worker     * @param offset The offset of the first element to be copied
214*4d7e907cSAndroid Build Coastguard Worker     * @param lod Selected mipmap level of detail
215*4d7e907cSAndroid Build Coastguard Worker     * @param count Number of elements to be copied
216*4d7e907cSAndroid Build Coastguard Worker     * @param data Source data to be copied to Allocation
217*4d7e907cSAndroid Build Coastguard Worker     */
218*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
219*4d7e907cSAndroid Build Coastguard Worker    allocation1DWrite(Allocation allocation, uint32_t offset, uint32_t lod,
220*4d7e907cSAndroid Build Coastguard Worker                      uint32_t count, vec<uint8_t> data);
221*4d7e907cSAndroid Build Coastguard Worker
222*4d7e907cSAndroid Build Coastguard Worker    /**
223*4d7e907cSAndroid Build Coastguard Worker     * Copies a value into a single sub-Element of this Allocation.
224*4d7e907cSAndroid Build Coastguard Worker     *
225*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be updated
226*4d7e907cSAndroid Build Coastguard Worker     * @param x X position of the first element in the Allocation to be updated
227*4d7e907cSAndroid Build Coastguard Worker     * @param y Y position of the first element in the Allocation to be
228*4d7e907cSAndroid Build Coastguard Worker     *          updated; for a 1D Allocation, this value must be 0
229*4d7e907cSAndroid Build Coastguard Worker     * @param z Z position of the first element in the Allocation to be
230*4d7e907cSAndroid Build Coastguard Worker     *          updated; for a 1D or 2D Allocation, this value must be 0
231*4d7e907cSAndroid Build Coastguard Worker     * @param lod Selected mipmap level of detail
232*4d7e907cSAndroid Build Coastguard Worker     * @param data Data to be copied from
233*4d7e907cSAndroid Build Coastguard Worker     * @param compIdx Component number to identify which sub-Element is updated
234*4d7e907cSAndroid Build Coastguard Worker     */
235*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
236*4d7e907cSAndroid Build Coastguard Worker    allocationElementWrite(Allocation allocation, uint32_t x, uint32_t y,
237*4d7e907cSAndroid Build Coastguard Worker                           uint32_t z, uint32_t lod, vec<uint8_t> data,
238*4d7e907cSAndroid Build Coastguard Worker                           Size compIdx);
239*4d7e907cSAndroid Build Coastguard Worker
240*4d7e907cSAndroid Build Coastguard Worker    /**
241*4d7e907cSAndroid Build Coastguard Worker     * Copies from an array into a rectangular region in this Allocation.
242*4d7e907cSAndroid Build Coastguard Worker     *
243*4d7e907cSAndroid Build Coastguard Worker     * When this HAL entry is executed, all Vec3 elements have been explicitly
244*4d7e907cSAndroid Build Coastguard Worker     * padded as Vec4 elements.
245*4d7e907cSAndroid Build Coastguard Worker     *
246*4d7e907cSAndroid Build Coastguard Worker     * The size of the region is: w * h * Element's size.
247*4d7e907cSAndroid Build Coastguard Worker     *
248*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be modified
249*4d7e907cSAndroid Build Coastguard Worker     * @param xoff X offset of the region to update in this Allocation
250*4d7e907cSAndroid Build Coastguard Worker     * @param yoff Y offset of the region to update in this Allocation
251*4d7e907cSAndroid Build Coastguard Worker     * @param lod Selected mipmap level of detail
252*4d7e907cSAndroid Build Coastguard Worker     * @param face AllocationCubemapFace
253*4d7e907cSAndroid Build Coastguard Worker     * @param w Width of the region to update
254*4d7e907cSAndroid Build Coastguard Worker     * @param h Height of the region to update
255*4d7e907cSAndroid Build Coastguard Worker     * @param data Data to be placed into the Allocation
256*4d7e907cSAndroid Build Coastguard Worker     * @param stride For 1D Allocation, the stride must be the number of bytes
257*4d7e907cSAndroid Build Coastguard Worker     *               of this Allocation. For 2D and 3D Allocations, the stride
258*4d7e907cSAndroid Build Coastguard Worker     *               must be the stride in X dimension measuring in bytes.
259*4d7e907cSAndroid Build Coastguard Worker     */
260*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
261*4d7e907cSAndroid Build Coastguard Worker    allocation2DWrite(Allocation allocation, uint32_t xoff, uint32_t yoff,
262*4d7e907cSAndroid Build Coastguard Worker                      uint32_t lod, AllocationCubemapFace face, uint32_t w,
263*4d7e907cSAndroid Build Coastguard Worker                      uint32_t h, vec<uint8_t> data, Size stride);
264*4d7e907cSAndroid Build Coastguard Worker
265*4d7e907cSAndroid Build Coastguard Worker    /**
266*4d7e907cSAndroid Build Coastguard Worker     * Copies from an array into a 3D region in this Allocation.
267*4d7e907cSAndroid Build Coastguard Worker     *
268*4d7e907cSAndroid Build Coastguard Worker     * When this HAL entry is executed, all Vec3 elements have been explicitly
269*4d7e907cSAndroid Build Coastguard Worker     * padded as Vec4 elements.
270*4d7e907cSAndroid Build Coastguard Worker     *
271*4d7e907cSAndroid Build Coastguard Worker     * The size of the region is: w * h * d * Element's size.
272*4d7e907cSAndroid Build Coastguard Worker     *
273*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be modified
274*4d7e907cSAndroid Build Coastguard Worker     * @param xoff X offset of the region to update in this Allocation
275*4d7e907cSAndroid Build Coastguard Worker     * @param yoff Y offset of the region to update in this Allocation
276*4d7e907cSAndroid Build Coastguard Worker     * @param zoff Z offset of the region to update in this Allocation
277*4d7e907cSAndroid Build Coastguard Worker     * @param lod Selected mipmap level of detail
278*4d7e907cSAndroid Build Coastguard Worker     * @param w Width of the region to update
279*4d7e907cSAndroid Build Coastguard Worker     * @param h Height of the region to update
280*4d7e907cSAndroid Build Coastguard Worker     * @param d Depth of the region to update
281*4d7e907cSAndroid Build Coastguard Worker     * @param data Data to be placed in the Allocation
282*4d7e907cSAndroid Build Coastguard Worker     * @param stride For 1D Allocation, the stride must be the number of bytes
283*4d7e907cSAndroid Build Coastguard Worker     *               of this Allocation. For 2D and 3D Allocations, the stride
284*4d7e907cSAndroid Build Coastguard Worker     *               must be the stride in X dimension measuring in bytes.
285*4d7e907cSAndroid Build Coastguard Worker     */
286*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
287*4d7e907cSAndroid Build Coastguard Worker    allocation3DWrite(Allocation allocation, uint32_t xoff, uint32_t yoff,
288*4d7e907cSAndroid Build Coastguard Worker                      uint32_t zoff, uint32_t lod, uint32_t w, uint32_t h,
289*4d7e907cSAndroid Build Coastguard Worker                      uint32_t d, vec<uint8_t> data, Size stride);
290*4d7e907cSAndroid Build Coastguard Worker
291*4d7e907cSAndroid Build Coastguard Worker    /**
292*4d7e907cSAndroid Build Coastguard Worker     * Generates a mipmap chain. This is only valid if the Type of the
293*4d7e907cSAndroid Build Coastguard Worker     * Allocation includes mipmaps.
294*4d7e907cSAndroid Build Coastguard Worker     *
295*4d7e907cSAndroid Build Coastguard Worker     * This function generates a complete set of mipmaps from the top level
296*4d7e907cSAndroid Build Coastguard Worker     * LOD.
297*4d7e907cSAndroid Build Coastguard Worker     *
298*4d7e907cSAndroid Build Coastguard Worker     * If the Allocation is also using other memory spaces, a call to
299*4d7e907cSAndroid Build Coastguard Worker     * allocationSyncAll(context, allocation, usage) is required.
300*4d7e907cSAndroid Build Coastguard Worker     *
301*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation which has its top LOD read and lower LOD
302*4d7e907cSAndroid Build Coastguard Worker     *                   written to
303*4d7e907cSAndroid Build Coastguard Worker     */
304*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
305*4d7e907cSAndroid Build Coastguard Worker    allocationGenerateMipmaps(Allocation allocation);
306*4d7e907cSAndroid Build Coastguard Worker
307*4d7e907cSAndroid Build Coastguard Worker    /**
308*4d7e907cSAndroid Build Coastguard Worker     * Copies all of an Allocation's data into an array.
309*4d7e907cSAndroid Build Coastguard Worker     *
310*4d7e907cSAndroid Build Coastguard Worker     * All Vec3 elements of an Allocation are padded to be Vec4, so the data
311*4d7e907cSAndroid Build Coastguard Worker     * returned by this function automatically includes padding.
312*4d7e907cSAndroid Build Coastguard Worker     *
313*4d7e907cSAndroid Build Coastguard Worker     * HIDL is always running in Passthrough mode for RenderScript, so the
314*4d7e907cSAndroid Build Coastguard Worker     * buffer is modified directly by the driver.
315*4d7e907cSAndroid Build Coastguard Worker     *
316*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be read
317*4d7e907cSAndroid Build Coastguard Worker     * @param data Buffer to be copied into
318*4d7e907cSAndroid Build Coastguard Worker     * @param sizeBytes Size of the buffer pointed to by "data"
319*4d7e907cSAndroid Build Coastguard Worker     */
320*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
321*4d7e907cSAndroid Build Coastguard Worker    allocationRead(Allocation allocation, Ptr data, Size sizeBytes);
322*4d7e907cSAndroid Build Coastguard Worker
323*4d7e907cSAndroid Build Coastguard Worker    /**
324*4d7e907cSAndroid Build Coastguard Worker     * Copies a 1D region of this Allocation into an array.
325*4d7e907cSAndroid Build Coastguard Worker     *
326*4d7e907cSAndroid Build Coastguard Worker     * All Vec3 elements of an Allocation are padded to be Vec4, so the data
327*4d7e907cSAndroid Build Coastguard Worker     * returned by this function automatically includes padding.
328*4d7e907cSAndroid Build Coastguard Worker     *
329*4d7e907cSAndroid Build Coastguard Worker     * The size of the region is: count * Element's size.
330*4d7e907cSAndroid Build Coastguard Worker     *
331*4d7e907cSAndroid Build Coastguard Worker     * HIDL is always running in Passthrough mode for RenderScript, so the
332*4d7e907cSAndroid Build Coastguard Worker     * buffer is modified directly by the driver.
333*4d7e907cSAndroid Build Coastguard Worker     *
334*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be read
335*4d7e907cSAndroid Build Coastguard Worker     * @param xoff X offset of the first element to be copied
336*4d7e907cSAndroid Build Coastguard Worker     * @param lod Mipmap level of detail
337*4d7e907cSAndroid Build Coastguard Worker     * @param count The number of elements to be copied
338*4d7e907cSAndroid Build Coastguard Worker     * @param data Buffer to be copied into
339*4d7e907cSAndroid Build Coastguard Worker     * @param sizeBytes Size of the buffer pointed to by "data"
340*4d7e907cSAndroid Build Coastguard Worker     */
341*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
342*4d7e907cSAndroid Build Coastguard Worker    allocation1DRead(Allocation allocation, uint32_t xoff, uint32_t lod,
343*4d7e907cSAndroid Build Coastguard Worker                     uint32_t count, Ptr data, Size sizeBytes);
344*4d7e907cSAndroid Build Coastguard Worker
345*4d7e907cSAndroid Build Coastguard Worker    /**
346*4d7e907cSAndroid Build Coastguard Worker     * Returns the value of a single sub-Element of this Allocation.
347*4d7e907cSAndroid Build Coastguard Worker     *
348*4d7e907cSAndroid Build Coastguard Worker     * HIDL is always running in Passthrough mode for RenderScript, so the
349*4d7e907cSAndroid Build Coastguard Worker     * buffer is modified directly by the driver.
350*4d7e907cSAndroid Build Coastguard Worker     *
351*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be read
352*4d7e907cSAndroid Build Coastguard Worker     * @param x X position of the first element in the Allocation to be read
353*4d7e907cSAndroid Build Coastguard Worker     * @param y Y position of the first element in the Allocation to be read
354*4d7e907cSAndroid Build Coastguard Worker     * @param z Z position of the first element in the Allocation to be read
355*4d7e907cSAndroid Build Coastguard Worker     * @param lod Mipmap level of detail
356*4d7e907cSAndroid Build Coastguard Worker     * @param data Buffer to be copied into
357*4d7e907cSAndroid Build Coastguard Worker     * @param sizeBytes Size of the buffer pointed to by "data"
358*4d7e907cSAndroid Build Coastguard Worker     * @param compIdx Component number to identify which sub-Element is updated
359*4d7e907cSAndroid Build Coastguard Worker     */
360*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
361*4d7e907cSAndroid Build Coastguard Worker    allocationElementRead(Allocation allocation, uint32_t x, uint32_t y,
362*4d7e907cSAndroid Build Coastguard Worker                          uint32_t z, uint32_t lod, Ptr data, Size sizeBytes,
363*4d7e907cSAndroid Build Coastguard Worker                          Size compIdx);
364*4d7e907cSAndroid Build Coastguard Worker
365*4d7e907cSAndroid Build Coastguard Worker    /**
366*4d7e907cSAndroid Build Coastguard Worker     * Copies from a rectangular region in this Allocation to an array.
367*4d7e907cSAndroid Build Coastguard Worker     *
368*4d7e907cSAndroid Build Coastguard Worker     * All Vec3 elements of an Allocation are padded to be Vec4, so the data
369*4d7e907cSAndroid Build Coastguard Worker     * returned by this function automatically includes padding.
370*4d7e907cSAndroid Build Coastguard Worker     *
371*4d7e907cSAndroid Build Coastguard Worker     * The size of the region is: w * h * Element's size.
372*4d7e907cSAndroid Build Coastguard Worker     *
373*4d7e907cSAndroid Build Coastguard Worker     * HIDL is always running in Passthrough mode for RenderScript, so the
374*4d7e907cSAndroid Build Coastguard Worker     * buffer is modified directly by the driver.
375*4d7e907cSAndroid Build Coastguard Worker     *
376*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be read
377*4d7e907cSAndroid Build Coastguard Worker     * @param xoff X offset of the region to copy in this array
378*4d7e907cSAndroid Build Coastguard Worker     * @param yoff Y offset of the region to copy in this array
379*4d7e907cSAndroid Build Coastguard Worker     * @param lod Mipmap level of detail
380*4d7e907cSAndroid Build Coastguard Worker     * @param face AllocationCubemapFace
381*4d7e907cSAndroid Build Coastguard Worker     * @param w Width of the region to copy
382*4d7e907cSAndroid Build Coastguard Worker     * @param h Height of the region to copy
383*4d7e907cSAndroid Build Coastguard Worker     * @param data Buffer to be copied into
384*4d7e907cSAndroid Build Coastguard Worker     * @param sizeBytes Size of the buffer pointed to by "data"
385*4d7e907cSAndroid Build Coastguard Worker     * @param stride For 1D Allocation, the stride must be the number of bytes
386*4d7e907cSAndroid Build Coastguard Worker     *               of this Allocation. For 2D and 3D Allocations, the stride
387*4d7e907cSAndroid Build Coastguard Worker     *               must be the stride in X dimension measuring in bytes.
388*4d7e907cSAndroid Build Coastguard Worker     */
389*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
390*4d7e907cSAndroid Build Coastguard Worker    allocation2DRead(Allocation allocation, uint32_t xoff, uint32_t yoff,
391*4d7e907cSAndroid Build Coastguard Worker                     uint32_t lod, AllocationCubemapFace face, uint32_t w,
392*4d7e907cSAndroid Build Coastguard Worker                     uint32_t h, Ptr data, Size sizeBytes, Size stride);
393*4d7e907cSAndroid Build Coastguard Worker
394*4d7e907cSAndroid Build Coastguard Worker    /**
395*4d7e907cSAndroid Build Coastguard Worker     * Copies from a rectangular cuboid region in this Allocation to an array.
396*4d7e907cSAndroid Build Coastguard Worker     *
397*4d7e907cSAndroid Build Coastguard Worker     * All Vec3 elements of an Allocation are padded to be Vec4, so the data
398*4d7e907cSAndroid Build Coastguard Worker     * returned by this function automatically includes padding.
399*4d7e907cSAndroid Build Coastguard Worker     *
400*4d7e907cSAndroid Build Coastguard Worker     * The size of the region is: w * h * d * Element's size.
401*4d7e907cSAndroid Build Coastguard Worker     *
402*4d7e907cSAndroid Build Coastguard Worker     * HIDL is always running in Passthrough mode for RenderScript, so the
403*4d7e907cSAndroid Build Coastguard Worker     * buffer is modified directly by the driver.
404*4d7e907cSAndroid Build Coastguard Worker     *
405*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be read
406*4d7e907cSAndroid Build Coastguard Worker     * @param xoff X offset of the region to copy in this array
407*4d7e907cSAndroid Build Coastguard Worker     * @param yoff Y offset of the region to copy in this array
408*4d7e907cSAndroid Build Coastguard Worker     * @param zoff Z offset of the region to copy in this array
409*4d7e907cSAndroid Build Coastguard Worker     * @param lod Mipmap level of detail
410*4d7e907cSAndroid Build Coastguard Worker     * @param w Width of the region to copy
411*4d7e907cSAndroid Build Coastguard Worker     * @param h Height of the region to copy
412*4d7e907cSAndroid Build Coastguard Worker     * @param d Depth of the region to copy
413*4d7e907cSAndroid Build Coastguard Worker     * @param data Buffer to be copied into
414*4d7e907cSAndroid Build Coastguard Worker     * @param sizeBytes Size of the buffer pointed to by "data"
415*4d7e907cSAndroid Build Coastguard Worker     * @param stride For 1D Allocation, the stride must be the number of bytes
416*4d7e907cSAndroid Build Coastguard Worker     *               of this Allocation. For 2D and 3D Allocations, the stride
417*4d7e907cSAndroid Build Coastguard Worker     *               must be the stride in X dimension measuring in bytes.
418*4d7e907cSAndroid Build Coastguard Worker     */
419*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
420*4d7e907cSAndroid Build Coastguard Worker    allocation3DRead(Allocation allocation, uint32_t xoff, uint32_t yoff,
421*4d7e907cSAndroid Build Coastguard Worker                     uint32_t zoff, uint32_t lod, uint32_t w, uint32_t h,
422*4d7e907cSAndroid Build Coastguard Worker                     uint32_t d, Ptr data, Size sizeBytes, Size stride);
423*4d7e907cSAndroid Build Coastguard Worker
424*4d7e907cSAndroid Build Coastguard Worker    /**
425*4d7e907cSAndroid Build Coastguard Worker     * Propagates changes from one usage of the Allocation to the other usages
426*4d7e907cSAndroid Build Coastguard Worker     * of the Allocation.
427*4d7e907cSAndroid Build Coastguard Worker     *
428*4d7e907cSAndroid Build Coastguard Worker     * @param allocation First usage of the Allocation
429*4d7e907cSAndroid Build Coastguard Worker     * @param usageType Allocation usage type
430*4d7e907cSAndroid Build Coastguard Worker     */
431*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
432*4d7e907cSAndroid Build Coastguard Worker    allocationSyncAll(Allocation allocation, AllocationUsageType usageType);
433*4d7e907cSAndroid Build Coastguard Worker
434*4d7e907cSAndroid Build Coastguard Worker    /**
435*4d7e907cSAndroid Build Coastguard Worker     * TODO: describe the functionality of resize1D better
436*4d7e907cSAndroid Build Coastguard Worker     * TODO: original Java Doc description seems to contradict itself ("with
437*4d7e907cSAndroid Build Coastguard Worker     * null contents and the region is otherwise undefined")
438*4d7e907cSAndroid Build Coastguard Worker     * TODO: should "new elements" be "new cells"?
439*4d7e907cSAndroid Build Coastguard Worker     * TODO: what does "objects are created" mean?
440*4d7e907cSAndroid Build Coastguard Worker     * TODO: what does "new dimension" mean? IS the type of the resized
441*4d7e907cSAndroid Build Coastguard Worker     * allocation different than the type before resizing?
442*4d7e907cSAndroid Build Coastguard Worker     *
443*4d7e907cSAndroid Build Coastguard Worker     * Resizes a 1D allocation. The contents of the allocation are preserved.
444*4d7e907cSAndroid Build Coastguard Worker     * If new elements are allocated, objects are created with null contents
445*4d7e907cSAndroid Build Coastguard Worker     * and the new region is otherwise undefined.
446*4d7e907cSAndroid Build Coastguard Worker     *
447*4d7e907cSAndroid Build Coastguard Worker     * If the new region is smaller, the references of any object outside the
448*4d7e907cSAndroid Build Coastguard Worker     * new region must be released.
449*4d7e907cSAndroid Build Coastguard Worker     *
450*4d7e907cSAndroid Build Coastguard Worker     * A new type must be created with the new dimension.
451*4d7e907cSAndroid Build Coastguard Worker     *
452*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be resized
453*4d7e907cSAndroid Build Coastguard Worker     * @param dimX New size along the x dimension of the Allocation
454*4d7e907cSAndroid Build Coastguard Worker     */
455*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
456*4d7e907cSAndroid Build Coastguard Worker    allocationResize1D(Allocation allocation, uint32_t dimX);
457*4d7e907cSAndroid Build Coastguard Worker
458*4d7e907cSAndroid Build Coastguard Worker    /**
459*4d7e907cSAndroid Build Coastguard Worker     * TODO: There are allocationCopy2DRange and 3DRange, but no 1DRange. Should
460*4d7e907cSAndroid Build Coastguard Worker     * the interface be cleaned up more?
461*4d7e907cSAndroid Build Coastguard Worker     *
462*4d7e907cSAndroid Build Coastguard Worker     * Copies a rectangular region from an Allocation into a rectangular region
463*4d7e907cSAndroid Build Coastguard Worker     * in this Allocation.
464*4d7e907cSAndroid Build Coastguard Worker     *
465*4d7e907cSAndroid Build Coastguard Worker     * @param dstAlloc Allocation to be updated
466*4d7e907cSAndroid Build Coastguard Worker     * @param dstXoff X offset of the region to update
467*4d7e907cSAndroid Build Coastguard Worker     * @param dstYoff Y offset of the region to update
468*4d7e907cSAndroid Build Coastguard Worker     * @param dstMip Selected mipmap level of the Allocation to update
469*4d7e907cSAndroid Build Coastguard Worker     * @param dstFace Destination AllocationCubemapFace
470*4d7e907cSAndroid Build Coastguard Worker     * @param width Width of the region to update
471*4d7e907cSAndroid Build Coastguard Worker     * @param height Height of the region to update
472*4d7e907cSAndroid Build Coastguard Worker     * @param srcAlloc Source Allocation, to be read
473*4d7e907cSAndroid Build Coastguard Worker     * @param srcXoff X offset of the region in the source Allocation
474*4d7e907cSAndroid Build Coastguard Worker     * @param srcYoff Y offset of the region in the source Allocation
475*4d7e907cSAndroid Build Coastguard Worker     * @param srcMip Selected mipmap level of the source Allocation
476*4d7e907cSAndroid Build Coastguard Worker     * @param srcFace Source AllocationCubemapFace
477*4d7e907cSAndroid Build Coastguard Worker     */
478*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
479*4d7e907cSAndroid Build Coastguard Worker    allocationCopy2DRange(Allocation dstAlloc, uint32_t dstXoff,
480*4d7e907cSAndroid Build Coastguard Worker                          uint32_t dstYoff, uint32_t dstMip,
481*4d7e907cSAndroid Build Coastguard Worker                          AllocationCubemapFace dstFace, uint32_t width,
482*4d7e907cSAndroid Build Coastguard Worker                          uint32_t height, Allocation srcAlloc,
483*4d7e907cSAndroid Build Coastguard Worker                          uint32_t srcXoff, uint32_t srcYoff, uint32_t srcMip,
484*4d7e907cSAndroid Build Coastguard Worker                          AllocationCubemapFace srcFace);
485*4d7e907cSAndroid Build Coastguard Worker
486*4d7e907cSAndroid Build Coastguard Worker    /**
487*4d7e907cSAndroid Build Coastguard Worker     * Copies a rectangular cuboid region into the allocation from another
488*4d7e907cSAndroid Build Coastguard Worker     * Allocation.
489*4d7e907cSAndroid Build Coastguard Worker     *
490*4d7e907cSAndroid Build Coastguard Worker     * @param dstAlloc Allocation to be updated
491*4d7e907cSAndroid Build Coastguard Worker     * @param dstXoff X offset of the region to update
492*4d7e907cSAndroid Build Coastguard Worker     * @param dstYoff Y offset of the region to update
493*4d7e907cSAndroid Build Coastguard Worker     * @param dstZoff Z offset of the region to update
494*4d7e907cSAndroid Build Coastguard Worker     * @param dstMip Selected mipmap level of the Allocation to update
495*4d7e907cSAndroid Build Coastguard Worker     * @param width Width of the region to update
496*4d7e907cSAndroid Build Coastguard Worker     * @param height Height of the region to update
497*4d7e907cSAndroid Build Coastguard Worker     * @param depth Depth of the region to update
498*4d7e907cSAndroid Build Coastguard Worker     * @param srcAlloc Source Allocation, to be read
499*4d7e907cSAndroid Build Coastguard Worker     * @param srcXoff Source X offset of the region in the source Allocation
500*4d7e907cSAndroid Build Coastguard Worker     * @param srcYoff Source Y offset of the region in the source Allocation
501*4d7e907cSAndroid Build Coastguard Worker     * @param srcZoff Source Z offset of the region in the souce Allocation
502*4d7e907cSAndroid Build Coastguard Worker     * @param srcMip Selected mipmap level of the Allocation to read
503*4d7e907cSAndroid Build Coastguard Worker     */
504*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
505*4d7e907cSAndroid Build Coastguard Worker    allocationCopy3DRange(Allocation dstAlloc, uint32_t dstXoff,
506*4d7e907cSAndroid Build Coastguard Worker                          uint32_t dstYoff, uint32_t dstZoff, uint32_t dstMip,
507*4d7e907cSAndroid Build Coastguard Worker                          uint32_t width, uint32_t height, uint32_t depth,
508*4d7e907cSAndroid Build Coastguard Worker                          Allocation srcAlloc, uint32_t srcXoff,
509*4d7e907cSAndroid Build Coastguard Worker                          uint32_t srcYoff, uint32_t srcZoff, uint32_t srcMip);
510*4d7e907cSAndroid Build Coastguard Worker
511*4d7e907cSAndroid Build Coastguard Worker    /**
512*4d7e907cSAndroid Build Coastguard Worker     * TODO: define buffer and output stream
513*4d7e907cSAndroid Build Coastguard Worker     *
514*4d7e907cSAndroid Build Coastguard Worker     * Sends a buffer to the output stream. The contents of the Allocation may
515*4d7e907cSAndroid Build Coastguard Worker     * be undefined after this operation. This operation is only valid if
516*4d7e907cSAndroid Build Coastguard Worker     * USAGE_IO_OUTPUT is set on the Allocation.
517*4d7e907cSAndroid Build Coastguard Worker     *
518*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be sent
519*4d7e907cSAndroid Build Coastguard Worker     */
520*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
521*4d7e907cSAndroid Build Coastguard Worker    allocationIoSend(Allocation allocation);
522*4d7e907cSAndroid Build Coastguard Worker
523*4d7e907cSAndroid Build Coastguard Worker    /**
524*4d7e907cSAndroid Build Coastguard Worker     * Receives the latest input into the Allocation. This operation is only
525*4d7e907cSAndroid Build Coastguard Worker     * valid if USAGE_IO_INPUT is set on the Allocation, otherwise an error
526*4d7e907cSAndroid Build Coastguard Worker     * must be reported and no operations may be executed.
527*4d7e907cSAndroid Build Coastguard Worker     *
528*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be updated
529*4d7e907cSAndroid Build Coastguard Worker     */
530*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
531*4d7e907cSAndroid Build Coastguard Worker    allocationIoReceive(Allocation allocation);
532*4d7e907cSAndroid Build Coastguard Worker
533*4d7e907cSAndroid Build Coastguard Worker    /**
534*4d7e907cSAndroid Build Coastguard Worker     * TODO: describe default values for lod, face, and z better.
535*4d7e907cSAndroid Build Coastguard Worker     * TODO: what cases can invalidate the pointer? Resize? It should be
536*4d7e907cSAndroid Build Coastguard Worker     * clarified that this method should always return a valid pointer, but the
537*4d7e907cSAndroid Build Coastguard Worker     * returned pointer might become invalid later.
538*4d7e907cSAndroid Build Coastguard Worker     *
539*4d7e907cSAndroid Build Coastguard Worker     * Retrieves the pointer to the actual data an Allocation contains as well
540*4d7e907cSAndroid Build Coastguard Worker     * as the data's stride.
541*4d7e907cSAndroid Build Coastguard Worker     *
542*4d7e907cSAndroid Build Coastguard Worker     * If Allocation lacks the corresponding dimension for lod, face, or z, an
543*4d7e907cSAndroid Build Coastguard Worker     * error message must be sent to the message queue and nullptr must be
544*4d7e907cSAndroid Build Coastguard Worker     * returned for dataPtr and 0 for stride. All missing values must be 0 or
545*4d7e907cSAndroid Build Coastguard Worker     * NONE in the corresponding enum.
546*4d7e907cSAndroid Build Coastguard Worker     *
547*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation
548*4d7e907cSAndroid Build Coastguard Worker     * @param lod Mipmap level of detail
549*4d7e907cSAndroid Build Coastguard Worker     * @param face AllocationCubemapFace
550*4d7e907cSAndroid Build Coastguard Worker     * @param z Z position
551*4d7e907cSAndroid Build Coastguard Worker     * @return pointer Pointer to the server-side data; if this points to an
552*4d7e907cSAndroid Build Coastguard Worker     *                 invalid location in memory (because the buffer was
553*4d7e907cSAndroid Build Coastguard Worker     *                 freed), this may result in undefined behavior
554*4d7e907cSAndroid Build Coastguard Worker     * @return stride For 1D Allocation, the stride must be the number of bytes
555*4d7e907cSAndroid Build Coastguard Worker     *                of this Allocation. For 2D and 3D Allocations, the stride
556*4d7e907cSAndroid Build Coastguard Worker     *                must be the stride in X dimension measuring in bytes.
557*4d7e907cSAndroid Build Coastguard Worker     */
558*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
559*4d7e907cSAndroid Build Coastguard Worker    allocationGetPointer(Allocation allocation, uint32_t lod,
560*4d7e907cSAndroid Build Coastguard Worker                         AllocationCubemapFace face, uint32_t z)
561*4d7e907cSAndroid Build Coastguard Worker              generates (Ptr dataPtr, Size stride);
562*4d7e907cSAndroid Build Coastguard Worker
563*4d7e907cSAndroid Build Coastguard Worker    /**
564*4d7e907cSAndroid Build Coastguard Worker     * Retrieves an Element's metadata from native code.
565*4d7e907cSAndroid Build Coastguard Worker     *
566*4d7e907cSAndroid Build Coastguard Worker     * @param element Element to be read
567*4d7e907cSAndroid Build Coastguard Worker     * @return elemData Element data
568*4d7e907cSAndroid Build Coastguard Worker     */
569*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
570*4d7e907cSAndroid Build Coastguard Worker    elementGetNativeMetadata(Element element)
571*4d7e907cSAndroid Build Coastguard Worker                  generates (vec<uint32_t> elemData);
572*4d7e907cSAndroid Build Coastguard Worker
573*4d7e907cSAndroid Build Coastguard Worker    /**
574*4d7e907cSAndroid Build Coastguard Worker     * TODO: define Sub-Element handles better.
575*4d7e907cSAndroid Build Coastguard Worker     *
576*4d7e907cSAndroid Build Coastguard Worker     * Retrieves an Element's sub Elements, specifically their identifiers,
577*4d7e907cSAndroid Build Coastguard Worker     * names, and sizes.
578*4d7e907cSAndroid Build Coastguard Worker     *
579*4d7e907cSAndroid Build Coastguard Worker     * @param element Element to be read
580*4d7e907cSAndroid Build Coastguard Worker     * @param numSubElem Number of sub-Elements
581*4d7e907cSAndroid Build Coastguard Worker     * @return ids Sub-Element handles
582*4d7e907cSAndroid Build Coastguard Worker     * @return names Sub-Element Names
583*4d7e907cSAndroid Build Coastguard Worker     * @return arraySizes Sizes of sub-Element arrays
584*4d7e907cSAndroid Build Coastguard Worker     */
585*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
586*4d7e907cSAndroid Build Coastguard Worker    elementGetSubElements(Element element, Size numSubElem)
587*4d7e907cSAndroid Build Coastguard Worker               generates (vec<Element> ids, vec<string> names,
588*4d7e907cSAndroid Build Coastguard Worker                          vec<Size> arraySizes);
589*4d7e907cSAndroid Build Coastguard Worker
590*4d7e907cSAndroid Build Coastguard Worker    /**
591*4d7e907cSAndroid Build Coastguard Worker     * TODO: can normalization flag be removed?
592*4d7e907cSAndroid Build Coastguard Worker     *
593*4d7e907cSAndroid Build Coastguard Worker     * Creates an Element.
594*4d7e907cSAndroid Build Coastguard Worker     *
595*4d7e907cSAndroid Build Coastguard Worker     * @param dt Data type
596*4d7e907cSAndroid Build Coastguard Worker     * @param dk Data kind
597*4d7e907cSAndroid Build Coastguard Worker     * @param norm Flag for normalization
598*4d7e907cSAndroid Build Coastguard Worker     * @param size Vector length, with scalar = 1
599*4d7e907cSAndroid Build Coastguard Worker     * @return element Created Element
600*4d7e907cSAndroid Build Coastguard Worker     */
601*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
602*4d7e907cSAndroid Build Coastguard Worker    elementCreate(DataType dt, DataKind dk, bool norm, uint32_t size)
603*4d7e907cSAndroid Build Coastguard Worker       generates (Element element);
604*4d7e907cSAndroid Build Coastguard Worker
605*4d7e907cSAndroid Build Coastguard Worker    /**
606*4d7e907cSAndroid Build Coastguard Worker     * Creates a complex Element.
607*4d7e907cSAndroid Build Coastguard Worker     *
608*4d7e907cSAndroid Build Coastguard Worker     * @param einsPtr Container of input Elements
609*4d7e907cSAndroid Build Coastguard Worker     * @param namesPtr Container of input names
610*4d7e907cSAndroid Build Coastguard Worker     * @param arraySizesPtr Container of array sizes
611*4d7e907cSAndroid Build Coastguard Worker     * @return element Created Element
612*4d7e907cSAndroid Build Coastguard Worker     */
613*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
614*4d7e907cSAndroid Build Coastguard Worker    elementComplexCreate(vec<Element> einsPtr, vec<string> names,
615*4d7e907cSAndroid Build Coastguard Worker                         vec<Size> arraySizesPtr)
616*4d7e907cSAndroid Build Coastguard Worker              generates (Element element);
617*4d7e907cSAndroid Build Coastguard Worker
618*4d7e907cSAndroid Build Coastguard Worker    /**
619*4d7e907cSAndroid Build Coastguard Worker     * Retrives a Type's metadata from native code.
620*4d7e907cSAndroid Build Coastguard Worker     *
621*4d7e907cSAndroid Build Coastguard Worker     * @param type Type describing data layout
622*4d7e907cSAndroid Build Coastguard Worker     * @return metadata Type's native metadata
623*4d7e907cSAndroid Build Coastguard Worker     */
624*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
625*4d7e907cSAndroid Build Coastguard Worker    typeGetNativeMetadata(Type type) generates (vec<OpaqueHandle> metadata);
626*4d7e907cSAndroid Build Coastguard Worker
627*4d7e907cSAndroid Build Coastguard Worker    /**
628*4d7e907cSAndroid Build Coastguard Worker     * Creates a new Type.
629*4d7e907cSAndroid Build Coastguard Worker     *
630*4d7e907cSAndroid Build Coastguard Worker     * If Type is 1D, Y and Z must be 0. If Type is 2D, Z must be 0.
631*4d7e907cSAndroid Build Coastguard Worker     *
632*4d7e907cSAndroid Build Coastguard Worker     * @param element Element of the Type
633*4d7e907cSAndroid Build Coastguard Worker     * @param dimX X dimension
634*4d7e907cSAndroid Build Coastguard Worker     * @param dimY Y dimension
635*4d7e907cSAndroid Build Coastguard Worker     * @param dimZ Z dimension
636*4d7e907cSAndroid Build Coastguard Worker     * @param mipmaps Flag indicating whether Type has mipmaps
637*4d7e907cSAndroid Build Coastguard Worker     * @param faces Flag indicating whether Type has faces
638*4d7e907cSAndroid Build Coastguard Worker     * @param yuv Enumeration specifying which type of YUV format, if any, Type
639*4d7e907cSAndroid Build Coastguard Worker     *            uses
640*4d7e907cSAndroid Build Coastguard Worker     * @return type Created Type
641*4d7e907cSAndroid Build Coastguard Worker     */
642*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
643*4d7e907cSAndroid Build Coastguard Worker    typeCreate(Element element, uint32_t dimX, uint32_t dimY, uint32_t dimZ,
644*4d7e907cSAndroid Build Coastguard Worker               bool mipmaps, bool faces, YuvFormat yuv)
645*4d7e907cSAndroid Build Coastguard Worker    generates (Type type);
646*4d7e907cSAndroid Build Coastguard Worker
647*4d7e907cSAndroid Build Coastguard Worker    /**
648*4d7e907cSAndroid Build Coastguard Worker     * Destroys provided RenderScript context, including all objects created in
649*4d7e907cSAndroid Build Coastguard Worker     * this context.
650*4d7e907cSAndroid Build Coastguard Worker     */
651*4d7e907cSAndroid Build Coastguard Worker    @exit
652*4d7e907cSAndroid Build Coastguard Worker    contextDestroy();
653*4d7e907cSAndroid Build Coastguard Worker
654*4d7e907cSAndroid Build Coastguard Worker    /**
655*4d7e907cSAndroid Build Coastguard Worker     * TODO: provide overview of messaging model and figure out if this should
656*4d7e907cSAndroid Build Coastguard Worker     * be part of HAL or not.
657*4d7e907cSAndroid Build Coastguard Worker     * TODO: what is the "client" for purposes of this interface?
658*4d7e907cSAndroid Build Coastguard Worker     * TODO: consider using send/receive to be more similar to other calls
659*4d7e907cSAndroid Build Coastguard Worker     * TODO: define the purpose of size more
660*4d7e907cSAndroid Build Coastguard Worker     *
661*4d7e907cSAndroid Build Coastguard Worker     * Fills the provided buffer with message data. "size" should be at least
662*4d7e907cSAndroid Build Coastguard Worker     * as large as the message size. Returns the MessageType and size of the
663*4d7e907cSAndroid Build Coastguard Worker     * message are returned.
664*4d7e907cSAndroid Build Coastguard Worker     *
665*4d7e907cSAndroid Build Coastguard Worker     * @param data A pointer to a buffer to be filled with a message
666*4d7e907cSAndroid Build Coastguard Worker     * @param size Size in bytes of the buffer pointed to by "data"
667*4d7e907cSAndroid Build Coastguard Worker     * @return messageType Type of message sent to the client
668*4d7e907cSAndroid Build Coastguard Worker     * @return receiveLen Length of the message in bytes
669*4d7e907cSAndroid Build Coastguard Worker     */
670*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
671*4d7e907cSAndroid Build Coastguard Worker    contextGetMessage(Ptr data, Size size)
672*4d7e907cSAndroid Build Coastguard Worker           generates (MessageToClientType messageType, Size receiveLen);
673*4d7e907cSAndroid Build Coastguard Worker
674*4d7e907cSAndroid Build Coastguard Worker    /**
675*4d7e907cSAndroid Build Coastguard Worker     * TODO: define subID better.
676*4d7e907cSAndroid Build Coastguard Worker     *
677*4d7e907cSAndroid Build Coastguard Worker     * Gets the metadata of a message to ensure entire message can be properly
678*4d7e907cSAndroid Build Coastguard Worker     * received. Can be used to determine size of data to allocate when calling
679*4d7e907cSAndroid Build Coastguard Worker     * contextGetMessage.
680*4d7e907cSAndroid Build Coastguard Worker     *
681*4d7e907cSAndroid Build Coastguard Worker     * @return messageType Type of message sent to the client
682*4d7e907cSAndroid Build Coastguard Worker     * @return receiveLen Length of message
683*4d7e907cSAndroid Build Coastguard Worker     * @return subID Message sub identifier
684*4d7e907cSAndroid Build Coastguard Worker     */
685*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
686*4d7e907cSAndroid Build Coastguard Worker    contextPeekMessage()
687*4d7e907cSAndroid Build Coastguard Worker            generates (MessageToClientType messageType, Size receiveLen,
688*4d7e907cSAndroid Build Coastguard Worker                       uint32_t subID);
689*4d7e907cSAndroid Build Coastguard Worker
690*4d7e907cSAndroid Build Coastguard Worker    /**
691*4d7e907cSAndroid Build Coastguard Worker     * TODO: Define "previous commands" better
692*4d7e907cSAndroid Build Coastguard Worker     * TODO: Is the message identifier the same as subID?
693*4d7e907cSAndroid Build Coastguard Worker     *
694*4d7e907cSAndroid Build Coastguard Worker     * Places a message into the message queue to be sent back to the message
695*4d7e907cSAndroid Build Coastguard Worker     * handler once all previous commands have been executed. The message data
696*4d7e907cSAndroid Build Coastguard Worker     * is copied into the queue and can be discarded by the client after this
697*4d7e907cSAndroid Build Coastguard Worker     * call.
698*4d7e907cSAndroid Build Coastguard Worker     *
699*4d7e907cSAndroid Build Coastguard Worker     * @param id Message identifier
700*4d7e907cSAndroid Build Coastguard Worker     * @param data Message data
701*4d7e907cSAndroid Build Coastguard Worker     */
702*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
703*4d7e907cSAndroid Build Coastguard Worker    contextSendMessage(uint32_t id, vec<uint8_t> data);
704*4d7e907cSAndroid Build Coastguard Worker
705*4d7e907cSAndroid Build Coastguard Worker    /**
706*4d7e907cSAndroid Build Coastguard Worker     * TODO: Can this be done automatically as part of context creation? What
707*4d7e907cSAndroid Build Coastguard Worker     * happens if we perform message operations before doing this?
708*4d7e907cSAndroid Build Coastguard Worker     *
709*4d7e907cSAndroid Build Coastguard Worker     * Initializes the messaging thread, so that the front-end API can receive
710*4d7e907cSAndroid Build Coastguard Worker     * messages from the driver. This call also waits for the messaging FIFO to
711*4d7e907cSAndroid Build Coastguard Worker     * start up.
712*4d7e907cSAndroid Build Coastguard Worker     */
713*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
714*4d7e907cSAndroid Build Coastguard Worker    contextInitToClient();
715*4d7e907cSAndroid Build Coastguard Worker
716*4d7e907cSAndroid Build Coastguard Worker    /**
717*4d7e907cSAndroid Build Coastguard Worker     * TODO: Why doesn't this happen automatically as part of context
718*4d7e907cSAndroid Build Coastguard Worker     * destruction? What happens if the FIFO is not empty?
719*4d7e907cSAndroid Build Coastguard Worker     *
720*4d7e907cSAndroid Build Coastguard Worker     * Deinitializes a the messaging thread. Shuts down the FIFO.
721*4d7e907cSAndroid Build Coastguard Worker     */
722*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
723*4d7e907cSAndroid Build Coastguard Worker    contextDeinitToClient();
724*4d7e907cSAndroid Build Coastguard Worker
725*4d7e907cSAndroid Build Coastguard Worker    /**
726*4d7e907cSAndroid Build Coastguard Worker     * TODO: do we need to mark asynchronous operations in this interface
727*4d7e907cSAndroid Build Coastguard Worker     * definition?
728*4d7e907cSAndroid Build Coastguard Worker     *
729*4d7e907cSAndroid Build Coastguard Worker     * Waits for any pending asynchronous operations (such as copies to a RS
730*4d7e907cSAndroid Build Coastguard Worker     * allocation or RS script executions) to complete.
731*4d7e907cSAndroid Build Coastguard Worker     */
732*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
733*4d7e907cSAndroid Build Coastguard Worker    contextFinish();
734*4d7e907cSAndroid Build Coastguard Worker
735*4d7e907cSAndroid Build Coastguard Worker    /**
736*4d7e907cSAndroid Build Coastguard Worker     * Prints the currently available debugging information about the state of
737*4d7e907cSAndroid Build Coastguard Worker     * the RS context to the logcat.
738*4d7e907cSAndroid Build Coastguard Worker     */
739*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
740*4d7e907cSAndroid Build Coastguard Worker    contextLog();
741*4d7e907cSAndroid Build Coastguard Worker
742*4d7e907cSAndroid Build Coastguard Worker    /**
743*4d7e907cSAndroid Build Coastguard Worker     * TODO: full path? relative path? Investigate further.
744*4d7e907cSAndroid Build Coastguard Worker     *
745*4d7e907cSAndroid Build Coastguard Worker     * Sets the cache directory of the context.
746*4d7e907cSAndroid Build Coastguard Worker     *
747*4d7e907cSAndroid Build Coastguard Worker     * @param cacheDir Name of the application's cache directory
748*4d7e907cSAndroid Build Coastguard Worker     */
749*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
750*4d7e907cSAndroid Build Coastguard Worker    contextSetCacheDir(string cacheDir);
751*4d7e907cSAndroid Build Coastguard Worker
752*4d7e907cSAndroid Build Coastguard Worker    /**
753*4d7e907cSAndroid Build Coastguard Worker     * TODO: does this apply to the GPU as well?
754*4d7e907cSAndroid Build Coastguard Worker     *
755*4d7e907cSAndroid Build Coastguard Worker     * Changes the priority of the cpu worker threads for this context.
756*4d7e907cSAndroid Build Coastguard Worker     *
757*4d7e907cSAndroid Build Coastguard Worker     * @param priority Priority of the thread
758*4d7e907cSAndroid Build Coastguard Worker     */
759*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
760*4d7e907cSAndroid Build Coastguard Worker    contextSetPriority(ThreadPriorities priority);
761*4d7e907cSAndroid Build Coastguard Worker
762*4d7e907cSAndroid Build Coastguard Worker    /**
763*4d7e907cSAndroid Build Coastguard Worker     * TODO: does this need to be part of the HAL? What if the object already
764*4d7e907cSAndroid Build Coastguard Worker     * has a name?
765*4d7e907cSAndroid Build Coastguard Worker     *
766*4d7e907cSAndroid Build Coastguard Worker     * Assigns a name to a base object.
767*4d7e907cSAndroid Build Coastguard Worker     *
768*4d7e907cSAndroid Build Coastguard Worker     * @param obj Object to be named
769*4d7e907cSAndroid Build Coastguard Worker     * @param name Assigned name
770*4d7e907cSAndroid Build Coastguard Worker     */
771*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
772*4d7e907cSAndroid Build Coastguard Worker    assignName(ObjectBase obj, string name);
773*4d7e907cSAndroid Build Coastguard Worker
774*4d7e907cSAndroid Build Coastguard Worker    /**
775*4d7e907cSAndroid Build Coastguard Worker     * TODO: what if the object has no name?
776*4d7e907cSAndroid Build Coastguard Worker     *
777*4d7e907cSAndroid Build Coastguard Worker     * Returns the name of an object.
778*4d7e907cSAndroid Build Coastguard Worker     *
779*4d7e907cSAndroid Build Coastguard Worker     * @param obj Object to be read
780*4d7e907cSAndroid Build Coastguard Worker     * @return name Name of the object
781*4d7e907cSAndroid Build Coastguard Worker     */
782*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
783*4d7e907cSAndroid Build Coastguard Worker    getName(ObjectBase obj) generates (string name);
784*4d7e907cSAndroid Build Coastguard Worker
785*4d7e907cSAndroid Build Coastguard Worker    /**
786*4d7e907cSAndroid Build Coastguard Worker     * TODO: starting here we have a set of interfaces for use with
787*4d7e907cSAndroid Build Coastguard Worker     * ScriptGroups. At the very least we should indicate for each one that's
788*4d7e907cSAndroid Build Coastguard Worker     * what it's for. Should we include ScriptGroup in the interface names?
789*4d7e907cSAndroid Build Coastguard Worker     * TODO: sweep whole file and remove prefix "v" from all parameter names
790*4d7e907cSAndroid Build Coastguard Worker     * TODO: there are some places where we use Size for size, and others where
791*4d7e907cSAndroid Build Coastguard Worker     * we use int32_t. Is there a reason it's int32_t? In some cases, it
792*4d7e907cSAndroid Build Coastguard Worker     * requires a negative value.
793*4d7e907cSAndroid Build Coastguard Worker     *
794*4d7e907cSAndroid Build Coastguard Worker     * Creates a Closure which represents a function call to a ForEach Kernel
795*4d7e907cSAndroid Build Coastguard Worker     * combined with arguments and values for global variables.
796*4d7e907cSAndroid Build Coastguard Worker     *
797*4d7e907cSAndroid Build Coastguard Worker     * @param kernelID Kernel identifier
798*4d7e907cSAndroid Build Coastguard Worker     * @param returnValue Allocation used in output of Closure
799*4d7e907cSAndroid Build Coastguard Worker     * @param fieldIDS Collection of Script's Field identifiers
800*4d7e907cSAndroid Build Coastguard Worker     * @param values Collection of Script's data values
801*4d7e907cSAndroid Build Coastguard Worker     * @param sizes Collection of Script's data sizes
802*4d7e907cSAndroid Build Coastguard Worker     * @param depClosures Collection of Closures
803*4d7e907cSAndroid Build Coastguard Worker     * @param depFieldIDS Collection of Script's dependent Field identifiers
804*4d7e907cSAndroid Build Coastguard Worker     * @return closure Created Closure
805*4d7e907cSAndroid Build Coastguard Worker     */
806*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
807*4d7e907cSAndroid Build Coastguard Worker    closureCreate(ScriptKernelID kernelID, Allocation returnValue,
808*4d7e907cSAndroid Build Coastguard Worker                  vec<ScriptFieldID> fieldIDS, vec<int64_t> values,
809*4d7e907cSAndroid Build Coastguard Worker                  vec<int32_t> sizes, vec<Closure> depClosures,
810*4d7e907cSAndroid Build Coastguard Worker                  vec<ScriptFieldID> depFieldIDS)
811*4d7e907cSAndroid Build Coastguard Worker       generates (Closure closure);
812*4d7e907cSAndroid Build Coastguard Worker
813*4d7e907cSAndroid Build Coastguard Worker    /**
814*4d7e907cSAndroid Build Coastguard Worker     * Creates a Closure which represents a function call to a invocable
815*4d7e907cSAndroid Build Coastguard Worker     * function, combined with arguments and values for global variables.
816*4d7e907cSAndroid Build Coastguard Worker     *
817*4d7e907cSAndroid Build Coastguard Worker     * @param invokeID Invokable function identifier
818*4d7e907cSAndroid Build Coastguard Worker     * @param params Collection of Invoke script parameters
819*4d7e907cSAndroid Build Coastguard Worker     * @param fieldIDS Collection of Script Field identifiers
820*4d7e907cSAndroid Build Coastguard Worker     * @param values Collection of values
821*4d7e907cSAndroid Build Coastguard Worker     * @param sizes Collection of sizes
822*4d7e907cSAndroid Build Coastguard Worker     * @return closure Created Closure
823*4d7e907cSAndroid Build Coastguard Worker     */
824*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
825*4d7e907cSAndroid Build Coastguard Worker    invokeClosureCreate(ScriptInvokeID invokeID, vec<uint8_t> params,
826*4d7e907cSAndroid Build Coastguard Worker                        vec<ScriptFieldID> fieldIDS, vec<int64_t> values,
827*4d7e907cSAndroid Build Coastguard Worker                        vec<int32_t> sizes)
828*4d7e907cSAndroid Build Coastguard Worker             generates (Closure closure);
829*4d7e907cSAndroid Build Coastguard Worker
830*4d7e907cSAndroid Build Coastguard Worker    /**
831*4d7e907cSAndroid Build Coastguard Worker     * Sets the argument of a Closure at specified index and size to provided
832*4d7e907cSAndroid Build Coastguard Worker     * value.
833*4d7e907cSAndroid Build Coastguard Worker     *
834*4d7e907cSAndroid Build Coastguard Worker     * @param closure Closure to be modified
835*4d7e907cSAndroid Build Coastguard Worker     * @param index Index
836*4d7e907cSAndroid Build Coastguard Worker     * @param value Value
837*4d7e907cSAndroid Build Coastguard Worker     * @param size Size
838*4d7e907cSAndroid Build Coastguard Worker     */
839*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
840*4d7e907cSAndroid Build Coastguard Worker    closureSetArg(Closure closure, uint32_t index, Ptr value, int32_t size);
841*4d7e907cSAndroid Build Coastguard Worker
842*4d7e907cSAndroid Build Coastguard Worker    /**
843*4d7e907cSAndroid Build Coastguard Worker     * Sets a global variable in a Closure.
844*4d7e907cSAndroid Build Coastguard Worker     *
845*4d7e907cSAndroid Build Coastguard Worker     * @param closure Closure
846*4d7e907cSAndroid Build Coastguard Worker     * @param fieldID Global's Field identifier
847*4d7e907cSAndroid Build Coastguard Worker     * @param value Value
848*4d7e907cSAndroid Build Coastguard Worker     * @param size Size
849*4d7e907cSAndroid Build Coastguard Worker     */
850*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
851*4d7e907cSAndroid Build Coastguard Worker    closureSetGlobal(Closure closure, ScriptFieldID fieldID, int64_t value,
852*4d7e907cSAndroid Build Coastguard Worker                     int32_t size);
853*4d7e907cSAndroid Build Coastguard Worker
854*4d7e907cSAndroid Build Coastguard Worker    /**
855*4d7e907cSAndroid Build Coastguard Worker     * TODO: should slot be unsigned? (applies to other two ID interfaces, too)
856*4d7e907cSAndroid Build Coastguard Worker     *
857*4d7e907cSAndroid Build Coastguard Worker     * Creates a Script Kernel ID.
858*4d7e907cSAndroid Build Coastguard Worker     *
859*4d7e907cSAndroid Build Coastguard Worker     * @param script Script
860*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot
861*4d7e907cSAndroid Build Coastguard Worker     * @param sig Bitfield describing Kernel signature and operation
862*4d7e907cSAndroid Build Coastguard Worker     * @return scriptKernelID Script's Kernel identifier
863*4d7e907cSAndroid Build Coastguard Worker     */
864*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
865*4d7e907cSAndroid Build Coastguard Worker    scriptKernelIDCreate(Script script, int32_t slot,
866*4d7e907cSAndroid Build Coastguard Worker                         bitfield<MetadataSignatureBitval> sig)
867*4d7e907cSAndroid Build Coastguard Worker              generates (ScriptKernelID scriptKernelID);
868*4d7e907cSAndroid Build Coastguard Worker
869*4d7e907cSAndroid Build Coastguard Worker    /**
870*4d7e907cSAndroid Build Coastguard Worker     * Creates a Script Invoke ID.
871*4d7e907cSAndroid Build Coastguard Worker     *
872*4d7e907cSAndroid Build Coastguard Worker     * @param script Script
873*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot
874*4d7e907cSAndroid Build Coastguard Worker     * @return scriptInvokeID Invoke Script's identifier
875*4d7e907cSAndroid Build Coastguard Worker     */
876*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
877*4d7e907cSAndroid Build Coastguard Worker    scriptInvokeIDCreate(Script script, int32_t slot)
878*4d7e907cSAndroid Build Coastguard Worker              generates (ScriptInvokeID scriptInvokeID);
879*4d7e907cSAndroid Build Coastguard Worker
880*4d7e907cSAndroid Build Coastguard Worker    /**
881*4d7e907cSAndroid Build Coastguard Worker     * TODO: describe the return value better. What is it?
882*4d7e907cSAndroid Build Coastguard Worker     *
883*4d7e907cSAndroid Build Coastguard Worker     * Creates a Script Field ID.
884*4d7e907cSAndroid Build Coastguard Worker     *
885*4d7e907cSAndroid Build Coastguard Worker     * @param script Script
886*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot
887*4d7e907cSAndroid Build Coastguard Worker     * @return scriptFieldID Script's Field identifier
888*4d7e907cSAndroid Build Coastguard Worker     */
889*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
890*4d7e907cSAndroid Build Coastguard Worker    scriptFieldIDCreate(Script script, int32_t slot)
891*4d7e907cSAndroid Build Coastguard Worker             generates (ScriptFieldID scriptFieldID);
892*4d7e907cSAndroid Build Coastguard Worker
893*4d7e907cSAndroid Build Coastguard Worker    /**
894*4d7e907cSAndroid Build Coastguard Worker     * TODO: add more description
895*4d7e907cSAndroid Build Coastguard Worker     *
896*4d7e907cSAndroid Build Coastguard Worker     * Creates a Script Group.
897*4d7e907cSAndroid Build Coastguard Worker     *
898*4d7e907cSAndroid Build Coastguard Worker     * @param kernels Collection of Scripts' Kernel identifiers
899*4d7e907cSAndroid Build Coastguard Worker     * @param srcK Source Kernel identifiers
900*4d7e907cSAndroid Build Coastguard Worker     * @param dstK Destination Kernel identifiers
901*4d7e907cSAndroid Build Coastguard Worker     * @param dstF Destination Script Field identifiers
902*4d7e907cSAndroid Build Coastguard Worker     * @param types Collection of Types describing data layout
903*4d7e907cSAndroid Build Coastguard Worker     * @return scriptGroup Created Script Group
904*4d7e907cSAndroid Build Coastguard Worker     */
905*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
906*4d7e907cSAndroid Build Coastguard Worker    scriptGroupCreate(vec<ScriptKernelID> kernels, vec<ScriptKernelID> srcK,
907*4d7e907cSAndroid Build Coastguard Worker                      vec<ScriptKernelID> dstK, vec<ScriptFieldID> dstF,
908*4d7e907cSAndroid Build Coastguard Worker                      vec<Type> types)
909*4d7e907cSAndroid Build Coastguard Worker           generates (ScriptGroup scriptGroup);
910*4d7e907cSAndroid Build Coastguard Worker
911*4d7e907cSAndroid Build Coastguard Worker    /**
912*4d7e907cSAndroid Build Coastguard Worker     * Creates a Script Group.
913*4d7e907cSAndroid Build Coastguard Worker     *
914*4d7e907cSAndroid Build Coastguard Worker     * @param name Name
915*4d7e907cSAndroid Build Coastguard Worker     * @param cacheDir Cache directory
916*4d7e907cSAndroid Build Coastguard Worker     * @param closures Collection of Closures
917*4d7e907cSAndroid Build Coastguard Worker     * @return scriptGroup2 Created Script Group
918*4d7e907cSAndroid Build Coastguard Worker     */
919*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
920*4d7e907cSAndroid Build Coastguard Worker    scriptGroup2Create(string name, string cacheDir, vec<Closure> closures)
921*4d7e907cSAndroid Build Coastguard Worker            generates (ScriptGroup2 scriptGroup2);
922*4d7e907cSAndroid Build Coastguard Worker
923*4d7e907cSAndroid Build Coastguard Worker    /**
924*4d7e907cSAndroid Build Coastguard Worker     * TODO: if SetInput/Output corresponds to the Java API setInput() and
925*4d7e907cSAndroid Build Coastguard Worker     * setOutput(), which are documented as deprecated in API 23, do we need to
926*4d7e907cSAndroid Build Coastguard Worker     * support them? Or can we fallback to the CPU when they're used? Or can't
927*4d7e907cSAndroid Build Coastguard Worker     * we tell whether they're used early enough to do fallback?
928*4d7e907cSAndroid Build Coastguard Worker     *
929*4d7e907cSAndroid Build Coastguard Worker     * Sets an output of the ScriptGroup. This specifies an Allocation to be
930*4d7e907cSAndroid Build Coastguard Worker     * used for the kernels that require an output Allocation visible after the
931*4d7e907cSAndroid Build Coastguard Worker     * ScriptGroup is executed.
932*4d7e907cSAndroid Build Coastguard Worker     *
933*4d7e907cSAndroid Build Coastguard Worker     * @param sg Script Group
934*4d7e907cSAndroid Build Coastguard Worker     * @param kid Script's Kernel identifier to be changed
935*4d7e907cSAndroid Build Coastguard Worker     * @param alloc Allocation to be filled by output
936*4d7e907cSAndroid Build Coastguard Worker     */
937*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
938*4d7e907cSAndroid Build Coastguard Worker    scriptGroupSetOutput(ScriptGroup sg, ScriptKernelID kid, Allocation alloc);
939*4d7e907cSAndroid Build Coastguard Worker
940*4d7e907cSAndroid Build Coastguard Worker    /**
941*4d7e907cSAndroid Build Coastguard Worker     * Sets an input of the Script Group. This specifies an Allocation to be
942*4d7e907cSAndroid Build Coastguard Worker     * used for kernels that require an input Allocation provided from outside
943*4d7e907cSAndroid Build Coastguard Worker     * of the Script Group.
944*4d7e907cSAndroid Build Coastguard Worker     *
945*4d7e907cSAndroid Build Coastguard Worker     * @param sg Script Group
946*4d7e907cSAndroid Build Coastguard Worker     * @param kid Script's Kernel identifier to be changed
947*4d7e907cSAndroid Build Coastguard Worker     * @param alloc Allocation to be read as input
948*4d7e907cSAndroid Build Coastguard Worker     */
949*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
950*4d7e907cSAndroid Build Coastguard Worker    scriptGroupSetInput(ScriptGroup sg, ScriptKernelID kid, Allocation alloc);
951*4d7e907cSAndroid Build Coastguard Worker
952*4d7e907cSAndroid Build Coastguard Worker    /**
953*4d7e907cSAndroid Build Coastguard Worker     * Executes a Script Group.
954*4d7e907cSAndroid Build Coastguard Worker     *
955*4d7e907cSAndroid Build Coastguard Worker     * @param sg Script Group to be executed.
956*4d7e907cSAndroid Build Coastguard Worker     */
957*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
958*4d7e907cSAndroid Build Coastguard Worker    scriptGroupExecute( ScriptGroup sg);
959*4d7e907cSAndroid Build Coastguard Worker
960*4d7e907cSAndroid Build Coastguard Worker    /**
961*4d7e907cSAndroid Build Coastguard Worker     * Frees any native resources associated with this object. The primary use
962*4d7e907cSAndroid Build Coastguard Worker     * is to force immediate cleanup of resources when it is believed the GC
963*4d7e907cSAndroid Build Coastguard Worker     * may not respond quickly enough.
964*4d7e907cSAndroid Build Coastguard Worker     *
965*4d7e907cSAndroid Build Coastguard Worker     * @param handle Opaque handle to the server-side object to be destroyed
966*4d7e907cSAndroid Build Coastguard Worker     */
967*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
968*4d7e907cSAndroid Build Coastguard Worker    objDestroy(ObjectBase obj);
969*4d7e907cSAndroid Build Coastguard Worker
970*4d7e907cSAndroid Build Coastguard Worker    /**
971*4d7e907cSAndroid Build Coastguard Worker     * Creates a Sampler.
972*4d7e907cSAndroid Build Coastguard Worker     *
973*4d7e907cSAndroid Build Coastguard Worker     * @param magFilter Magnification value for the filter
974*4d7e907cSAndroid Build Coastguard Worker     * @param minFilter Minification value for the filter
975*4d7e907cSAndroid Build Coastguard Worker     * @param wrapS S wrapping mode for the sampler
976*4d7e907cSAndroid Build Coastguard Worker     * @param wrapT T wrapping mode for the sampler
977*4d7e907cSAndroid Build Coastguard Worker     * @param wrapR R wrapping mode for the sampler
978*4d7e907cSAndroid Build Coastguard Worker     * @param aniso Anisotropy setting for the sampler
979*4d7e907cSAndroid Build Coastguard Worker     * @return sampler Created Sampler
980*4d7e907cSAndroid Build Coastguard Worker     */
981*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
982*4d7e907cSAndroid Build Coastguard Worker    samplerCreate(SamplerValue magFilter, SamplerValue minFilter,
983*4d7e907cSAndroid Build Coastguard Worker                  SamplerValue wrapS, SamplerValue wrapT, SamplerValue wrapR,
984*4d7e907cSAndroid Build Coastguard Worker                  float aniso)
985*4d7e907cSAndroid Build Coastguard Worker       generates (Sampler sampler);
986*4d7e907cSAndroid Build Coastguard Worker
987*4d7e907cSAndroid Build Coastguard Worker    /**
988*4d7e907cSAndroid Build Coastguard Worker     * Binds an Allocation to a global pointer in the Script.
989*4d7e907cSAndroid Build Coastguard Worker     *
990*4d7e907cSAndroid Build Coastguard Worker     * @param script Script to be bound to
991*4d7e907cSAndroid Build Coastguard Worker     * @param allocation Allocation to be bound
992*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot of a global variable
993*4d7e907cSAndroid Build Coastguard Worker     */
994*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
995*4d7e907cSAndroid Build Coastguard Worker    scriptBindAllocation(Script script, Allocation allocation, uint32_t slot);
996*4d7e907cSAndroid Build Coastguard Worker
997*4d7e907cSAndroid Build Coastguard Worker    /**
998*4d7e907cSAndroid Build Coastguard Worker     * TODO: is this necessary?
999*4d7e907cSAndroid Build Coastguard Worker     *
1000*4d7e907cSAndroid Build Coastguard Worker     * Sets the timezone of a Script.
1001*4d7e907cSAndroid Build Coastguard Worker     *
1002*4d7e907cSAndroid Build Coastguard Worker     * @param script Script to be altered
1003*4d7e907cSAndroid Build Coastguard Worker     * @param timeZone Time Zone value as text
1004*4d7e907cSAndroid Build Coastguard Worker     */
1005*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1006*4d7e907cSAndroid Build Coastguard Worker    scriptSetTimeZone(Script script, string timeZone);
1007*4d7e907cSAndroid Build Coastguard Worker
1008*4d7e907cSAndroid Build Coastguard Worker    /**
1009*4d7e907cSAndroid Build Coastguard Worker     * TODO: can scriptInvoke be combined with scriptInvokeV?
1010*4d7e907cSAndroid Build Coastguard Worker     *
1011*4d7e907cSAndroid Build Coastguard Worker     * Launches an invokable function.
1012*4d7e907cSAndroid Build Coastguard Worker     *
1013*4d7e907cSAndroid Build Coastguard Worker     * @param vs Script to be invoked
1014*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot of invokable function
1015*4d7e907cSAndroid Build Coastguard Worker     */
1016*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1017*4d7e907cSAndroid Build Coastguard Worker    scriptInvoke(Script vs, uint32_t slot);
1018*4d7e907cSAndroid Build Coastguard Worker
1019*4d7e907cSAndroid Build Coastguard Worker    /**
1020*4d7e907cSAndroid Build Coastguard Worker     * Invokes a Script with values.
1021*4d7e907cSAndroid Build Coastguard Worker     *
1022*4d7e907cSAndroid Build Coastguard Worker     * @param vs Script to be invoked
1023*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot
1024*4d7e907cSAndroid Build Coastguard Worker     * @param data Data buffer of packed arguments
1025*4d7e907cSAndroid Build Coastguard Worker     */
1026*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1027*4d7e907cSAndroid Build Coastguard Worker    scriptInvokeV(Script vs, uint32_t slot, vec<uint8_t> data);
1028*4d7e907cSAndroid Build Coastguard Worker
1029*4d7e907cSAndroid Build Coastguard Worker    /**
1030*4d7e907cSAndroid Build Coastguard Worker     * TODO: add documentation for params
1031*4d7e907cSAndroid Build Coastguard Worker     * TODO: Should we rename "ScriptCall" to "LaunchOptions"?
1032*4d7e907cSAndroid Build Coastguard Worker     *
1033*4d7e907cSAndroid Build Coastguard Worker     * Launches a ForEach kernel.
1034*4d7e907cSAndroid Build Coastguard Worker     *
1035*4d7e907cSAndroid Build Coastguard Worker     * @param vs Script
1036*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot of ForEach Kernel
1037*4d7e907cSAndroid Build Coastguard Worker     * @param vains Collection of input Allocations or null
1038*4d7e907cSAndroid Build Coastguard Worker     * @param vaout Output Allocation or null
1039*4d7e907cSAndroid Build Coastguard Worker     * @param params Collection of parameters
1040*4d7e907cSAndroid Build Coastguard Worker     * @param sc Pointer to a ScriptCall, nullptr if unused
1041*4d7e907cSAndroid Build Coastguard Worker     */
1042*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1043*4d7e907cSAndroid Build Coastguard Worker    scriptForEach(Script vs, uint32_t slot, vec<Allocation> vains,
1044*4d7e907cSAndroid Build Coastguard Worker                  Allocation vaout, vec<uint8_t> params, Ptr sc);
1045*4d7e907cSAndroid Build Coastguard Worker
1046*4d7e907cSAndroid Build Coastguard Worker    /**
1047*4d7e907cSAndroid Build Coastguard Worker     * Launches a Reduction kernel.
1048*4d7e907cSAndroid Build Coastguard Worker     *
1049*4d7e907cSAndroid Build Coastguard Worker     * @param vs Script
1050*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot of Reduction Kernel
1051*4d7e907cSAndroid Build Coastguard Worker     * @param vains Collection of input Allocations
1052*4d7e907cSAndroid Build Coastguard Worker     * @param vaout Output Allocation
1053*4d7e907cSAndroid Build Coastguard Worker     * @param sc Pointer to a ScriptCall, nullptr if unused
1054*4d7e907cSAndroid Build Coastguard Worker     */
1055*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1056*4d7e907cSAndroid Build Coastguard Worker    scriptReduce(Script vs, uint32_t slot, vec<Allocation> vains,
1057*4d7e907cSAndroid Build Coastguard Worker                 Allocation vaout, Ptr sc);
1058*4d7e907cSAndroid Build Coastguard Worker
1059*4d7e907cSAndroid Build Coastguard Worker    /**
1060*4d7e907cSAndroid Build Coastguard Worker     * Sets a Script's integer variable to a value.
1061*4d7e907cSAndroid Build Coastguard Worker     *
1062*4d7e907cSAndroid Build Coastguard Worker     * @param vs RenderScript Script
1063*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot number of variable to be updated
1064*4d7e907cSAndroid Build Coastguard Worker     * @param value Value to be pushed to variable
1065*4d7e907cSAndroid Build Coastguard Worker     */
1066*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1067*4d7e907cSAndroid Build Coastguard Worker    scriptSetVarI(Script vs, uint32_t slot, int32_t value);
1068*4d7e907cSAndroid Build Coastguard Worker
1069*4d7e907cSAndroid Build Coastguard Worker    /**
1070*4d7e907cSAndroid Build Coastguard Worker     * Sets a Script's Object variable to a value
1071*4d7e907cSAndroid Build Coastguard Worker     *
1072*4d7e907cSAndroid Build Coastguard Worker     * @param vs RenderScript Script
1073*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot number of variable to be updated
1074*4d7e907cSAndroid Build Coastguard Worker     * @param obj ObjectBase
1075*4d7e907cSAndroid Build Coastguard Worker     */
1076*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1077*4d7e907cSAndroid Build Coastguard Worker    scriptSetVarObj( Script vs,  uint32_t slot, ObjectBase obj);
1078*4d7e907cSAndroid Build Coastguard Worker
1079*4d7e907cSAndroid Build Coastguard Worker    /**
1080*4d7e907cSAndroid Build Coastguard Worker     * Sets a Script's long variable to a value.
1081*4d7e907cSAndroid Build Coastguard Worker     *
1082*4d7e907cSAndroid Build Coastguard Worker     * @param vs RenderScript Script
1083*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot number of variable to be updated
1084*4d7e907cSAndroid Build Coastguard Worker     * @param value Value to be pushed to variable
1085*4d7e907cSAndroid Build Coastguard Worker     */
1086*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1087*4d7e907cSAndroid Build Coastguard Worker    scriptSetVarJ(Script vs, uint32_t slot, int64_t value);
1088*4d7e907cSAndroid Build Coastguard Worker
1089*4d7e907cSAndroid Build Coastguard Worker    /**
1090*4d7e907cSAndroid Build Coastguard Worker     * Sets a Script's float variable to a value.
1091*4d7e907cSAndroid Build Coastguard Worker     *
1092*4d7e907cSAndroid Build Coastguard Worker     * @param vs RenderScript Script
1093*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot number of variable to be updated
1094*4d7e907cSAndroid Build Coastguard Worker     * @param value Value to be pushed to variable
1095*4d7e907cSAndroid Build Coastguard Worker     */
1096*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1097*4d7e907cSAndroid Build Coastguard Worker    scriptSetVarF(Script vs, uint32_t slot, float value);
1098*4d7e907cSAndroid Build Coastguard Worker
1099*4d7e907cSAndroid Build Coastguard Worker    /**
1100*4d7e907cSAndroid Build Coastguard Worker     * Sets a Script's double variable to a value.
1101*4d7e907cSAndroid Build Coastguard Worker     *
1102*4d7e907cSAndroid Build Coastguard Worker     * @param vs RenderScript Script
1103*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot number of variable to be updated
1104*4d7e907cSAndroid Build Coastguard Worker     * @param value Value to be pushed to variable
1105*4d7e907cSAndroid Build Coastguard Worker     */
1106*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1107*4d7e907cSAndroid Build Coastguard Worker    scriptSetVarD(Script vs, uint32_t slot, double value);
1108*4d7e907cSAndroid Build Coastguard Worker
1109*4d7e907cSAndroid Build Coastguard Worker    /**
1110*4d7e907cSAndroid Build Coastguard Worker     * Sets a Script's struct variable to a value.
1111*4d7e907cSAndroid Build Coastguard Worker     *
1112*4d7e907cSAndroid Build Coastguard Worker     * @param vs RenderScript Script
1113*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot number of variable to be updated
1114*4d7e907cSAndroid Build Coastguard Worker     * @param data Data to be pushed to variable
1115*4d7e907cSAndroid Build Coastguard Worker     */
1116*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1117*4d7e907cSAndroid Build Coastguard Worker    scriptSetVarV(Script vs, uint32_t slot, vec<uint8_t> data);
1118*4d7e907cSAndroid Build Coastguard Worker
1119*4d7e907cSAndroid Build Coastguard Worker    /**
1120*4d7e907cSAndroid Build Coastguard Worker     * TODO: Why do we have typed setters but only untyped getter?
1121*4d7e907cSAndroid Build Coastguard Worker     *
1122*4d7e907cSAndroid Build Coastguard Worker     * Retrieves the value from a global variable in a script.
1123*4d7e907cSAndroid Build Coastguard Worker     *
1124*4d7e907cSAndroid Build Coastguard Worker     * @param vs RenderScript Script
1125*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot number of variable to be read
1126*4d7e907cSAndroid Build Coastguard Worker     * @param len Size of data to be filled
1127*4d7e907cSAndroid Build Coastguard Worker     * @return data Data to be updated
1128*4d7e907cSAndroid Build Coastguard Worker     */
1129*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1130*4d7e907cSAndroid Build Coastguard Worker    scriptGetVarV(Script vs, uint32_t slot, Size len)
1131*4d7e907cSAndroid Build Coastguard Worker       generates (vec<uint8_t> data);
1132*4d7e907cSAndroid Build Coastguard Worker
1133*4d7e907cSAndroid Build Coastguard Worker    /**
1134*4d7e907cSAndroid Build Coastguard Worker     * TODO: Is this a value to be replicated for each member of the array? Or
1135*4d7e907cSAndroid Build Coastguard Worker     * is there a representation for each separate member?
1136*4d7e907cSAndroid Build Coastguard Worker     *
1137*4d7e907cSAndroid Build Coastguard Worker     * Sets the value of a global array of structs, given the Element and
1138*4d7e907cSAndroid Build Coastguard Worker     * dimension.
1139*4d7e907cSAndroid Build Coastguard Worker     *
1140*4d7e907cSAndroid Build Coastguard Worker     * @param vs RenderScript Script
1141*4d7e907cSAndroid Build Coastguard Worker     * @param slot Slot number of variable to be updated
1142*4d7e907cSAndroid Build Coastguard Worker     * @param data Data
1143*4d7e907cSAndroid Build Coastguard Worker     * @param ve Element
1144*4d7e907cSAndroid Build Coastguard Worker     * @param dims Collection of dimensions
1145*4d7e907cSAndroid Build Coastguard Worker     */
1146*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1147*4d7e907cSAndroid Build Coastguard Worker    scriptSetVarVE(Script vs, uint32_t slot, vec<uint8_t> data, Element ve,
1148*4d7e907cSAndroid Build Coastguard Worker                   vec<uint32_t> dims);
1149*4d7e907cSAndroid Build Coastguard Worker
1150*4d7e907cSAndroid Build Coastguard Worker    /**
1151*4d7e907cSAndroid Build Coastguard Worker     * TODO: is cacheDir redundant with createCache() function? Can we remove
1152*4d7e907cSAndroid Build Coastguard Worker     * it?
1153*4d7e907cSAndroid Build Coastguard Worker     * TODO: define resName more clearly
1154*4d7e907cSAndroid Build Coastguard Worker     *
1155*4d7e907cSAndroid Build Coastguard Worker     * Creates a RenderScript C99 kernel script.
1156*4d7e907cSAndroid Build Coastguard Worker     *
1157*4d7e907cSAndroid Build Coastguard Worker     * @param resName Resource name of the bitcode
1158*4d7e907cSAndroid Build Coastguard Worker     * @param cacheDir Cache directory name
1159*4d7e907cSAndroid Build Coastguard Worker     * @param text The kernel's bitcode as a uint8_t vector
1160*4d7e907cSAndroid Build Coastguard Worker     * @return script Created Script
1161*4d7e907cSAndroid Build Coastguard Worker     */
1162*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1163*4d7e907cSAndroid Build Coastguard Worker    scriptCCreate(string resName, string cacheDir, vec<uint8_t> text)
1164*4d7e907cSAndroid Build Coastguard Worker       generates (Script script);
1165*4d7e907cSAndroid Build Coastguard Worker
1166*4d7e907cSAndroid Build Coastguard Worker    /**
1167*4d7e907cSAndroid Build Coastguard Worker     * Creates a RenderScript Intrinsic script.
1168*4d7e907cSAndroid Build Coastguard Worker     *
1169*4d7e907cSAndroid Build Coastguard Worker     * @param id Intrinsic Script identifier
1170*4d7e907cSAndroid Build Coastguard Worker     * @param elem Element
1171*4d7e907cSAndroid Build Coastguard Worker     * @return script Created Script
1172*4d7e907cSAndroid Build Coastguard Worker     */
1173*4d7e907cSAndroid Build Coastguard Worker    @callflow(next={"*"})
1174*4d7e907cSAndroid Build Coastguard Worker    scriptIntrinsicCreate(ScriptIntrinsicID id, Element elem)
1175*4d7e907cSAndroid Build Coastguard Worker               generates (Script script);
1176*4d7e907cSAndroid Build Coastguard Worker
1177*4d7e907cSAndroid Build Coastguard Worker};
1178