Lines Matching full:allocation
32 * Memory allocation class for renderscript. An allocation combines a
48 * For example, when creating a allocation for a texture, the user can
51 * synchronization if a script modifies an allocation used by other targets it must
57 * memory types. A {@link android.renderscript.Allocation#syncAll syncAll()}
61 * <p>Allocation data is uploaded in one of two primary ways. For simple
73 public class Allocation extends BaseObj {
77 Allocation mAdaptedAllocation;
97 * The usage of the allocation. These signal to renderscript
98 * where to place the allocation in memory.
100 * SCRIPT The allocation will be bound to and accessed by
106 * GRAPHICS_TEXTURE The allocation will be used as a texture
113 * GRAPHICS_VERTEX The allocation will be used as a graphics
121 * GRAPHICS_CONSTANTS The allocation will be used as the source
128 * USAGE_GRAPHICS_RENDER_TARGET The allocation will be used as a
135 * USAGE_IO_INPUT The allocation will be used as SurfaceTexture
136 * consumer. This usage will cause the allocation to be created
143 * USAGE_IO_OUTPUT The allocation will be used as a
145 * SurfaceTexture will be forced to those of the allocation.
163 * type of the allocation will contain a full mipmap chain. On
169 * The type of the allocation will be the same as MIPMAP_NONE.
171 * graphics copy of the allocation data will contain a full
192 * Get the element of the type of the Allocation.
195 * allocation
203 * Get the usage flags of the Allocation.
205 * @return usage flags associated with the allocation. e.g.
214 * Get the size of the Allocation in bytes.
216 * @return size of the Allocation in bytes.
236 Allocation(int id, RenderScript rs, Type t, int usage) {
272 "32 bit integer source does not match allocation type " + mType.mElement.mType);
281 "16 bit integer source does not match allocation type " + mType.mElement.mType);
290 "8 bit integer source does not match allocation type " + mType.mElement.mType);
298 "32 bit float source does not match allocation type " + mType.mElement.mType);
315 "Object source does not match allocation type " + mType.mElement.mType);
330 * Get the type of the Allocation.
340 * Propagate changes from one usage of the allocation to the
341 * remaining usages of the allocation.
360 * Allocation will be undefined after this operation.
381 * Receive the latest input into the Allocation.
394 * Copy an array of RS objects to the allocation.
402 throw new RSIllegalArgumentException("Array size mismatch, allocation sizeX = " +
417 throw new RSIllegalArgumentException("Allocation kind is " +
427 throw new RSIllegalArgumentException("Allocation kind is " +
437 throw new RSIllegalArgumentException("Allocation kind is " +
447 throw new RSIllegalArgumentException("Allocation kind is " +
460 throw new RSIllegalArgumentException("Cannot update allocation from bitmap, sizes mismatch");
465 * Copy an allocation from an array. This variant is not type
476 * Copy an allocation from an array. This variant is not type
487 * Copy an allocation from an array. This variant is not type
498 * Copy an allocation from an array. This variant is not type
510 * Copy an allocation from an array. This variant is type
511 * checked and will generate exceptions if the Allocation type
522 * Copy an allocation from an array. This variant is type
523 * checked and will generate exceptions if the Allocation type
534 * Copy an allocation from an array. This variant is type
535 * checked and will generate exceptions if the Allocation type
546 * Copy an allocation from an array. This variant is type
547 * checked and will generate exceptions if the Allocation type
558 * Copy an allocation from a bitmap. The height, width, and
559 * format of the bitmap must match the existing allocation.
633 throw new RSIllegalArgumentException("Array too small for allocation type.");
638 * Generate a mipmap chain. Requires the type of the allocation
644 * If the allocation is also using other memory spaces a
652 * Copy part of an allocation from an array. This variant is
666 * Copy part of an allocation from an array. This variant is
680 * Copy part of an allocation from an array. This variant is
694 * Copy part of an allocation from an array. This variant is
709 * Copy part of an allocation from an array. This variant is
710 * type checked and will generate exceptions if the Allocation
723 * Copy part of an allocation from an array. This variant is
724 * type checked and will generate exceptions if the Allocation
737 * Copy part of an allocation from an array. This variant is
738 * type checked and will generate exceptions if the Allocation
751 * Copy part of an allocation from an array. This variant is
752 * type checked and will generate exceptions if the Allocation
765 * Copy part of an allocation from another allocation.
769 * @param data the source data allocation.
773 public void copy1DRangeFrom(int off, int count, Allocation data, int dataOff) {
792 throw new RSIllegalArgumentException("Updated region larger than allocation.");
798 * Copy a rectangular region from the array into the allocation.
805 * @param data to be placed into the allocation
836 * Copy a rectangular region into the allocation from another
837 * allocation.
843 * @param data source allocation.
848 Allocation data, int dataXoff, int dataYoff) {
858 * Copy a bitmap into an allocation. The height and width of
875 * Copy from the Allocation into a Bitmap. The bitmap must
876 * match the dimensions of the Allocation.
878 * @param b The bitmap to be set from the Allocation.
888 * Copy from the Allocation into a byte array. The array must
889 * be at least as large as the Allocation. The allocation must
892 * @param d The array to be set from the Allocation.
901 * Copy from the Allocation into a short array. The array must
902 * be at least as large as the Allocation. The allocation must
905 * @param d The array to be set from the Allocation.
914 * Copy from the Allocation into a int array. The array must be
915 * at least as large as the Allocation. The allocation must be
918 * @param d The array to be set from the Allocation.
927 * Copy from the Allocation into a float array. The array must
928 * be at least as large as the Allocation. The allocation must
931 * @param d The array to be set from the Allocation.
940 * Resize a 1D allocation. The contents of the allocation are
949 * @param dimX The new size of the allocation.
965 * Resize a 2D allocation. The contents of the allocation are
975 * @param dimX The new size of the allocation.
976 * @param dimY The new size of the allocation.
1009 * allocation
1010 * @param usage bit field specifying how the allocation is
1013 static public Allocation createTyped(RenderScript rs, Type type, MipmapControl mips, int usage) {
1020 throw new RSRuntimeException("Allocation creation failed.");
1022 return new Allocation(id, rs, type, usage);
1026 * Creates a renderscript allocation with the size specified by
1029 * @param rs Context to which the allocation will belong.
1031 * @param usage bit field specifying how the allocation is
1034 * @return allocation
1036 static public Allocation createTyped(RenderScript rs, Type type, int usage) {
1041 * Creates a renderscript allocation for use by the script with
1045 * @param rs Context to which the allocation will belong.
1048 * @return allocation
1050 static public Allocation createTyped(RenderScript rs, Type type) {
1055 * Creates a renderscript allocation with a specified number of
1058 * @param rs Context to which the allocation will belong.
1059 * @param e describes what each element of an allocation is
1060 * @param count specifies the number of element in the allocation
1061 * @param usage bit field specifying how the allocation is
1064 * @return allocation
1066 static public Allocation createSized(RenderScript rs, Element e,
1075 throw new RSRuntimeException("Allocation creation failed.");
1077 return new Allocation(id, rs, t, usage);
1081 * Creates a renderscript allocation with a specified number of
1084 * @param rs Context to which the allocation will belong.
1085 * @param e describes what each element of an allocation is
1086 * @param count specifies the number of element in the allocation
1088 * @return allocation
1090 static public Allocation createSized(RenderScript rs, Element e, int count) {
1122 * Creates a renderscript allocation from a bitmap
1124 * @param rs Context to which the allocation will belong.
1125 * @param b bitmap source for the allocation data
1127 * allocation
1128 * @param usage bit field specifying how the allocation is
1131 * @return renderscript allocation containing bitmap data
1134 static public Allocation createFromBitmap(RenderScript rs, Bitmap b,
1144 return new Allocation(id, rs, t, usage);
1155 throw new RSInvalidStateException("Allocation is not a surface texture.");
1170 * @return Surface object associated with allocation
1178 * Associate a surface for io output with this allocation
1180 * @param sur Surface to associate with allocation
1185 throw new RSInvalidStateException("Allocation is not USAGE_IO_OUTPUT.");
1197 throw new RSInvalidStateException("Allocation is not USAGE_IO_OUTPUT.");
1205 * Creates a non-mipmapped renderscript allocation to use as a
1208 * @param rs Context to which the allocation will belong.
1209 * @param b bitmap source for the allocation data
1211 * @return renderscript allocation containing bitmap data
1214 static public Allocation createFromBitmap(RenderScript rs, Bitmap b) {
1220 * Creates a cubemap allocation from a bitmap containing the
1224 * @param rs Context to which the allocation will belong.
1230 * @return allocation containing cubemap data
1233 static public Allocation createCubemapFromBitmap(RenderScript rs, Bitmap b,
1264 return new Allocation(id, rs, t, usage);
1268 * Creates a non-mipmapped cubemap allocation for use as a
1273 * @param rs Context to which the allocation will belong.
1277 * @return allocation containing cubemap data
1280 static public Allocation createCubemapFromBitmap(RenderScript rs,
1287 * Creates a cubemap allocation from 6 bitmaps containing
1291 * @param rs Context to which the allocation will belong.
1301 * @return allocation containing cubemap data
1304 static public Allocation createCubemapFromCubeFaces(RenderScript rs,
1334 Allocation cubemap = Allocation.createTyped(rs, t, mips, usage);
1354 * Creates a non-mipmapped cubemap allocation for use as a
1359 * @param rs Context to which the allocation will belong.
1367 * @return allocation containing cubemap data
1370 static public Allocation createCubemapFromCubeFaces(RenderScript rs,
1383 * Creates a renderscript allocation from the bitmap referenced
1386 * @param rs Context to which the allocation will belong.
1390 * allocation
1391 * @param usage bit field specifying how the allocation is
1394 * @return renderscript allocation containing resource data
1397 static public Allocation createFromBitmapResource(RenderScript rs,
1405 Allocation alloc = createFromBitmap(rs, b, mips, usage);
1411 * Creates a non-mipmapped renderscript allocation to use as a
1414 * @param rs Context to which the allocation will belong.
1418 * @return renderscript allocation containing resource data
1421 static public Allocation createFromBitmapResource(RenderScript rs,
1430 * Creates a renderscript allocation containing string data
1433 * @param rs Context to which the allocation will belong.
1434 * @param str string to create the allocation from
1439 static public Allocation createFromString(RenderScript rs,
1446 Allocation alloc = Allocation.createSized(rs, Element.U8(rs), allocArray.length, usage);