Move memory layout to driver.
This change moves all allocation data copies to the
hal. Also removes stride from the runtime. Follow on
changes will remove the malloc pointer from the runtime.
Change-Id: I30967c739800cd4b97186e9fc8b69f26a3f2787d
diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp
index 20c2165..7f2de1d 100644
--- a/driver/rsdAllocation.cpp
+++ b/driver/rsdAllocation.cpp
@@ -78,6 +78,17 @@
return 0;
}
+uint8_t *GetOffsetPtr(const android::renderscript::Allocation *alloc,
+ uint32_t xoff, uint32_t yoff, uint32_t lod,
+ RsAllocationCubemapFace face) {
+ DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
+ uint8_t *ptr = (uint8_t *)drv->lod[lod].mallocPtr;
+ ptr += face * drv->faceOffset;
+ ptr += yoff * drv->lod[lod].stride;
+ ptr += xoff * alloc->mHal.state.elementSizeBytes;
+ return ptr;
+}
+
static void Update2DTexture(const Context *rsc, const Allocation *alloc, const void *ptr,
uint32_t xoff, uint32_t yoff, uint32_t lod,
@@ -109,8 +120,7 @@
rsdGLCheckError(rsc, "Upload2DTexture 1 ");
for (uint32_t face = 0; face < faceCount; face ++) {
for (uint32_t lod = 0; lod < alloc->mHal.state.type->getLODCount(); lod++) {
- const uint8_t *p = (const uint8_t *)alloc->mHal.drvState.mallocPtr;
- p += alloc->mHal.state.type->getLODFaceOffset(lod, (RsAllocationCubemapFace)face, 0, 0);
+ const uint8_t *p = GetOffsetPtr(alloc, 0, 0, lod, (RsAllocationCubemapFace)face);
GLenum t = GL_TEXTURE_2D;
if (alloc->mHal.state.hasFaces) {
@@ -165,9 +175,10 @@
Upload2DTexture(rsc, alloc, isFirstUpload);
if (!(alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_SCRIPT)) {
- if (alloc->mHal.drvState.mallocPtr) {
- free(alloc->mHal.drvState.mallocPtr);
- alloc->mHal.drvState.mallocPtr = NULL;
+ if (alloc->mHal.drvState.mallocPtrLOD0) {
+ free(alloc->mHal.drvState.mallocPtrLOD0);
+ alloc->mHal.drvState.mallocPtrLOD0 = NULL;
+ drv->lod[0].mallocPtr = NULL;
}
}
rsdGLCheckError(rsc, "UploadToTexture");
@@ -214,7 +225,7 @@
}
RSD_CALL_GL(glBindBuffer, drv->glTarget, drv->bufferID);
RSD_CALL_GL(glBufferData, drv->glTarget, alloc->mHal.state.type->getSizeBytes(),
- alloc->mHal.drvState.mallocPtr, GL_DYNAMIC_DRAW);
+ alloc->mHal.drvState.mallocPtrLOD0, GL_DYNAMIC_DRAW);
RSD_CALL_GL(glBindBuffer, drv->glTarget, 0);
rsdGLCheckError(rsc, "UploadToBufferObject");
}
@@ -225,15 +236,53 @@
return false;
}
- void * ptr = NULL;
+ drv->lod[0].dimX = alloc->getType()->getDimX();
+ drv->lod[0].dimY = alloc->getType()->getDimY();
+ drv->lod[0].mallocPtr = 0;
+ drv->lod[0].stride = alloc->mHal.state.dimensionX * alloc->mHal.state.elementSizeBytes;
+ drv->lodCount = alloc->getType()->getLODCount();
+ drv->faceCount = alloc->getType()->getDimFaces();
+
+ size_t offsets[Allocation::MAX_LOD];
+ memset(offsets, 0, sizeof(offsets));
+
+ size_t o = drv->lod[0].stride * rsMax(drv->lod[0].dimY, 1u) * rsMax(drv->lod[0].dimZ, 1u);
+ if(drv->lodCount > 1) {
+ uint32_t tx = drv->lod[0].dimX;
+ uint32_t ty = drv->lod[0].dimY;
+ uint32_t tz = drv->lod[0].dimZ;
+ for (uint32_t lod=1; lod < drv->lodCount; lod++) {
+ drv->lod[lod].dimX = tx;
+ drv->lod[lod].dimY = ty;
+ drv->lod[lod].dimZ = tz;
+ drv->lod[lod].stride = tx * alloc->mHal.state.elementSizeBytes;
+ offsets[lod] = o;
+ o += drv->lod[lod].stride * rsMax(ty, 1u) * rsMax(tz, 1u);
+ if (tx > 1) tx >>= 1;
+ if (ty > 1) ty >>= 1;
+ if (tz > 1) tz >>= 1;
+ }
+ }
+ drv->faceOffset = o;
+
+ uint8_t * ptr = NULL;
if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_IO_OUTPUT) {
} else {
- ptr = malloc(alloc->mHal.state.type->getSizeBytes());
+ size_t allocSize = drv->faceOffset;
+ if(drv->faceCount) {
+ allocSize *= 6;
+ }
+
+ ptr = (uint8_t *)malloc(allocSize);
if (!ptr) {
free(drv);
return false;
}
}
+ drv->lod[0].mallocPtr = ptr;
+ for (uint32_t lod=1; lod < drv->lodCount; lod++) {
+ drv->lod[lod].mallocPtr = ptr + offsets[lod];
+ }
drv->glTarget = GL_NONE;
if (alloc->mHal.state.usageFlags & RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE) {
@@ -251,9 +300,8 @@
drv->glType = rsdTypeToGLType(alloc->mHal.state.type->getElement()->getComponent().getType());
drv->glFormat = rsdKindToGLFormat(alloc->mHal.state.type->getElement()->getComponent().getKind());
-
- alloc->mHal.drvState.mallocPtr = ptr;
- alloc->mHal.drvState.stride = alloc->mHal.state.dimensionX * alloc->mHal.state.elementSizeBytes;
+ alloc->mHal.drvState.strideLOD0 = drv->lod[0].stride;
+ alloc->mHal.drvState.mallocPtrLOD0 = ptr;
alloc->mHal.drv = drv;
if (forceZero && ptr) {
memset(ptr, 0, alloc->mHal.state.type->getSizeBytes());
@@ -263,8 +311,6 @@
drv->uploadDeferred = true;
}
- drv->width = alloc->getType()->getDimX();
- drv->height = alloc->getType()->getDimY();
drv->readBackFBO = NULL;
@@ -289,9 +335,9 @@
drv->renderTargetID = 0;
}
- if (alloc->mHal.drvState.mallocPtr) {
- free(alloc->mHal.drvState.mallocPtr);
- alloc->mHal.drvState.mallocPtr = NULL;
+ if (alloc->mHal.drvState.mallocPtrLOD0) {
+ free(alloc->mHal.drvState.mallocPtrLOD0);
+ alloc->mHal.drvState.mallocPtrLOD0 = NULL;
}
if (drv->readBackFBO != NULL) {
delete drv->readBackFBO;
@@ -305,8 +351,8 @@
const Type *newType, bool zeroNew) {
DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
- alloc->mHal.drvState.mallocPtr = (uint8_t *)realloc(
- alloc->mHal.drvState.mallocPtr, newType->getSizeBytes());
+ alloc->mHal.drvState.mallocPtrLOD0 = (uint8_t *)realloc(
+ alloc->mHal.drvState.mallocPtrLOD0, newType->getSizeBytes());
const uint32_t oldDimX = alloc->mHal.state.dimensionX;
const uint32_t dimX = newType->getDimX();
@@ -314,7 +360,7 @@
if (dimX > oldDimX) {
const Element *e = alloc->mHal.state.type->getElement();
uint32_t stride = e->getSizeBytes();
- memset(((uint8_t *)alloc->mHal.drvState.mallocPtr) + stride * oldDimX,
+ memset(((uint8_t *)alloc->mHal.drvState.mallocPtrLOD0) + stride * oldDimX,
0, stride * (dimX - oldDimX));
}
}
@@ -413,8 +459,9 @@
mapper.lock(drv->wndBuffer->handle,
GRALLOC_USAGE_SW_READ_NEVER | GRALLOC_USAGE_SW_WRITE_OFTEN,
bounds, &dst);
- alloc->mHal.drvState.mallocPtr = dst;
- alloc->mHal.drvState.stride = drv->wndBuffer->stride * alloc->mHal.state.elementSizeBytes;
+ drv->lod[0].mallocPtr = dst;
+ alloc->mHal.drvState.mallocPtrLOD0 = dst;
+ drv->lod[0].stride = drv->wndBuffer->stride * alloc->mHal.state.elementSizeBytes;
return true;
}
@@ -507,8 +554,7 @@
DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
const uint32_t eSize = alloc->mHal.state.type->getElementSizeBytes();
- uint8_t * ptr = (uint8_t *)alloc->mHal.drvState.mallocPtr;
- ptr += eSize * xoff;
+ uint8_t * ptr = GetOffsetPtr(alloc, xoff, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X);
uint32_t size = count * eSize;
if (alloc->mHal.state.hasReferences) {
@@ -528,10 +574,9 @@
uint32_t eSize = alloc->mHal.state.elementSizeBytes;
uint32_t lineSize = eSize * w;
- if (alloc->mHal.drvState.mallocPtr) {
+ if (drv->lod[0].mallocPtr) {
const uint8_t *src = static_cast<const uint8_t *>(data);
- uint8_t *dst = (uint8_t *)alloc->mHal.drvState.mallocPtr;
- dst += alloc->mHal.state.type->getLODFaceOffset(lod, face, xoff, yoff);
+ uint8_t *dst = GetOffsetPtr(alloc, xoff, yoff, lod, face);
for (uint32_t line=yoff; line < (yoff+h); line++) {
if (alloc->mHal.state.hasReferences) {
@@ -540,7 +585,7 @@
}
memcpy(dst, src, lineSize);
src += lineSize;
- dst += alloc->mHal.drvState.stride;
+ dst += drv->lod[lod].stride;
}
drv->uploadDeferred = true;
} else {
@@ -555,6 +600,56 @@
}
+void rsdAllocationRead1D(const Context *rsc, const Allocation *alloc,
+ uint32_t xoff, uint32_t lod, uint32_t count,
+ void *data, size_t sizeBytes) {
+ DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
+
+ const uint32_t eSize = alloc->mHal.state.type->getElementSizeBytes();
+ const uint8_t * ptr = GetOffsetPtr(alloc, xoff, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X);
+ memcpy(data, ptr, count * eSize);
+}
+
+void rsdAllocationRead2D(const Context *rsc, const Allocation *alloc,
+ uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
+ uint32_t w, uint32_t h, void *data, size_t sizeBytes) {
+ DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
+
+ uint32_t eSize = alloc->mHal.state.elementSizeBytes;
+ uint32_t lineSize = eSize * w;
+
+ if (drv->lod[0].mallocPtr) {
+ uint8_t *dst = static_cast<uint8_t *>(data);
+ const uint8_t *src = GetOffsetPtr(alloc, xoff, yoff, lod, face);
+
+ for (uint32_t line=yoff; line < (yoff+h); line++) {
+ memcpy(dst, src, lineSize);
+ dst += lineSize;
+ src += drv->lod[lod].stride;
+ }
+ } else {
+ ALOGE("Add code to readback from non-script memory");
+ }
+}
+
+void rsdAllocationRead3D(const Context *rsc, const Allocation *alloc,
+ uint32_t xoff, uint32_t yoff, uint32_t zoff,
+ uint32_t lod, RsAllocationCubemapFace face,
+ uint32_t w, uint32_t h, uint32_t d, void *data, uint32_t sizeBytes) {
+
+}
+
+void * rsdAllocationLock1D(const android::renderscript::Context *rsc,
+ const android::renderscript::Allocation *alloc) {
+ DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
+ return drv->lod[0].mallocPtr;
+}
+
+void rsdAllocationUnlock1D(const android::renderscript::Context *rsc,
+ const android::renderscript::Allocation *alloc) {
+
+}
+
void rsdAllocationData1D_alloc(const android::renderscript::Context *rsc,
const android::renderscript::Allocation *dstAlloc,
uint32_t dstXoff, uint32_t dstLod, uint32_t count,
@@ -562,20 +657,6 @@
uint32_t srcXoff, uint32_t srcLod) {
}
-uint8_t *getOffsetPtr(const android::renderscript::Allocation *alloc,
- uint32_t xoff, uint32_t yoff, uint32_t lod,
- RsAllocationCubemapFace face) {
- uint8_t *ptr = static_cast<uint8_t *>(alloc->getPtr());
- ptr += alloc->getType()->getLODOffset(lod, xoff, yoff);
-
- if (face != 0) {
- uint32_t totalSizeBytes = alloc->getType()->getSizeBytes();
- uint32_t faceOffset = totalSizeBytes / 6;
- ptr += faceOffset * (uint32_t)face;
- }
- return ptr;
-}
-
void rsdAllocationData2D_alloc_script(const android::renderscript::Context *rsc,
const android::renderscript::Allocation *dstAlloc,
@@ -586,8 +667,8 @@
RsAllocationCubemapFace srcFace) {
uint32_t elementSize = dstAlloc->getType()->getElementSizeBytes();
for (uint32_t i = 0; i < h; i ++) {
- uint8_t *dstPtr = getOffsetPtr(dstAlloc, dstXoff, dstYoff + i, dstLod, dstFace);
- uint8_t *srcPtr = getOffsetPtr(srcAlloc, srcXoff, srcYoff + i, srcLod, srcFace);
+ uint8_t *dstPtr = GetOffsetPtr(dstAlloc, dstXoff, dstYoff + i, dstLod, dstFace);
+ uint8_t *srcPtr = GetOffsetPtr(srcAlloc, srcXoff, srcYoff + i, srcLod, srcFace);
memcpy(dstPtr, srcPtr, w * elementSize);
//ALOGE("COPIED dstXoff(%u), dstYoff(%u), dstLod(%u), dstFace(%u), w(%u), h(%u), srcXoff(%u), srcYoff(%u), srcLod(%u), srcFace(%u)",
@@ -628,8 +709,7 @@
DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
uint32_t eSize = alloc->mHal.state.elementSizeBytes;
- uint8_t * ptr = (uint8_t *)alloc->mHal.drvState.mallocPtr;
- ptr += eSize * x;
+ uint8_t * ptr = GetOffsetPtr(alloc, x, 0, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X);
const Element * e = alloc->mHal.state.type->getElement()->getField(cIdx);
ptr += alloc->mHal.state.type->getElement()->getFieldOffsetBytes(cIdx);
@@ -649,8 +729,7 @@
DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
uint32_t eSize = alloc->mHal.state.elementSizeBytes;
- uint8_t * ptr = (uint8_t *)alloc->mHal.drvState.mallocPtr;
- ptr += (eSize * x) + (y * alloc->mHal.drvState.stride);
+ uint8_t * ptr = GetOffsetPtr(alloc, x, y, 0, RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X);
const Element * e = alloc->mHal.state.type->getElement()->getField(cIdx);
ptr += alloc->mHal.state.type->getElement()->getFieldOffsetBytes(cIdx);
diff --git a/driver/rsdAllocation.h b/driver/rsdAllocation.h
index 0b196a1..98b1d65 100644
--- a/driver/rsdAllocation.h
+++ b/driver/rsdAllocation.h
@@ -19,6 +19,7 @@
#include <rs_hal.h>
#include <rsRuntime.h>
+#include <rsAllocation.h>
#include <GLES/gl.h>
#include <GLES2/gl2.h>
@@ -39,9 +40,6 @@
// Is this a legal structure to be used as an FBO render target
uint32_t renderTargetID;
- uint32_t width;
- uint32_t height;
-
GLenum glTarget;
GLenum glType;
GLenum glFormat;
@@ -51,6 +49,19 @@
RsdFrameBufferObj * readBackFBO;
ANativeWindow *wnd;
ANativeWindowBuffer *wndBuffer;
+
+ struct LodState {
+ void * mallocPtr;
+ size_t stride;
+ uint32_t dimX;
+ uint32_t dimY;
+ uint32_t dimZ;
+ } lod[android::renderscript::Allocation::MAX_LOD];
+ size_t faceOffset;
+ uint32_t lodCount;
+ uint32_t faceCount;
+
+
};
GLenum rsdTypeToGLType(RsDataType t);
@@ -95,6 +106,27 @@
uint32_t lod, RsAllocationCubemapFace face,
uint32_t w, uint32_t h, uint32_t d, const void *data, uint32_t sizeBytes);
+void rsdAllocationRead1D(const android::renderscript::Context *rsc,
+ const android::renderscript::Allocation *alloc,
+ uint32_t xoff, uint32_t lod, uint32_t count,
+ void *data, uint32_t sizeBytes);
+void rsdAllocationRead2D(const android::renderscript::Context *rsc,
+ const android::renderscript::Allocation *alloc,
+ uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
+ uint32_t w, uint32_t h,
+ void *data, uint32_t sizeBytes);
+void rsdAllocationRead3D(const android::renderscript::Context *rsc,
+ const android::renderscript::Allocation *alloc,
+ uint32_t xoff, uint32_t yoff, uint32_t zoff,
+ uint32_t lod, RsAllocationCubemapFace face,
+ uint32_t w, uint32_t h, uint32_t d, void *data, uint32_t sizeBytes);
+
+void * rsdAllocationLock1D(const android::renderscript::Context *rsc,
+ const android::renderscript::Allocation *alloc);
+void rsdAllocationUnlock1D(const android::renderscript::Context *rsc,
+ const android::renderscript::Allocation *alloc);
+
+
void rsdAllocationData1D_alloc(const android::renderscript::Context *rsc,
const android::renderscript::Allocation *dstAlloc,
uint32_t dstXoff, uint32_t dstLod, uint32_t count,
diff --git a/driver/rsdBcc.cpp b/driver/rsdBcc.cpp
index 5a15899..00d9cb1 100644
--- a/driver/rsdBcc.cpp
+++ b/driver/rsdBcc.cpp
@@ -17,6 +17,7 @@
#include "rsdCore.h"
#include "rsdBcc.h"
#include "rsdRuntime.h"
+#include "rsdAllocation.h"
#include <bcc/BCCContext.h>
#include <bcc/RenderScript/RSCompilerDriver.h>
@@ -43,6 +44,8 @@
bcc::BCCContext *mCompilerContext;
bcc::RSCompilerDriver *mCompilerDriver;
bcc::RSExecutable *mExecutable;
+
+ Allocation **mBoundAllocs;
};
typedef void (*outer_foreach_t)(
@@ -141,6 +144,11 @@
script->mHal.info.root = drv->mRoot;
}
+ if (script->mHal.info.exportedVariableCount) {
+ drv->mBoundAllocs = new Allocation *[script->mHal.info.exportedVariableCount];
+ memset(drv->mBoundAllocs, 0, sizeof(void *) * script->mHal.info.exportedVariableCount);
+ }
+
pthread_mutex_unlock(&rsdgInitMutex);
return true;
@@ -151,6 +159,7 @@
delete drv->mCompilerContext;
delete drv->mCompilerDriver;
delete drv->mExecutable;
+ delete[] drv->mBoundAllocs;
free(drv);
}
script->mHal.drv = NULL;
@@ -334,17 +343,19 @@
mtls.ptrIn = NULL;
mtls.eStrideIn = 0;
if (ain) {
+ DrvAllocation *aindrv = (DrvAllocation *)ain->mHal.drv;
mtls.ptrIn = (const uint8_t *)ain->getPtr();
mtls.eStrideIn = ain->getType()->getElementSizeBytes();
- mtls.yStrideIn = ain->mHal.drvState.stride;
+ mtls.yStrideIn = aindrv->lod[0].stride;
}
mtls.ptrOut = NULL;
mtls.eStrideOut = 0;
if (aout) {
+ DrvAllocation *aoutdrv = (DrvAllocation *)aout->mHal.drv;
mtls.ptrOut = (uint8_t *)aout->getPtr();
mtls.eStrideOut = aout->getType()->getElementSizeBytes();
- mtls.yStrideOut = aout->mHal.drvState.stride;
+ mtls.yStrideOut = aoutdrv->lod[0].stride;
}
if ((dc->mWorkers.mCount > 1) && s->mHal.info.isThreadable && !dc->mInForEach) {
@@ -491,8 +502,9 @@
memcpy(destPtr, data, dataLength);
}
-void rsdScriptSetGlobalBind(const Context *dc, const Script *script, uint32_t slot, void *data) {
+void rsdScriptSetGlobalBind(const Context *dc, const Script *script, uint32_t slot, Allocation *data) {
DrvScript *drv = (DrvScript *)script->mHal.drv;
+
//rsAssert(!script->mFieldIsObject[slot]);
//ALOGE("setGlobalBind %p %p %i %p", dc, script, slot, data);
@@ -503,7 +515,13 @@
return;
}
- memcpy(destPtr, &data, sizeof(void *));
+ void *ptr = NULL;
+ drv->mBoundAllocs[slot] = data;
+ if(data) {
+ DrvAllocation *allocDrv = (DrvAllocation *)data->mHal.drv;
+ ptr = allocDrv->lod[0].mallocPtr;
+ }
+ memcpy(destPtr, &ptr, sizeof(void *));
}
void rsdScriptSetGlobalObj(const Context *dc, const Script *script, uint32_t slot, ObjectBase *data) {
@@ -558,7 +576,28 @@
delete drv->mCompilerContext;
delete drv->mCompilerDriver;
delete drv->mExecutable;
-
+ delete[] drv->mBoundAllocs;
free(drv);
script->mHal.drv = NULL;
}
+
+Allocation * rsdScriptGetAllocationForPointer(const android::renderscript::Context *dc,
+ const android::renderscript::Script *sc,
+ const void *ptr) {
+ DrvScript *drv = (DrvScript *)sc->mHal.drv;
+ if (!ptr) {
+ return NULL;
+ }
+
+ for (uint32_t ct=0; ct < sc->mHal.info.exportedVariableCount; ct++) {
+ Allocation *a = drv->mBoundAllocs[ct];
+ if (!a) continue;
+ DrvAllocation *adrv = (DrvAllocation *)a->mHal.drv;
+ if (adrv->lod[0].mallocPtr == ptr) {
+ return a;
+ }
+ }
+ ALOGE("rsGetAllocation, failed to find %p", ptr);
+ return NULL;
+}
+
diff --git a/driver/rsdBcc.h b/driver/rsdBcc.h
index 7a4b138..ead6701 100644
--- a/driver/rsdBcc.h
+++ b/driver/rsdBcc.h
@@ -58,7 +58,7 @@
size_t dimLength);
void rsdScriptSetGlobalBind(const android::renderscript::Context *,
const android::renderscript::Script *,
- uint32_t slot, void *data);
+ uint32_t slot, android::renderscript::Allocation *data);
void rsdScriptSetGlobalObj(const android::renderscript::Context *,
const android::renderscript::Script *,
uint32_t slot, android::renderscript::ObjectBase *data);
@@ -76,5 +76,9 @@
void rsdScriptDestroy(const android::renderscript::Context *dc,
android::renderscript::Script *script);
+android::renderscript::Allocation * rsdScriptGetAllocationForPointer(
+ const android::renderscript::Context *dc,
+ const android::renderscript::Script *script,
+ const void *);
#endif
diff --git a/driver/rsdCore.cpp b/driver/rsdCore.cpp
index 7b27a62..1a71d54 100644
--- a/driver/rsdCore.cpp
+++ b/driver/rsdCore.cpp
@@ -79,6 +79,11 @@
rsdAllocationData1D,
rsdAllocationData2D,
rsdAllocationData3D,
+ rsdAllocationRead1D,
+ rsdAllocationRead2D,
+ rsdAllocationRead3D,
+ rsdAllocationLock1D,
+ rsdAllocationUnlock1D,
rsdAllocationData1D_alloc,
rsdAllocationData2D_alloc,
rsdAllocationData3D_alloc,
diff --git a/driver/rsdMeshObj.cpp b/driver/rsdMeshObj.cpp
index 5dab84b..92e02be 100644
--- a/driver/rsdMeshObj.cpp
+++ b/driver/rsdMeshObj.cpp
@@ -151,7 +151,7 @@
mAttribs[ct].ptr = NULL;
} else {
mAttribs[ct].buffer = 0;
- mAttribs[ct].ptr = (const uint8_t*)alloc->mHal.drvState.mallocPtr;
+ mAttribs[ct].ptr = (const uint8_t*)alloc->mHal.drvState.mallocPtrLOD0;
}
}
@@ -172,7 +172,7 @@
} else {
RSD_CALL_GL(glBindBuffer, GL_ELEMENT_ARRAY_BUFFER, 0);
RSD_CALL_GL(glDrawElements, mGLPrimitives[primIndex], len, GL_UNSIGNED_SHORT,
- idxAlloc->mHal.drvState.mallocPtr);
+ idxAlloc->mHal.drvState.mallocPtrLOD0);
}
} else {
RSD_CALL_GL(glDrawArrays, mGLPrimitives[primIndex], start, len);
diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp
index 5eb80c5..da92839 100644
--- a/driver/rsdRuntimeStubs.cpp
+++ b/driver/rsdRuntimeStubs.cpp
@@ -23,6 +23,7 @@
#include "utils/Timers.h"
#include "rsdCore.h"
+#include "rsdBcc.h"
#include "rsdRuntime.h"
#include "rsdPath.h"
@@ -380,7 +381,7 @@
static const Allocation * SC_GetAllocation(const void *ptr) {
GET_TLS();
- return rsrGetAllocation(rsc, sc, ptr);
+ return rsdScriptGetAllocationForPointer(rsc, sc, ptr);
}
static void SC_ForEach_SAA(Script *target,