diff options
author | Jason Sams <jsams@google.com> | 2014-02-24 17:52:32 -0800 |
---|---|---|
committer | Tim Murray <timmurray@google.com> | 2014-02-26 12:56:38 -0800 |
commit | b8a94e26c0a5e8f58d5b6ed04e46b411e95b77a4 (patch) | |
tree | e90cf2d7d4f89e58742bb34403626cc8bcfb0f5c /rsAllocation.cpp | |
parent | 6bc047c966d52d0246a107dbda410f218f2174eb (diff) | |
download | rs-b8a94e26c0a5e8f58d5b6ed04e46b411e95b77a4.tar.gz |
Add getPointer for USAGE_SHARED allocations.
Change-Id: I13a2af09bbbeec6cc6131b935979ac21c02820be
Diffstat (limited to 'rsAllocation.cpp')
-rw-r--r-- | rsAllocation.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/rsAllocation.cpp b/rsAllocation.cpp index d4cecd03..fd0a49c5 100644 --- a/rsAllocation.cpp +++ b/rsAllocation.cpp @@ -94,6 +94,24 @@ void Allocation::syncAll(Context *rsc, RsAllocationUsageType src) { rsc->mHal.funcs.allocation.syncAll(rsc, this, src); } +void * Allocation::getPointer(const Context *rsc, uint32_t lod, RsAllocationCubemapFace face, + uint32_t z, uint32_t array, size_t *stride) { + + if ((lod >= mHal.drvState.lodCount) || + (z && (z >= mHal.drvState.lod[lod].dimZ)) || + ((face != RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X) && !mHal.state.hasFaces) || + (array != 0)) { + return NULL; + } + + size_t s = 0; + //void *ptr = mRSC->mHal.funcs.allocation.lock1D(rsc, this); + if ((stride != NULL) && mHal.drvState.lod[0].dimY) { + *stride = mHal.drvState.lod[lod].stride; + } + return mHal.drvState.lod[lod].mallocPtr; +} + void Allocation::data(Context *rsc, uint32_t xoff, uint32_t lod, uint32_t count, const void *data, size_t sizeBytes) { const size_t eSize = mHal.state.type->getElementSizeBytes(); @@ -716,6 +734,15 @@ void rsi_AllocationIoReceive(Context *rsc, RsAllocation valloc) { alloc->ioReceive(rsc); } +void rsi_AllocationGetPointer(Context *rsc, RsAllocation valloc, + uint32_t lod, RsAllocationCubemapFace face, + uint32_t z, uint32_t array, size_t *stride, size_t strideLen) { + Allocation *alloc = static_cast<Allocation *>(valloc); + assert(strideLen == sizeof(size_t)); + + alloc->getPointer(rsc, lod, face, z, array, stride); +} + void rsi_Allocation1DRead(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t lod, uint32_t count, void *data, size_t sizeBytes) { Allocation *a = static_cast<Allocation *>(va); |