Lines Matching refs:rsc

30 Allocation::Allocation(Context *rsc, const Type *type, uint32_t usages,
32 : ObjectBase(rsc) {
51 Allocation * Allocation::createAllocation(Context *rsc, const Type *type, uint32_t usages,
54 void* allocMem = rsc->mHal.funcs.allocRuntimeMem(sizeof(Allocation), 0);
57 rsc->setError(RS_ERROR_FATAL_DRIVER, "Couldn't allocate memory for Allocation");
61 Allocation *a = new (allocMem) Allocation(rsc, type, usages, mc, ptr);
63 if (!rsc->mHal.funcs.allocation.init(rsc, a, type->getElement()->getHasReferences())) {
64 rsc->setError(RS_ERROR_FATAL_DRIVER, "Allocation::Allocation, alloc failure");
93 void Allocation::syncAll(Context *rsc, RsAllocationUsageType src) {
94 rsc->mHal.funcs.allocation.syncAll(rsc, this, src);
97 void * Allocation::getPointer(const Context *rsc, uint32_t lod, RsAllocationCubemapFace face,
108 //void *ptr = mRSC->mHal.funcs.allocation.lock1D(rsc, this);
115 void Allocation::data(Context *rsc, uint32_t xoff, uint32_t lod,
123 rsc->setError(RS_ERROR_BAD_VALUE, buf);
128 rsc->mHal.funcs.allocation.data1D(rsc, this, xoff, lod, count, data, sizeBytes);
129 sendDirty(rsc);
132 void Allocation::data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
134 rsc->mHal.funcs.allocation.data2D(rsc, this, xoff, yoff, lod, face, w, h, data, sizeBytes, stride);
135 sendDirty(rsc);
138 void Allocation::data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff,
141 rsc->mHal.funcs.allocation.data3D(rsc, this, xoff, yoff, zoff, lod, w, h, d, data, sizeBytes, stride);
142 sendDirty(rsc);
145 void Allocation::read(Context *rsc, uint32_t xoff, uint32_t lod,
153 rsc->setError(RS_ERROR_BAD_VALUE, buf);
158 rsc->mHal.funcs.allocation.read1D(rsc, this, xoff, lod, count, data, sizeBytes);
161 void Allocation::read(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
171 rsc->setError(RS_ERROR_BAD_VALUE, buf);
176 rsc->mHal.funcs.allocation.read2D(rsc, this, xoff, yoff, lod, face, w, h, data, sizeBytes, stride);
179 void Allocation::read(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod,
187 rsc->mHal.funcs.allocation.read3D(rsc, this, xoff, yoff, zoff, lod, w, h, d, data, sizeBytes, stride);
191 void Allocation::elementData(Context *rsc, uint32_t x, const void *data,
196 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
201 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
208 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
212 rsc->mHal.funcs.allocation.elementData1D(rsc, this, x, data, cIdx, sizeBytes);
213 sendDirty(rsc);
216 void Allocation::elementData(Context *rsc, uint32_t x, uint32_t y,
221 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
226 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
231 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
238 rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
242 rsc->mHal.funcs.allocation.elementData2D(rsc, this, x, y, data, cIdx, sizeBytes);
243 sendDirty(rsc);
279 void Allocation::writePackedData(Context *rsc, const Type *type,
328 void Allocation::unpackVec3Allocation(Context *rsc, const void *data, size_t dataSize) {
330 uint8_t *dst = (uint8_t *)rsc->mHal.funcs.allocation.lock1D(rsc, this);
332 writePackedData(rsc, getType(), dst, src, true);
333 rsc->mHal.funcs.allocation.unlock1D(rsc, this);
336 void Allocation::packVec3Allocation(Context *rsc, OStream *stream) const {
341 const uint8_t *src = (const uint8_t*)rsc->mHal.funcs.allocation.lock1D(rsc, this);
344 writePackedData(rsc, getType(), dst, src, false);
348 rsc->mHal.funcs.allocation.unlock1D(rsc, this);
351 void Allocation::serialize(Context *rsc, OStream *stream) const {
358 mHal.state.type->serialize(rsc, stream);
367 stream->addByteArray(rsc->mHal.funcs.allocation.lock1D(rsc, this), dataSize);
368 rsc->mHal.funcs.allocation.unlock1D(rsc, this);
371 packVec3Allocation(rsc, stream);
375 Allocation *Allocation::createFromStream(Context *rsc, IStream *stream) {
379 rsc->setError(RS_ERROR_FATAL_DRIVER,
386 Type *type = Type::createFromStream(rsc, stream);
392 Allocation *alloc = Allocation::createAllocation(rsc, type, RS_ALLOCATION_USAGE_SCRIPT);
401 rsc->setError(RS_ERROR_FATAL_DRIVER,
412 alloc->data(rsc, 0, 0, count, stream->getPtr() + stream->getPos(), dataSize);
414 alloc->unpackVec3Allocation(rsc, stream->getPtr() + stream->getPos(), dataSize);
421 void Allocation::sendDirty(const Context *rsc) const {
427 mRSC->mHal.funcs.allocation.markDirty(rsc, this);
441 void Allocation::callUpdateCacheObject(const Context *rsc, void *dstObj) const {
442 if (rsc->mHal.funcs.allocation.updateCachedObject != NULL) {
443 rsc->mHal.funcs.allocation.updateCachedObject(rsc, this, (rs_allocation *)dstObj);
465 void Allocation::copyRange1D(Context *rsc, const Allocation *src, int32_t srcOff, int32_t destOff, int32_t len) {
468 void Allocation::resize1D(Context *rsc, uint32_t dimX) {
474 ObjectBaseRef<Type> t = mHal.state.type->cloneAndResize1D(rsc, dimX);
476 decRefs(rsc->mHal.funcs.allocation.lock1D(rsc, this), oldDimX - dimX, dimX);
477 rsc->mHal.funcs.allocation.unlock1D(rsc, this);
479 rsc->mHal.funcs.allocation.resize(rsc, this, t.get(), mHal.state.hasReferences);
484 void Allocation::resize2D(Context *rsc, uint32_t dimX, uint32_t dimY) {
485 rsc->setError(RS_ERROR_FATAL_DRIVER, "resize2d not implemented");
491 rsc->sendMessageToClient(&ip, RS_MESSAGE_TO_CLIENT_NEW_BUFFER, 0, sizeof(ip), true);
495 void * Allocation::getSurface(const Context *rsc) {
505 mBufferListener->rsc = rsc;
513 //return rsc->mHal.funcs.allocation.getSurface(rsc, this);
516 void Allocation::setSurface(const Context *rsc, RsNativeWindow sur) {
518 rsc->mHal.funcs.allocation.setSurface(rsc, this, nw);
521 void Allocation::ioSend(const Context *rsc) {
522 rsc->mHal.funcs.allocation.ioSend(rsc, this);
525 void Allocation::ioReceive(const Context *rsc) {
533 rsc->mHal.funcs.allocation.ioReceive(rsc, this);
537 rsc->setError(RS_ERROR_DRIVER, "Error receiving IO input buffer.");
564 void rsi_AllocationSyncAll(Context *rsc, RsAllocation va, RsAllocationUsageType src) {
566 a->sendDirty(rsc);
567 a->syncAll(rsc, src);
570 void rsi_AllocationGenerateMipmaps(Context *rsc, RsAllocation va) {
572 rsc->mHal.funcs.allocation.generateMipmaps(rsc, alloc);
575 void rsi_AllocationCopyToBitmap(Context *rsc, RsAllocation va, void *data, size_t sizeBytes) {
578 a->read(rsc, 0, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X,
582 void rsi_Allocation1DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t lod,
585 a->data(rsc, xoff, lod, count, data, sizeBytes);
588 void rsi_Allocation2DElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t y, uint32_t lod, RsAllocationCubemapFace face,
591 a->elementData(rsc, x, y, data, eoff, sizeBytes);
594 void rsi_Allocation1DElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t lod,
597 a->elementData(rsc, x, data, eoff, sizeBytes);
600 void rsi_Allocation2DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
603 a->data(rsc, xoff, yoff, lod, face, w, h, data, sizeBytes, stride);
606 void rsi_Allocation3DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod,
609 a->data(rsc, xoff, yoff, zoff, lod, w, h, d, data, sizeBytes, stride);
613 void rsi_AllocationRead(Context *rsc, RsAllocation va, void *data, size_t sizeBytes) {
617 a->read(rsc, 0, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X,
620 a->read(rsc, 0, 0, t->getDimX(), data, sizeBytes);
625 void rsi_AllocationResize1D(Context *rsc, RsAllocation va, uint32_t dimX) {
627 a->resize1D(rsc, dimX);
630 void rsi_AllocationResize2D(Context *rsc, RsAllocation va, uint32_t dimX, uint32_t dimY) {
632 a->resize2D(rsc, dimX, dimY);
635 RsAllocation rsi_AllocationCreateTyped(Context *rsc, RsType vtype,
638 Allocation * alloc = Allocation::createAllocation(rsc, static_cast<Type *>(vtype), usages, mipmaps, (void*)ptr);
646 RsAllocation rsi_AllocationCreateFromBitmap(Context *rsc, RsType vtype,
651 RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mipmaps, usages, 0);
658 texAlloc->data(rsc, 0, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X,
661 rsc->mHal.funcs.allocation.generateMipmaps(rsc, texAlloc);
664 texAlloc->sendDirty(rsc);
668 RsAllocation rsi_AllocationCubeCreateFromBitmap(Context *rsc, RsType vtype,
676 RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mipmaps, usages, 0);
690 texAlloc->data(rsc, 0, dI, 0, (RsAllocationCubemapFace)face,
699 rsc->mHal.funcs.allocation.generateMipmaps(rsc, texAlloc);
702 texAlloc->sendDirty(rsc);
706 void rsi_AllocationCopy2DRange(Context *rsc,
716 rsc->mHal.funcs.allocation.allocData2D(rsc, dst, dstXoff, dstYoff, dstMip,
723 void rsi_AllocationCopy3DRange(Context *rsc,
733 rsc->mHal.funcs.allocation.allocData3D(rsc, dst, dstXoff, dstYoff, dstZoff, dstMip,
739 void * rsi_AllocationGetSurface(Context *rsc, RsAllocation valloc) {
741 void *s = alloc->getSurface(rsc);
745 void rsi_AllocationSetSurface(Context *rsc, RsAllocation valloc, RsNativeWindow sur) {
747 alloc->setSurface(rsc, sur);
750 void rsi_AllocationIoSend(Context *rsc, RsAllocation valloc) {
752 alloc->ioSend(rsc);
755 void rsi_AllocationIoReceive(Context *rsc, RsAllocation valloc) {
757 alloc->ioReceive(rsc);
760 void *rsi_AllocationGetPointer(Context *rsc, RsAllocation valloc,
766 return alloc->getPointer(rsc, lod, face, z, array, stride);
769 void rsi_Allocation1DRead(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t lod,
772 rsc->mHal.funcs.allocation.read1D(rsc, a, xoff, lod, count, data, sizeBytes);
775 void rsi_Allocation2DRead(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t yoff,
779 a->read(rsc, xoff, yoff, lod, face, w, h, data, sizeBytes, stride);