summaryrefslogtreecommitdiffstats
path: root/cpp/Allocation.cpp
diff options
context:
space:
mode:
authorTim Murray <timmurray@google.com>2013-08-30 12:17:14 -0700
committerTim Murray <timmurray@google.com>2013-09-03 11:41:56 -0700
commit9d24ae621bdfdaf09406b099a2ae055e33d1089a (patch)
tree03fadc0618e925db192b12d90e080ae382b17885 /cpp/Allocation.cpp
parentfa77db83d3e36d6aa23622cec5bdcb5e373f0a3b (diff)
downloadandroid_frameworks_rs-9d24ae621bdfdaf09406b099a2ae055e33d1089a.tar.gz
android_frameworks_rs-9d24ae621bdfdaf09406b099a2ae055e33d1089a.tar.bz2
android_frameworks_rs-9d24ae621bdfdaf09406b099a2ae055e33d1089a.zip
Add 3D allocation support.
bug 10427951 Change-Id: I95f2d4ede5120831a5b547ecb6837dbd20b99c8c
Diffstat (limited to 'cpp/Allocation.cpp')
-rw-r--r--cpp/Allocation.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/cpp/Allocation.cpp b/cpp/Allocation.cpp
index 9727a6e4..c8e71828 100644
--- a/cpp/Allocation.cpp
+++ b/cpp/Allocation.cpp
@@ -283,6 +283,35 @@ void Allocation::copy2DStridedTo(void* data, size_t stride) {
copy2DStridedTo(0, 0, mCurrentDimX, mCurrentDimY, data, stride);
}
+void Allocation::validate3DRange(uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w,
+ uint32_t h, uint32_t d) {
+ if (mAdaptedAllocation != NULL) {
+
+ } else {
+ if (((xoff + w) > mCurrentDimX) || ((yoff + h) > mCurrentDimY) || ((zoff + d) > mCurrentDimZ)) {
+ mRS->throwError(RS_ERROR_INVALID_PARAMETER, "Updated region larger than allocation.");
+ }
+ }
+}
+
+void Allocation::copy3DRangeFrom(uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t w,
+ uint32_t h, uint32_t d, const void* data) {
+ validate3DRange(xoff, yoff, zoff, w, h, d);
+ tryDispatch(mRS, RS::dispatch->Allocation3DData(mRS->getContext(), getIDSafe(), xoff, yoff, zoff,
+ mSelectedLOD, w, h, d, data,
+ w * h * d * mType->getElement()->getSizeBytes(),
+ w * mType->getElement()->getSizeBytes()));
+}
+
+void 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) {
+ validate3DRange(xoff, yoff, zoff, dataXoff, dataYoff, dataZoff);
+ tryDispatch(mRS, RS::dispatch->AllocationCopy3DRange(mRS->getContext(), getIDSafe(), xoff, yoff, zoff,
+ mSelectedLOD, w, h, d, data->getIDSafe(),
+ dataXoff, dataYoff, dataZoff, data->mSelectedLOD));
+}
+
+
sp<Allocation> Allocation::createTyped(sp<RS> rs, sp<const Type> type,
RsAllocationMipmapControl mips, uint32_t usage) {
void *id = 0;