Home | History | Annotate | Download | only in renderscript

Lines Matching full:allocation

34  * and from RenderScript kernels.  An Allocation provides the backing store for
37 * <p>An Allocation also contains a set of usage flags that denote how the
38 * Allocation could be used. For example, an Allocation may have usage flags
41 * different usages using {@link android.renderscript.Allocation#syncAll} in
42 * order to ensure that different users of the Allocation have a consistent view
43 * of memory. For example, in the case where an Allocation is used as the output
45 * {@link #syncAll syncAll(Allocation.USAGE_SCRIPT)} prior to launching the
48 * <p>An Allocation can be populated with the {@link #copyFrom} routines. For
58 public class Allocation extends BaseObj {
62 Allocation mAdaptedAllocation;
79 static HashMap<Integer, Allocation> mAllocationMap =
80 new HashMap<Integer, Allocation>();
84 * The usage of the Allocation. These signal to RenderScript where to place
85 * the Allocation in memory.
90 * The Allocation will be bound to and accessed by scripts.
95 * The Allocation will be used as a texture source by one or more graphics
102 * The Allocation will be used as a graphics mesh.
111 * The Allocation will be used as the source of shader constants by one or
120 * The Allocation will be used as a target for offscreen rendering
128 * The Allocation will be used as a {@link android.graphics.SurfaceTexture}
129 * consumer. This usage will cause the Allocation to be created as
136 * The Allocation will be used as a {@link android.graphics.SurfaceTexture}
139 * Allocation.
145 * The Allocation's backing store will be inherited from another object
148 * copy. {@link #syncAll} may also be used to synchronize the Allocation
170 * the Allocation will contain a full mipmap chain. On upload, the full
176 * The Type of the Allocation will be the same as MIPMAP_NONE. It will
177 * not contain mipmaps. On upload, the allocation data will contain a
199 * android.renderscript.Type} of the Allocation.
209 * Get the usage flags of the Allocation.
211 * @return usage this Allocation's set of the USAGE_* flags OR'd together
219 * Get the size of the Allocation in bytes.
221 * @return size of the Allocation in bytes.
245 Allocation(int id, RenderScript rs, Type t, int usage) {
282 "32 bit integer source does not match allocation type " + mType.mElement.mType);
291 "16 bit integer source does not match allocation type " + mType.mElement.mType);
300 "8 bit integer source does not match allocation type " + mType.mElement.mType);
308 "32 bit float source does not match allocation type " + mType.mElement.mType);
325 "Object source does not match allocation type " + mType.mElement.mType);
340 * Get the {@link android.renderscript.Type} of the Allocation.
350 * Propagate changes from one usage of the Allocation to the
351 * other usages of the Allocation.
378 * Send a buffer to the output stream. The contents of the Allocation will
380 * #USAGE_IO_OUTPUT} is set on the Allocation.
402 * Receive the latest input into the Allocation. This operation
403 * is only valid if {@link #USAGE_IO_INPUT} is set on the Allocation.
416 * Copy an array of RS objects to the Allocation.
424 throw new RSIllegalArgumentException("Array size mismatch, allocation sizeX = " +
442 throw new RSIllegalArgumentException("Allocation kind is " +
452 throw new RSIllegalArgumentException("Allocation kind is " +
462 throw new RSIllegalArgumentException("Allocation kind is " +
472 throw new RSIllegalArgumentException("Allocation kind is " +
485 throw new RSIllegalArgumentException("Cannot update allocation from bitmap, sizes mismatch");
490 * Copy into this Allocation from an array. This method does not guarantee
491 * that the Allocation is compatible with the input buffer; it copies memory
507 * Copy into this Allocation from an array. This method does not guarantee
508 * that the Allocation is compatible with the input buffer; it copies memory
524 * Copy into this Allocation from an array. This method does not guarantee
525 * that the Allocation is compatible with the input buffer; it copies memory
541 * Copy into this Allocation from an array. This method does not guarantee
542 * that the Allocation is compatible with the input buffer; it copies memory
559 * Copy into this Allocation from an array. This variant is type checked
560 * and will generate exceptions if the Allocation's {@link
577 * Copy into this Allocation from an array. This variant is type checked
578 * and will generate exceptions if the Allocation's {@link
595 * Copy into this Allocation from an array. This variant is type checked
596 * and will generate exceptions if the Allocation's {@link
613 * Copy into this Allocation from an array. This variant is type checked
614 * and will generate exceptions if the Allocation's {@link
631 * Copy into an Allocation from a {@link android.graphics.Bitmap}. The
633 * allocation.
636 * android.graphics.Bitmap} used to create the Allocation with {@link
637 * #createFromBitmap} and {@link #USAGE_SHARED} is set on the Allocation,
638 * this will synchronize the Allocation with the latest data from the {@link
658 * Copy an Allocation from an Allocation. The types of both allocations
661 * @param a the source allocation
663 public void copyFrom(Allocation a) {
735 throw new RSIllegalArgumentException("Array too small for allocation type.");
740 * Generate a mipmap chain. This is only valid if the Type of the Allocation
746 * <p>If the Allocation is also using other memory spaces, a call to {@link
747 * #syncAll syncAll(Allocation.USAGE_SCRIPT)} is required.</p>
754 * Copy an array into part of this Allocation. This method does not
755 * guarantee that the Allocation is compatible with the input buffer.
767 * Copy an array into part of this Allocation. This method does not
768 * guarantee that the Allocation is compatible with the input buffer.
780 * Copy an array into part of this Allocation. This method does not
781 * guarantee that the Allocation is compatible with the input buffer.
793 * Copy an array into part of this Allocation. This method does not
794 * guarantee that the Allocation is compatible with the input buffer.
807 * Copy an array into part of this Allocation. This variant is type checked
808 * and will generate exceptions if the Allocation type is not a 32 bit
821 * Copy an array into part of this Allocation. This variant is type checked
822 * and will generate exceptions if the Allocation type is not a 16 bit
835 * Copy an array into part of this Allocation. This variant is type checked
836 * and will generate exceptions if the Allocation type is not an 8 bit
849 * Copy an array into part of this Allocation. This variant is type checked
850 * and will generate exceptions if the Allocation type is not a 32 bit float
863 * Copy part of an Allocation into this Allocation.
867 * @param data the source data allocation.
871 public void copy1DRangeFrom(int off, int count, Allocation data, int dataOff) {
890 throw new RSIllegalArgumentException("Updated region larger than allocation.");
925 * Copy from an array into a rectangular region in this Allocation. The
928 * @param xoff X offset of the region to update in this Allocation
929 * @param yoff Y offset of the region to update in this Allocation
932 * @param data to be placed into the Allocation
940 * Copy from an array into a rectangular region in this Allocation. The
943 * @param xoff X offset of the region to update in this Allocation
944 * @param yoff Y offset of the region to update in this Allocation
947 * @param data to be placed into the Allocation
955 * Copy from an array into a rectangular region in this Allocation. The
958 * @param xoff X offset of the region to update in this Allocation
959 * @param yoff Y offset of the region to update in this Allocation
962 * @param data to be placed into the Allocation
970 * Copy from an array into a rectangular region in this Allocation. The
973 * @param xoff X offset of the region to update in this Allocation
974 * @param yoff Y offset of the region to update in this Allocation
977 * @param data to be placed into the Allocation
985 * Copy a rectangular region from an Allocation into a rectangular region in
986 * this Allocation.
988 * @param xoff X offset of the region in this Allocation
989 * @param yoff Y offset of the region in this Allocation
992 * @param data source Allocation.
993 * @param dataXoff X offset in source Allocation
994 * @param dataYoff Y offset in source Allocation
997 Allocation data, int dataXoff, int dataYoff) {
1007 * Copy a {@link android.graphics.Bitmap} into an Allocation. The height
1011 * @param xoff X offset of the region to update in this Allocation
1012 * @param yoff Y offset of the region to update in this Allocation
1041 throw new RSIllegalArgumentException("Updated region larger than allocation.");
1093 * Copy a rectangular region from the array into the allocation.
1096 * @param xoff X offset of the region to update in this Allocation
1097 * @param yoff Y offset of the region to update in this Allocation
1098 * @param zoff Z offset of the region to update in this Allocation
1102 * @param data to be placed into the allocation
1138 * Copy a rectangular region into the allocation from another
1139 * allocation.
1141 * @param xoff X offset of the region to update in this Allocation
1142 * @param yoff Y offset of the region to update in this Allocation
1143 * @param zoff Z offset of the region to update in this Allocation
1147 * @param data source allocation.
1148 * @param dataXoff X offset of the region in the source Allocation
1149 * @param dataYoff Y offset of the region in the source Allocation
1150 * @param dataZoff Z offset of the region in the source Allocation
1153 Allocation data, int dataXoff, int dataYoff, int dataZoff) {
1163 * Copy from the Allocation into a {@link android.graphics.Bitmap}. The
1164 * bitmap must match the dimensions of the Allocation.
1166 * @param b The bitmap to be set from the Allocation.
1176 * Copy from the Allocation into a byte array. The array must be at least
1177 * as large as the Allocation. The allocation must be of an 8 bit integer
1180 * @param d The array to be set from the Allocation.
1189 * Copy from the Allocation into a short array. The array must be at least
1190 * as large as the Allocation. The allocation must be of an 16 bit integer
1193 * @param d The array to be set from the Allocation.
1202 * Copy from the Allocation into a int array. The array must be at least as
1203 * large as the Allocation. The allocation must be of an 32 bit integer
1206 * @param d The array to be set from the Allocation.
1215 * Copy from the Allocation into a float array. The array must be at least
1216 * as large as the Allocation. The allocation must be of an 32 bit float
1219 * @param d The array to be set from the Allocation.
1228 * Resize a 1D allocation. The contents of the allocation are preserved.
1237 * @param dimX The new size of the allocation.
1240 * replacement is to create a new allocation and copy the contents.
1264 * Creates a new Allocation with the given {@link
1269 * allocation
1270 * @param usage bit field specifying how the Allocation is
1273 static public Allocation createTyped(RenderScript rs, Type type, MipmapControl mips, int usage) {
1280 throw new RSRuntimeException("Allocation creation failed.");
1282 return new Allocation(id, rs, type, usage);
1286 * Creates an Allocation with the size specified by the type and no mipmaps
1289 * @param rs Context to which the allocation will belong.
1291 * @param usage bit field specifying how the allocation is
1294 * @return allocation
1296 static public Allocation createTyped(RenderScript rs, Type type, int usage) {
1301 * Creates an Allocation for use by scripts with a given {@link
1304 * @param rs Context to which the Allocation will belong.
1307 * @return allocation
1309 static public Allocation createTyped(RenderScript rs, Type type) {
1314 * Creates an Allocation with a specified number of given elements
1316 * @param rs Context to which the Allocation will belong.
1317 * @param e Element to use in the Allocation
1318 * @param count the number of Elements in the Allocation
1319 * @param usage bit field specifying how the Allocation is
1322 * @return allocation
1324 static public Allocation createSized(RenderScript rs, Element e,
1333 throw new RSRuntimeException("Allocation creation failed.");
1335 return new Allocation(id, rs, t, usage);
1339 * Creates an Allocation with a specified number of given elements
1341 Allocation will belong.
1342 * @param e Element to use in the Allocation
1343 * @param count the number of Elements in the Allocation
1345 * @return allocation
1347 static public Allocation createSized(RenderScript rs, Element e, int count) {
1379 * Creates an Allocation from a {@link android.graphics.Bitmap}.
1381 * @param rs Context to which the allocation will belong.
1382 * @param b Bitmap source for the allocation data
1384 * allocation
1385 * @param usage bit field specifying how the allocation is
1388 * @return Allocation containing bitmap data
1391 static public Allocation createFromBitmap(RenderScript rs, Bitmap b,
1419 Allocation alloc = new Allocation(id, rs, t, usage);
1429 return new Allocation(id, rs, t, usage);
1437 * @return Surface object associated with allocation
1442 throw new RSInvalidStateException("Allocation is not a surface texture.");
1455 * Associate a {@link android.view.Surface} with this Allocation. This
1458 * @param sur Surface to associate with allocation
1463 throw new RSInvalidStateException("Allocation is not USAGE_IO_OUTPUT.");
1470 * Creates an Allocation from a {@link android.graphics.Bitmap}.
1472 * <p>With target API version 18 or greater, this Allocation will be created
1475 * Allocation will be created with {@link #USAGE_GRAPHICS_TEXTURE}.</p>
1477 * @param rs Context to which the allocation will belong.
1478 * @param b bitmap source for the allocation data
1480 * @return Allocation containing bitmap data
1483 static public Allocation createFromBitmap(RenderScript rs, Bitmap b) {
1493 * Creates a cubemap Allocation from a {@link android.graphics.Bitmap}
1498 * @param rs Context to which the allocation will belong.
1504 * @return allocation containing cubemap data
1507 static public Allocation createCubemapFromBitmap(RenderScript rs, Bitmap b,
1538 return new Allocation(id, rs, t, usage);
1542 * Creates a non-mipmapped cubemap Allocation for use as a graphics texture
1547 * @param rs Context to which the allocation will belong.
1551 * @return allocation containing cubemap data
1554 static public Allocation createCubemapFromBitmap(RenderScript rs,
1561 * Creates a cubemap Allocation from 6 {@link android.graphics.Bitmap}
1565 * @param rs Context to which the allocation will belong.
1575 * @return allocation containing cubemap data
1578 static public Allocation createCubemapFromCubeFaces(RenderScript rs,
1608 Allocation cubemap = Allocation.createTyped(rs, t, mips, usage);
1628 * Creates a non-mipmapped cubemap Allocation for use as a sampler input
1633 * @param rs Context to which the allocation will belong.
1641 * @return allocation containing cubemap data
1644 static public Allocation createCubemapFromCubeFaces(RenderScript rs,
1657 * Creates an Allocation from the Bitmap referenced
1660 * @param rs Context to which the allocation will belong.
1664 * allocation
1665 * @param usage bit field specifying how the allocation is
1668 * @return Allocation containing resource data
1671 static public Allocation createFromBitmapResource(RenderScript rs,
1682 Allocation alloc = createFromBitmap(rs, b, mips, usage);
1688 * Creates a non-mipmapped Allocation to use as a graphics texture from the
1691 * <p>With target API version 18 or greater, this allocation will be created
1693 * target API version 17 or lower, this allocation will be created with
1696 * @param rs Context to which the allocation will belong.
1700 * @return Allocation containing resource data
1703 static public Allocation createFromBitmapResource(RenderScript rs,
1717 * Creates an Allocation containing string data encoded in UTF-8 format.
1719 * @param rs Context to which the allocation will belong.
1720 * @param str string to create the allocation from
1725 static public Allocation createFromString(RenderScript rs,
1732 Allocation alloc = Allocation
1750 public void onBufferAvailable(Allocation a);
1770 Allocation a = mAllocationMap.get(new Integer(id));