Public Member Functions | Static Public Member Functions
android::RSC::Allocation Class Reference

#include <rsCppStructs.h>

Inheritance diagram for android::RSC::Allocation:
android::RSC::BaseObj

Public Member Functions

sp< const TypegetType () const
void syncAll (RsAllocationUsageType srcLocation)
void generateMipmaps ()
void copy1DRangeFrom (uint32_t off, size_t count, const void *data)
void copy1DRangeFrom (uint32_t off, size_t count, sp< const Allocation > data, uint32_t dataOff)
void copy1DRangeTo (uint32_t off, size_t count, void *data)
void copy1DFrom (const void *data)
void copy1DTo (void *data)
void copy2DRangeFrom (uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, const void *data)
void copy2DRangeTo (uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, void *data)
void copy2DRangeFrom (uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, sp< const Allocation > data, uint32_t dataXoff, uint32_t dataYoff)
void copy2DStridedFrom (uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, const void *data, size_t stride)
void copy2DStridedFrom (const void *data, size_t stride)
void copy2DStridedTo (uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h, void *data, size_t stride)
void copy2DStridedTo (void *data, size_t stride)
void copy3DRangeFrom (uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w, uint32_t h, uint32_t d, const void *data)
void copy3DRangeFrom (uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w, uint32_t h, uint32_t d, sp< const Allocation > data, uint32_t dataXoff, uint32_t dataYoff, uint32_t dataZoff)

Static Public Member Functions

static sp< AllocationcreateTyped (sp< RS > rs, sp< const Type > type, RsAllocationMipmapControl mipmaps, uint32_t usage)
static sp< AllocationcreateTyped (sp< RS > rs, sp< const Type > type, RsAllocationMipmapControl mipmaps, uint32_t usage, void *pointer)
static sp< AllocationcreateTyped (sp< RS > rs, sp< const Type > type, uint32_t usage=RS_ALLOCATION_USAGE_SCRIPT)
static sp< AllocationcreateSized (sp< RS > rs, sp< const Element > e, size_t count, uint32_t usage=RS_ALLOCATION_USAGE_SCRIPT)
static sp< AllocationcreateSized2D (sp< RS > rs, sp< const Element > e, size_t x, size_t y, uint32_t usage=RS_ALLOCATION_USAGE_SCRIPT)

Detailed Description

This class provides the primary method through which data is passed to and from RenderScript kernels. An Allocation provides the backing store for a given Type.

An Allocation also contains a set of usage flags that denote how the Allocation could be used. For example, an Allocation may have usage flags specifying that it can be used from a script as well as input to a Sampler. A developer must synchronize across these different usages using syncAll(int) in order to ensure that different users of the Allocation have a consistent view of memory. For example, in the case where an Allocation is used as the output of one kernel and as Sampler input in a later kernel, a developer must call syncAll(RS_ALLOCATION_USAGE_SCRIPT) prior to launching the second kernel to ensure correctness.

Definition at line 293 of file rsCppStructs.h.


Member Function Documentation

void android::RSC::Allocation::copy1DFrom ( const void *  data)

Copy entire array to an Allocation.

Parameters:
[in]dataarray from which to copy
void android::RSC::Allocation::copy1DRangeFrom ( uint32_t  off,
size_t  count,
const void *  data 
)

Copy an array into part of this Allocation.

Parameters:
[in]offoffset of first Element to be overwritten
[in]countnumber of Elements to copy
[in]dataarray from which to copy
void android::RSC::Allocation::copy1DRangeFrom ( uint32_t  off,
size_t  count,
sp< const Allocation data,
uint32_t  dataOff 
)

Copy part of an Allocation into part of this Allocation.

Parameters:
[in]offoffset of first Element to be overwritten
[in]countnumber of Elements to copy
[in]dataAllocation from which to copy
[in]dataOffoffset of first Element in data to copy
void android::RSC::Allocation::copy1DRangeTo ( uint32_t  off,
size_t  count,
void *  data 
)

Copy an array into part of this Allocation.

Parameters:
[in]offoffset of first Element to be overwritten
[in]countnumber of Elements to copy
[in]dataarray from which to copy
void android::RSC::Allocation::copy1DTo ( void *  data)

Copy entire Allocation to an array.

Parameters:
[in]datadestination array
void android::RSC::Allocation::copy2DRangeFrom ( uint32_t  xoff,
uint32_t  yoff,
uint32_t  w,
uint32_t  h,
const void *  data 
)

Copy from an array into a rectangular region in this Allocation. The array is assumed to be tightly packed.

Parameters:
[in]xoffX offset of region to update in this Allocation
[in]yoffY offset of region to update in this Allocation
[in]wWidth of region to update
[in]hHeight of region to update
[in]dataArray from which to copy
void android::RSC::Allocation::copy2DRangeFrom ( uint32_t  xoff,
uint32_t  yoff,
uint32_t  w,
uint32_t  h,
sp< const Allocation data,
uint32_t  dataXoff,
uint32_t  dataYoff 
)

Copy from an Allocation into a rectangular region in this Allocation.

Parameters:
[in]xoffX offset of region to update in this Allocation
[in]yoffY offset of region to update in this Allocation
[in]wWidth of region to update
[in]hHeight of region to update
[in]dataAllocation from which to copy
[in]dataXoffX offset of region to copy from in data
[in]dataYoffY offset of region to copy from in data
void android::RSC::Allocation::copy2DRangeTo ( uint32_t  xoff,
uint32_t  yoff,
uint32_t  w,
uint32_t  h,
void *  data 
)

Copy from this Allocation into a rectangular region in an array. The array is assumed to be tightly packed.

Parameters:
[in]xoffX offset of region to copy from this Allocation
[in]yoffY offset of region to copy from this Allocation
[in]wWidth of region to update
[in]hHeight of region to update
[in]datadestination array
void android::RSC::Allocation::copy2DStridedFrom ( uint32_t  xoff,
uint32_t  yoff,
uint32_t  w,
uint32_t  h,
const void *  data,
size_t  stride 
)

Copy from a strided array into a rectangular region in this Allocation.

Parameters:
[in]xoffX offset of region to update in this Allocation
[in]yoffY offset of region to update in this Allocation
[in]wWidth of region to update
[in]hHeight of region to update
[in]dataarray from which to copy
[in]stridestride of data in bytes
void android::RSC::Allocation::copy2DStridedFrom ( const void *  data,
size_t  stride 
)

Copy from a strided array into this Allocation.

Parameters:
[in]dataarray from which to copy
[in]stridestride of data in bytes
void android::RSC::Allocation::copy2DStridedTo ( uint32_t  xoff,
uint32_t  yoff,
uint32_t  w,
uint32_t  h,
void *  data,
size_t  stride 
)

Copy from a rectangular region in this Allocation into a strided array.

Parameters:
[in]xoffX offset of region to update in this Allocation
[in]yoffY offset of region to update in this Allocation
[in]wWidth of region to update
[in]hHeight of region to update
[in]datadestination array
[in]stridestride of data in bytes
void android::RSC::Allocation::copy2DStridedTo ( void *  data,
size_t  stride 
)

Copy this Allocation into a strided array.

Parameters:
[in]datadestination array
[in]stridestride of data in bytes
void android::RSC::Allocation::copy3DRangeFrom ( uint32_t  xoff,
uint32_t  yoff,
uint32_t  zoff,
uint32_t  w,
uint32_t  h,
uint32_t  d,
const void *  data 
)

Copy from an array into a 3D region in this Allocation. The array is assumed to be tightly packed.

Parameters:
[in]xoffX offset of region to update in this Allocation
[in]yoffY offset of region to update in this Allocation
[in]zoffZ offset of region to update in this Allocation
[in]wWidth of region to update
[in]hHeight of region to update
[in]dDepth of region to update
[in]dataArray from which to copy
void android::RSC::Allocation::copy3DRangeFrom ( uint32_t  xoff,
uint32_t  yoff,
uint32_t  zoff,
uint32_t  w,
uint32_t  h,
uint32_t  d,
sp< const Allocation data,
uint32_t  dataXoff,
uint32_t  dataYoff,
uint32_t  dataZoff 
)

Copy from an Allocation into a 3D region in this Allocation.

Parameters:
[in]xoffX offset of region to update in this Allocation
[in]yoffY offset of region to update in this Allocation
[in]zoffZ offset of region to update in this Allocation
[in]wWidth of region to update
[in]hHeight of region to update
[in]dDepth of region to update
[in]dataAllocation from which to copy
[in]dataXoffX offset of region in data to copy from
[in]dataYoffY offset of region in data to copy from
[in]dataZoffZ offset of region in data to copy from
static sp<Allocation> android::RSC::Allocation::createSized ( sp< RS rs,
sp< const Element e,
size_t  count,
uint32_t  usage = RS_ALLOCATION_USAGE_SCRIPT 
) [static]

Creates an Allocation with a specified number of given elements.

Parameters:
[in]rsContext to which the Allocation will belong
[in]eElement used in the Allocation
[in]countNumber of elements of the Allocation
[in]usageusage for the Allocation
Returns:
new Allocation
static sp<Allocation> android::RSC::Allocation::createSized2D ( sp< RS rs,
sp< const Element e,
size_t  x,
size_t  y,
uint32_t  usage = RS_ALLOCATION_USAGE_SCRIPT 
) [static]

Creates a 2D Allocation with a specified number of given elements.

Parameters:
[in]rsContext to which the Allocation will belong
[in]eElement used in the Allocation
[in]xWidth in Elements of the Allocation
[in]yHeight of the Allocation
[in]usageusage for the Allocation
Returns:
new Allocation
static sp<Allocation> android::RSC::Allocation::createTyped ( sp< RS rs,
sp< const Type type,
RsAllocationMipmapControl  mipmaps,
uint32_t  usage 
) [static]

Creates an Allocation for use by scripts with a given Type.

Parameters:
[in]rsContext to which the Allocation will belong
[in]typeType of the Allocation
[in]mipmapsdesired mipmap behavior for the Allocation
[in]usageusage for the Allocation
Returns:
new Allocation
static sp<Allocation> android::RSC::Allocation::createTyped ( sp< RS rs,
sp< const Type type,
RsAllocationMipmapControl  mipmaps,
uint32_t  usage,
void *  pointer 
) [static]

Creates an Allocation for use by scripts with a given Type and a backing pointer. For use with RS_ALLOCATION_USAGE_SHARED.

Parameters:
[in]rsContext to which the Allocation will belong
[in]typeType of the Allocation
[in]mipmapsdesired mipmap behavior for the Allocation
[in]usageusage for the Allocation
[in]pointerexisting backing store to use for this Allocation if possible
Returns:
new Allocation
static sp<Allocation> android::RSC::Allocation::createTyped ( sp< RS rs,
sp< const Type type,
uint32_t  usage = RS_ALLOCATION_USAGE_SCRIPT 
) [static]

Creates an Allocation for use by scripts with a given Type with no mipmaps.

Parameters:
[in]rsContext to which the Allocation will belong
[in]typeType of the Allocation
[in]usageusage for the Allocation
Returns:
new Allocation
void android::RSC::Allocation::generateMipmaps ( )

Generate a mipmap chain. This is only valid if the Type of the Allocation includes mipmaps. This function will generate a complete set of mipmaps from the top level LOD and place them into the script memory space. If the Allocation is also using other memory spaces, a call to syncAll(Allocation.USAGE_SCRIPT) is required.

sp<const Type> android::RSC::Allocation::getType ( ) const [inline]

Return Type for the allocation.

Returns:
pointer to underlying Type

Definition at line 338 of file rsCppStructs.h.

void android::RSC::Allocation::syncAll ( RsAllocationUsageType  srcLocation)

Propagate changes from one usage of the Allocation to other usages of the Allocation.

Parameters:
[in]srcLocationsource location with changes to propagate elsewhere

The documentation for this class was generated from the following file: