am 7da0abc5: am 62472581: Merge "cherrypick from master - add overview description for RS API reference Change-Id: Id5554c607ad4c435f92bfa939e4ce4833a638f62" into ics-mr1
* commit '7da0abc52e3cbdeeb7fae0d22895710254ef9ec4':
cherrypick from master - add overview description for RS API reference Change-Id: Id5554c607ad4c435f92bfa939e4ce4833a638f62
diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp
index 2ebfe0a..1f70e66 100644
--- a/driver/rsdAllocation.cpp
+++ b/driver/rsdAllocation.cpp
@@ -172,7 +172,7 @@
if (!drv->renderTargetID) {
// This should generally not happen
- LOGE("allocateRenderTarget failed to gen mRenderTargetID");
+ ALOGE("allocateRenderTarget failed to gen mRenderTargetID");
rsc->dumpDebug();
return;
}
@@ -195,7 +195,7 @@
RSD_CALL_GL(glGenBuffers, 1, &drv->bufferID);
}
if (!drv->bufferID) {
- LOGE("Upload to buffer object failed");
+ ALOGE("Upload to buffer object failed");
drv->uploadDeferred = true;
return;
}
@@ -256,7 +256,7 @@
if (drv->bufferID) {
// Causes a SW crash....
- //LOGV(" mBufferID %i", mBufferID);
+ //ALOGV(" mBufferID %i", mBufferID);
//glDeleteBuffers(1, &mBufferID);
//mBufferID = 0;
}
@@ -460,7 +460,7 @@
uint8_t *srcPtr = getOffsetPtr(srcAlloc, srcXoff, srcYoff + i, srcLod, srcFace);
memcpy(dstPtr, srcPtr, w * elementSize);
- //LOGE("COPIED dstXoff(%u), dstYoff(%u), dstLod(%u), dstFace(%u), w(%u), h(%u), srcXoff(%u), srcYoff(%u), srcLod(%u), srcFace(%u)",
+ //ALOGE("COPIED dstXoff(%u), dstYoff(%u), dstLod(%u), dstFace(%u), w(%u), h(%u), srcXoff(%u), srcYoff(%u), srcLod(%u), srcFace(%u)",
// dstXoff, dstYoff, dstLod, dstFace, w, h, srcXoff, srcYoff, srcLod, srcFace);
}
}
diff --git a/driver/rsdBcc.cpp b/driver/rsdBcc.cpp
index 4ecf8e8..24bb288 100644
--- a/driver/rsdBcc.cpp
+++ b/driver/rsdBcc.cpp
@@ -69,10 +69,10 @@
uint8_t const *bitcode,
size_t bitcodeSize,
uint32_t flags) {
- //LOGE("rsdScriptCreate %p %p %p %p %i %i %p", rsc, resName, cacheDir, bitcode, bitcodeSize, flags, lookupFunc);
+ //ALOGE("rsdScriptCreate %p %p %p %p %i %i %p", rsc, resName, cacheDir, bitcode, bitcodeSize, flags, lookupFunc);
pthread_mutex_lock(&rsdgInitMutex);
- char *cachePath = NULL;
+
size_t exportFuncCount = 0;
size_t exportVarCount = 0;
size_t objectSlotCount = 0;
@@ -93,14 +93,14 @@
drv->ME = new bcinfo::MetadataExtractor((const char*)drv->mScriptText,
drv->mScriptTextLength);
if (!drv->ME->extract()) {
- LOGE("bcinfo: failed to read script metadata");
+ ALOGE("bcinfo: failed to read script metadata");
goto error;
}
- //LOGE("mBccScript %p", script->mBccScript);
+ //ALOGE("mBccScript %p", script->mBccScript);
if (bccRegisterSymbolCallback(drv->mBccScript, &rsdLookupRuntimeStub, script) != 0) {
- LOGE("bcc: FAILS to register symbol callback");
+ ALOGE("bcc: FAILS to register symbol callback");
goto error;
}
@@ -108,22 +108,20 @@
resName,
(char const *)drv->mScriptText,
drv->mScriptTextLength, 0) != 0) {
- LOGE("bcc: FAILS to read bitcode");
+ ALOGE("bcc: FAILS to read bitcode");
goto error;
}
if (bccLinkFile(drv->mBccScript, "/system/lib/libclcore.bc", 0) != 0) {
- LOGE("bcc: FAILS to link bitcode");
+ ALOGE("bcc: FAILS to link bitcode");
goto error;
}
if (bccPrepareExecutable(drv->mBccScript, cacheDir, resName, 0) != 0) {
- LOGE("bcc: FAILS to prepare executable");
+ ALOGE("bcc: FAILS to prepare executable");
goto error;
}
- free(cachePath);
-
drv->mRoot = reinterpret_cast<int (*)()>(bccGetFuncAddr(drv->mBccScript, "root"));
drv->mInit = reinterpret_cast<void (*)()>(bccGetFuncAddr(drv->mBccScript, "init"));
drv->mFreeChildren = reinterpret_cast<void (*)()>(bccGetFuncAddr(drv->mBccScript, ".rs.dtor"));
@@ -236,8 +234,8 @@
return;
}
- //LOGE("usr idx %i, x %i,%i y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd);
- //LOGE("usr ptr in %p, out %p", mtls->ptrIn, mtls->ptrOut);
+ //ALOGE("usr idx %i, x %i,%i y %i,%i", idx, mtls->xStart, mtls->xEnd, yStart, yEnd);
+ //ALOGE("usr ptr in %p, out %p", mtls->ptrIn, mtls->ptrOut);
for (p.y = yStart; p.y < yEnd; p.y++) {
uint32_t offset = mtls->dimX * p.y;
p.out = mtls->ptrOut + (mtls->eStrideOut * offset);
@@ -267,8 +265,8 @@
return;
}
- //LOGE("usr slice %i idx %i, x %i,%i", slice, idx, xStart, xEnd);
- //LOGE("usr ptr in %p, out %p", mtls->ptrIn, mtls->ptrOut);
+ //ALOGE("usr slice %i idx %i, x %i,%i", slice, idx, xStart, xEnd);
+ //ALOGE("usr ptr in %p, out %p", mtls->ptrIn, mtls->ptrOut);
p.out = mtls->ptrOut + (mtls->eStrideOut * xStart);
p.in = mtls->ptrIn + (mtls->eStrideIn * xStart);
@@ -374,7 +372,7 @@
rsdLaunchThreads(mrsc, wc_x, &mtls);
}
- //LOGE("launch 1");
+ //ALOGE("launch 1");
} else {
RsForEachStubParamStruct p;
memset(&p, 0, sizeof(p));
@@ -382,7 +380,7 @@
p.usr_len = mtls.usrLen;
uint32_t sig = mtls.sig;
- //LOGE("launch 3");
+ //ALOGE("launch 3");
outer_foreach_t fn = dc->mForEachLaunch[sig];
for (p.ar[0] = mtls.arrayStart; p.ar[0] < mtls.arrayEnd; p.ar[0]++) {
for (p.z = mtls.zStart; p.z < mtls.zEnd; p.z++) {
@@ -434,7 +432,7 @@
const void *params,
size_t paramLength) {
DrvScript *drv = (DrvScript *)script->mHal.drv;
- //LOGE("invoke %p %p %i %p %i", dc, script, slot, params, paramLength);
+ //ALOGE("invoke %p %p %i %p %i", dc, script, slot, params, paramLength);
Script * oldTLS = setTLS(script);
((void (*)(const void *, uint32_t))
@@ -446,11 +444,11 @@
uint32_t slot, void *data, size_t dataLength) {
DrvScript *drv = (DrvScript *)script->mHal.drv;
//rsAssert(!script->mFieldIsObject[slot]);
- //LOGE("setGlobalVar %p %p %i %p %i", dc, script, slot, data, dataLength);
+ //ALOGE("setGlobalVar %p %p %i %p %i", dc, script, slot, data, dataLength);
int32_t *destPtr = ((int32_t **)drv->mFieldAddress)[slot];
if (!destPtr) {
- //LOGV("Calling setVar on slot = %i which is null", slot);
+ //ALOGV("Calling setVar on slot = %i which is null", slot);
return;
}
@@ -460,11 +458,11 @@
void rsdScriptSetGlobalBind(const Context *dc, const Script *script, uint32_t slot, void *data) {
DrvScript *drv = (DrvScript *)script->mHal.drv;
//rsAssert(!script->mFieldIsObject[slot]);
- //LOGE("setGlobalBind %p %p %i %p", dc, script, slot, data);
+ //ALOGE("setGlobalBind %p %p %i %p", dc, script, slot, data);
int32_t *destPtr = ((int32_t **)drv->mFieldAddress)[slot];
if (!destPtr) {
- //LOGV("Calling setVar on slot = %i which is null", slot);
+ //ALOGV("Calling setVar on slot = %i which is null", slot);
return;
}
@@ -474,11 +472,11 @@
void rsdScriptSetGlobalObj(const Context *dc, const Script *script, uint32_t slot, ObjectBase *data) {
DrvScript *drv = (DrvScript *)script->mHal.drv;
//rsAssert(script->mFieldIsObject[slot]);
- //LOGE("setGlobalObj %p %p %i %p", dc, script, slot, data);
+ //ALOGE("setGlobalObj %p %p %i %p", dc, script, slot, data);
int32_t *destPtr = ((int32_t **)drv->mFieldAddress)[slot];
if (!destPtr) {
- //LOGV("Calling setVar on slot = %i which is null", slot);
+ //ALOGV("Calling setVar on slot = %i which is null", slot);
return;
}
diff --git a/driver/rsdCore.cpp b/driver/rsdCore.cpp
index 247f4dc..b514e21 100644
--- a/driver/rsdCore.cpp
+++ b/driver/rsdCore.cpp
@@ -139,14 +139,14 @@
uint32_t idx = (uint32_t)android_atomic_inc(&dc->mWorkers.mLaunchCount);
- //LOGV("RS helperThread starting %p idx=%i", rsc, idx);
+ //ALOGV("RS helperThread starting %p idx=%i", rsc, idx);
dc->mWorkers.mLaunchSignals[idx].init();
dc->mWorkers.mNativeThreadId[idx] = gettid();
int status = pthread_setspecific(rsdgThreadTLSKey, &dc->mTlsStruct);
if (status) {
- LOGE("pthread_setspecific %i", status);
+ ALOGE("pthread_setspecific %i", status);
}
#if 0
@@ -156,7 +156,7 @@
cpuset.bits[idx / 64] |= 1ULL << (idx % 64);
int ret = syscall(241, rsc->mWorkers.mNativeThreadId[idx],
sizeof(cpuset), &cpuset);
- LOGE("SETAFFINITY ret = %i %s", ret, EGLUtils::strerror(ret));
+ ALOGE("SETAFFINITY ret = %i %s", ret, EGLUtils::strerror(ret));
#endif
while (!dc->mExit) {
@@ -168,7 +168,7 @@
dc->mWorkers.mCompleteSignal.set();
}
- //LOGV("RS helperThread exited %p idx=%i", rsc, idx);
+ //ALOGV("RS helperThread exited %p idx=%i", rsc, idx);
return NULL;
}
@@ -191,7 +191,7 @@
RsdHal *dc = (RsdHal *)calloc(1, sizeof(RsdHal));
if (!dc) {
- LOGE("Calloc for driver hal failed.");
+ ALOGE("Calloc for driver hal failed.");
return false;
}
rsc->mHal.drv = dc;
@@ -200,7 +200,7 @@
if (!rsdgThreadTLSKeyCount) {
int status = pthread_key_create(&rsdgThreadTLSKey, NULL);
if (status) {
- LOGE("Failed to init thread tls key.");
+ ALOGE("Failed to init thread tls key.");
pthread_mutex_unlock(&rsdgInitMutex);
return false;
}
@@ -214,12 +214,12 @@
dc->mTlsStruct.mScript = NULL;
int status = pthread_setspecific(rsdgThreadTLSKey, &dc->mTlsStruct);
if (status) {
- LOGE("pthread_setspecific %i", status);
+ ALOGE("pthread_setspecific %i", status);
}
int cpu = sysconf(_SC_NPROCESSORS_ONLN);
- LOGV("%p Launching thread(s), CPUs %i", rsc, cpu);
+ ALOGV("%p Launching thread(s), CPUs %i", rsc, cpu);
if (cpu < 2) cpu = 0;
dc->mWorkers.mCount = (uint32_t)cpu;
@@ -236,7 +236,7 @@
pthread_attr_t threadAttr;
status = pthread_attr_init(&threadAttr);
if (status) {
- LOGE("Failed to init thread attribute.");
+ ALOGE("Failed to init thread attribute.");
return false;
}
@@ -244,7 +244,7 @@
status = pthread_create(&dc->mWorkers.mThreadId[ct], &threadAttr, HelperThreadProc, rsc);
if (status) {
dc->mWorkers.mCount = ct;
- LOGE("Created fewer than expected number of RS threads.");
+ ALOGE("Created fewer than expected number of RS threads.");
break;
}
}
diff --git a/driver/rsdGL.cpp b/driver/rsdGL.cpp
index 98d9486..b53a68c 100644
--- a/driver/rsdGL.cpp
+++ b/driver/rsdGL.cpp
@@ -101,27 +101,27 @@
EGLint value = -1;
EGLBoolean returnVal = eglGetConfigAttrib(dpy, config, names[j].attribute, &value);
if (returnVal) {
- LOGV(" %s: %d (0x%x)", names[j].name, value, value);
+ ALOGV(" %s: %d (0x%x)", names[j].name, value, value);
}
}
}
static void DumpDebug(RsdHal *dc) {
- LOGE(" EGL ver %i %i", dc->gl.egl.majorVersion, dc->gl.egl.minorVersion);
- LOGE(" EGL context %p surface %p, Display=%p", dc->gl.egl.context, dc->gl.egl.surface,
+ ALOGE(" EGL ver %i %i", dc->gl.egl.majorVersion, dc->gl.egl.minorVersion);
+ ALOGE(" EGL context %p surface %p, Display=%p", dc->gl.egl.context, dc->gl.egl.surface,
dc->gl.egl.display);
- LOGE(" GL vendor: %s", dc->gl.gl.vendor);
- LOGE(" GL renderer: %s", dc->gl.gl.renderer);
- LOGE(" GL Version: %s", dc->gl.gl.version);
- LOGE(" GL Extensions: %s", dc->gl.gl.extensions);
- LOGE(" GL int Versions %i %i", dc->gl.gl.majorVersion, dc->gl.gl.minorVersion);
+ ALOGE(" GL vendor: %s", dc->gl.gl.vendor);
+ ALOGE(" GL renderer: %s", dc->gl.gl.renderer);
+ ALOGE(" GL Version: %s", dc->gl.gl.version);
+ ALOGE(" GL Extensions: %s", dc->gl.gl.extensions);
+ ALOGE(" GL int Versions %i %i", dc->gl.gl.majorVersion, dc->gl.gl.minorVersion);
- LOGV("MAX Textures %i, %i %i", dc->gl.gl.maxVertexTextureUnits,
+ ALOGV("MAX Textures %i, %i %i", dc->gl.gl.maxVertexTextureUnits,
dc->gl.gl.maxFragmentTextureImageUnits, dc->gl.gl.maxTextureImageUnits);
- LOGV("MAX Attribs %i", dc->gl.gl.maxVertexAttribs);
- LOGV("MAX Uniforms %i, %i", dc->gl.gl.maxVertexUniformVectors,
+ ALOGV("MAX Attribs %i", dc->gl.gl.maxVertexAttribs);
+ ALOGV("MAX Uniforms %i, %i", dc->gl.gl.maxVertexUniformVectors,
dc->gl.gl.maxFragmentUniformVectors);
- LOGV("MAX Varyings %i", dc->gl.gl.maxVaryingVectors);
+ ALOGV("MAX Varyings %i", dc->gl.gl.maxVaryingVectors);
}
void rsdGLShutdown(const Context *rsc) {
@@ -199,7 +199,7 @@
configAttribsPtr[0] = EGL_NONE;
rsAssert(configAttribsPtr < (configAttribs + (sizeof(configAttribs) / sizeof(EGLint))));
- LOGV("%p initEGL start", rsc);
+ ALOGV("%p initEGL start", rsc);
rsc->setWatchdogGL("eglGetDisplay", __LINE__, __FILE__);
dc->gl.egl.display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
checkEglError("eglGetDisplay");
@@ -223,7 +223,7 @@
configAttribs, configs, numConfigs, &n);
if (!ret || !n) {
checkEglError("eglChooseConfig", ret);
- LOGE("%p, couldn't find an EGLConfig matching the screen format\n", rsc);
+ ALOGE("%p, couldn't find an EGLConfig matching the screen format\n", rsc);
}
// The first config is guaranteed to over-satisfy the constraints
@@ -268,7 +268,7 @@
EGL_NO_CONTEXT, context_attribs2);
checkEglError("eglCreateContext");
if (dc->gl.egl.context == EGL_NO_CONTEXT) {
- LOGE("%p, eglCreateContext returned EGL_NO_CONTEXT", rsc);
+ ALOGE("%p, eglCreateContext returned EGL_NO_CONTEXT", rsc);
rsc->setWatchdogGL(NULL, 0, NULL);
return false;
}
@@ -281,7 +281,7 @@
pbuffer_attribs);
checkEglError("eglCreatePbufferSurface");
if (dc->gl.egl.surfaceDefault == EGL_NO_SURFACE) {
- LOGE("eglCreatePbufferSurface returned EGL_NO_SURFACE");
+ ALOGE("eglCreatePbufferSurface returned EGL_NO_SURFACE");
rsdGLShutdown(rsc);
rsc->setWatchdogGL(NULL, 0, NULL);
return false;
@@ -291,7 +291,7 @@
ret = eglMakeCurrent(dc->gl.egl.display, dc->gl.egl.surfaceDefault,
dc->gl.egl.surfaceDefault, dc->gl.egl.context);
if (ret == EGL_FALSE) {
- LOGE("eglMakeCurrent returned EGL_FALSE");
+ ALOGE("eglMakeCurrent returned EGL_FALSE");
checkEglError("eglMakeCurrent", ret);
rsdGLShutdown(rsc);
rsc->setWatchdogGL(NULL, 0, NULL);
@@ -303,11 +303,11 @@
dc->gl.gl.renderer = glGetString(GL_RENDERER);
dc->gl.gl.extensions = glGetString(GL_EXTENSIONS);
- //LOGV("EGL Version %i %i", mEGL.mMajorVersion, mEGL.mMinorVersion);
- //LOGV("GL Version %s", mGL.mVersion);
- //LOGV("GL Vendor %s", mGL.mVendor);
- //LOGV("GL Renderer %s", mGL.mRenderer);
- //LOGV("GL Extensions %s", mGL.mExtensions);
+ //ALOGV("EGL Version %i %i", mEGL.mMajorVersion, mEGL.mMinorVersion);
+ //ALOGV("GL Version %s", mGL.mVersion);
+ //ALOGV("GL Vendor %s", mGL.mVendor);
+ //ALOGV("GL Renderer %s", mGL.mRenderer);
+ //ALOGV("GL Extensions %s", mGL.mExtensions);
const char *verptr = NULL;
if (strlen((const char *)dc->gl.gl.version) > 9) {
@@ -320,7 +320,7 @@
}
if (!verptr) {
- LOGE("Error, OpenGL ES Lite not supported");
+ ALOGE("Error, OpenGL ES Lite not supported");
rsdGLShutdown(rsc);
rsc->setWatchdogGL(NULL, 0, NULL);
return false;
@@ -360,7 +360,7 @@
dc->gl.vertexArrayState->init(dc->gl.gl.maxVertexAttribs);
dc->gl.currentFrameBuffer = NULL;
- LOGV("%p initGLThread end", rsc);
+ ALOGV("%p initGLThread end", rsc);
rsc->setWatchdogGL(NULL, 0, NULL);
return true;
}
@@ -402,7 +402,7 @@
dc->gl.wndSurface, NULL);
checkEglError("eglCreateWindowSurface");
if (dc->gl.egl.surface == EGL_NO_SURFACE) {
- LOGE("eglCreateWindowSurface returned EGL_NO_SURFACE");
+ ALOGE("eglCreateWindowSurface returned EGL_NO_SURFACE");
}
rsc->setWatchdogGL("eglMakeCurrent", __LINE__, __FILE__);
@@ -439,7 +439,7 @@
}
}
- LOGE("%p, %s", rsc, buf);
+ ALOGE("%p, %s", rsc, buf);
}
}
diff --git a/driver/rsdMeshObj.cpp b/driver/rsdMeshObj.cpp
index 24a7183..99d79dc 100644
--- a/driver/rsdMeshObj.cpp
+++ b/driver/rsdMeshObj.cpp
@@ -133,7 +133,7 @@
void RsdMeshObj::renderPrimitiveRange(const Context *rsc, uint32_t primIndex,
uint32_t start, uint32_t len) const {
if (len < 1 || primIndex >= mRSMesh->mHal.state.primitivesCount || mAttribCount == 0) {
- LOGE("Invalid mesh or parameters");
+ ALOGE("Invalid mesh or parameters");
return;
}
diff --git a/driver/rsdProgram.cpp b/driver/rsdProgram.cpp
index 7556e50..54484df 100644
--- a/driver/rsdProgram.cpp
+++ b/driver/rsdProgram.cpp
@@ -68,7 +68,7 @@
if(pv->mHal.drv) {
drv = (RsdShader*)pv->mHal.drv;
if (rsc->props.mLogShaders) {
- LOGV("Destroying vertex shader with ID %u", drv->getShaderID());
+ ALOGV("Destroying vertex shader with ID %u", drv->getShaderID());
}
if (drv->getShaderID()) {
dc->gl.shaderCache->cleanupVertex(drv->getShaderID());
@@ -99,7 +99,7 @@
if(pf->mHal.drv) {
drv = (RsdShader*)pf->mHal.drv;
if (rsc->props.mLogShaders) {
- LOGV("Destroying fragment shader with ID %u", drv->getShaderID());
+ ALOGV("Destroying fragment shader with ID %u", drv->getShaderID());
}
if (drv->getShaderID()) {
dc->gl.shaderCache->cleanupFragment(drv->getShaderID());
diff --git a/driver/rsdProgramStore.cpp b/driver/rsdProgramStore.cpp
index af44b02..fca9ba9 100644
--- a/driver/rsdProgramStore.cpp
+++ b/driver/rsdProgramStore.cpp
@@ -70,7 +70,7 @@
drv->depthFunc = GL_NOTEQUAL;
break;
default:
- LOGE("Unknown depth function.");
+ ALOGE("Unknown depth function.");
goto error;
}
@@ -111,7 +111,7 @@
drv->blendSrc = GL_SRC_ALPHA_SATURATE;
break;
default:
- LOGE("Unknown blend src mode.");
+ ALOGE("Unknown blend src mode.");
goto error;
}
@@ -141,7 +141,7 @@
drv->blendDst = GL_ONE_MINUS_DST_ALPHA;
break;
default:
- LOGE("Unknown blend dst mode.");
+ ALOGE("Unknown blend dst mode.");
goto error;
}
diff --git a/driver/rsdRuntimeMath.cpp b/driver/rsdRuntimeMath.cpp
index d29da7e..e315539 100644
--- a/driver/rsdRuntimeMath.cpp
+++ b/driver/rsdRuntimeMath.cpp
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+#include <cutils/compiler.h>
+
#include "rsContext.h"
#include "rsScriptC.h"
#include "rsMatrix4x4.h"
@@ -120,7 +122,7 @@
}
static float SC_mix_f32(float start, float stop, float amount) {
- //LOGE("lerpf %f %f %f", start, stop, amount);
+ //ALOGE("lerpf %f %f %f", start, stop, amount);
return start + (stop - start) * amount;
}
@@ -306,7 +308,7 @@
do {
prev = *ptr;
status = android_atomic_release_cas(prev, prev - value, ptr);
- } while (__builtin_expect(status != 0, 0));
+ } while (CC_UNLIKELY(status != 0));
return prev;
}
@@ -323,7 +325,7 @@
do {
prev = *ptr;
status = android_atomic_release_cas(prev, prev ^ value, ptr);
- } while (__builtin_expect(status != 0, 0));
+ } while (CC_UNLIKELY(status != 0));
return prev;
}
@@ -333,7 +335,7 @@
prev = *ptr;
int32_t n = rsMin(value, prev);
status = android_atomic_release_cas(prev, n, ptr);
- } while (__builtin_expect(status != 0, 0));
+ } while (CC_UNLIKELY(status != 0));
return prev;
}
@@ -343,7 +345,7 @@
prev = *ptr;
int32_t n = rsMax(value, prev);
status = android_atomic_release_cas(prev, n, ptr);
- } while (__builtin_expect(status != 0, 0));
+ } while (CC_UNLIKELY(status != 0));
return prev;
}
diff --git a/driver/rsdRuntimeStubs.cpp b/driver/rsdRuntimeStubs.cpp
index 90c8928..14c2970 100644
--- a/driver/rsdRuntimeStubs.cpp
+++ b/driver/rsdRuntimeStubs.cpp
@@ -439,51 +439,51 @@
}
static void SC_debugF(const char *s, float f) {
- LOGD("%s %f, 0x%08x", s, f, *((int *) (&f)));
+ ALOGD("%s %f, 0x%08x", s, f, *((int *) (&f)));
}
static void SC_debugFv2(const char *s, float f1, float f2) {
- LOGD("%s {%f, %f}", s, f1, f2);
+ ALOGD("%s {%f, %f}", s, f1, f2);
}
static void SC_debugFv3(const char *s, float f1, float f2, float f3) {
- LOGD("%s {%f, %f, %f}", s, f1, f2, f3);
+ ALOGD("%s {%f, %f, %f}", s, f1, f2, f3);
}
static void SC_debugFv4(const char *s, float f1, float f2, float f3, float f4) {
- LOGD("%s {%f, %f, %f, %f}", s, f1, f2, f3, f4);
+ ALOGD("%s {%f, %f, %f, %f}", s, f1, f2, f3, f4);
}
static void SC_debugD(const char *s, double d) {
- LOGD("%s %f, 0x%08llx", s, d, *((long long *) (&d)));
+ ALOGD("%s %f, 0x%08llx", s, d, *((long long *) (&d)));
}
static void SC_debugFM4v4(const char *s, const float *f) {
- LOGD("%s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]);
- LOGD("%s %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]);
- LOGD("%s %f, %f, %f, %f", s, f[2], f[6], f[10], f[14]);
- LOGD("%s %f, %f, %f, %f}", s, f[3], f[7], f[11], f[15]);
+ ALOGD("%s {%f, %f, %f, %f", s, f[0], f[4], f[8], f[12]);
+ ALOGD("%s %f, %f, %f, %f", s, f[1], f[5], f[9], f[13]);
+ ALOGD("%s %f, %f, %f, %f", s, f[2], f[6], f[10], f[14]);
+ ALOGD("%s %f, %f, %f, %f}", s, f[3], f[7], f[11], f[15]);
}
static void SC_debugFM3v3(const char *s, const float *f) {
- LOGD("%s {%f, %f, %f", s, f[0], f[3], f[6]);
- LOGD("%s %f, %f, %f", s, f[1], f[4], f[7]);
- LOGD("%s %f, %f, %f}",s, f[2], f[5], f[8]);
+ ALOGD("%s {%f, %f, %f", s, f[0], f[3], f[6]);
+ ALOGD("%s %f, %f, %f", s, f[1], f[4], f[7]);
+ ALOGD("%s %f, %f, %f}",s, f[2], f[5], f[8]);
}
static void SC_debugFM2v2(const char *s, const float *f) {
- LOGD("%s {%f, %f", s, f[0], f[2]);
- LOGD("%s %f, %f}",s, f[1], f[3]);
+ ALOGD("%s {%f, %f", s, f[0], f[2]);
+ ALOGD("%s %f, %f}",s, f[1], f[3]);
}
static void SC_debugI32(const char *s, int32_t i) {
- LOGD("%s %i 0x%x", s, i, i);
+ ALOGD("%s %i 0x%x", s, i, i);
}
static void SC_debugU32(const char *s, uint32_t i) {
- LOGD("%s %u 0x%x", s, i, i);
+ ALOGD("%s %u 0x%x", s, i, i);
}
static void SC_debugLL64(const char *s, long long ll) {
- LOGD("%s %lld 0x%llx", s, ll, ll);
+ ALOGD("%s %lld 0x%llx", s, ll, ll);
}
static void SC_debugULL64(const char *s, unsigned long long ll) {
- LOGD("%s %llu 0x%llx", s, ll, ll);
+ ALOGD("%s %llu 0x%llx", s, ll, ll);
}
static void SC_debugP(const char *s, const void *p) {
- LOGD("%s %p", s, p);
+ ALOGD("%s %p", s, p);
}
@@ -686,7 +686,7 @@
s->mHal.info.isThreadable &= sym->threadable;
return sym->mPtr;
}
- LOGE("ScriptC sym lookup failed for %s", name);
+ ALOGE("ScriptC sym lookup failed for %s", name);
return NULL;
}
diff --git a/driver/rsdShader.cpp b/driver/rsdShader.cpp
index bdb60c2..a10deb4 100644
--- a/driver/rsdShader.cpp
+++ b/driver/rsdShader.cpp
@@ -172,8 +172,8 @@
rsAssert(mShaderID);
if (rsc->props.mLogShaders) {
- LOGV("Loading shader type %x, ID %i", mType, mShaderID);
- LOGV("%s", mShader.string());
+ ALOGV("Loading shader type %x, ID %i", mType, mShaderID);
+ ALOGV("%s", mShader.string());
}
if (mShaderID) {
@@ -190,7 +190,7 @@
char* buf = (char*) malloc(infoLen);
if (buf) {
RSD_CALL_GL(glGetShaderInfoLog, mShaderID, infoLen, NULL, buf);
- LOGE("Could not compile shader \n%s\n", buf);
+ ALOGE("Could not compile shader \n%s\n", buf);
free(buf);
}
RSD_CALL_GL(glDeleteShader, mShaderID);
@@ -202,7 +202,7 @@
}
if (rsc->props.mLogShaders) {
- LOGV("--Shader load result %x ", glGetError());
+ ALOGV("--Shader load result %x ", glGetError());
}
mIsValid = true;
return true;
@@ -252,44 +252,44 @@
uint32_t elementSize = field->getSizeBytes() / sizeof(float);
for (uint32_t i = 0; i < arraySize; i ++) {
if (arraySize > 1) {
- LOGV("Array Element [%u]", i);
+ ALOGV("Array Element [%u]", i);
}
if (dataType == RS_TYPE_MATRIX_4X4) {
- LOGV("Matrix4x4");
- LOGV("{%f, %f, %f, %f", fd[0], fd[4], fd[8], fd[12]);
- LOGV(" %f, %f, %f, %f", fd[1], fd[5], fd[9], fd[13]);
- LOGV(" %f, %f, %f, %f", fd[2], fd[6], fd[10], fd[14]);
- LOGV(" %f, %f, %f, %f}", fd[3], fd[7], fd[11], fd[15]);
+ ALOGV("Matrix4x4");
+ ALOGV("{%f, %f, %f, %f", fd[0], fd[4], fd[8], fd[12]);
+ ALOGV(" %f, %f, %f, %f", fd[1], fd[5], fd[9], fd[13]);
+ ALOGV(" %f, %f, %f, %f", fd[2], fd[6], fd[10], fd[14]);
+ ALOGV(" %f, %f, %f, %f}", fd[3], fd[7], fd[11], fd[15]);
} else if (dataType == RS_TYPE_MATRIX_3X3) {
- LOGV("Matrix3x3");
- LOGV("{%f, %f, %f", fd[0], fd[3], fd[6]);
- LOGV(" %f, %f, %f", fd[1], fd[4], fd[7]);
- LOGV(" %f, %f, %f}", fd[2], fd[5], fd[8]);
+ ALOGV("Matrix3x3");
+ ALOGV("{%f, %f, %f", fd[0], fd[3], fd[6]);
+ ALOGV(" %f, %f, %f", fd[1], fd[4], fd[7]);
+ ALOGV(" %f, %f, %f}", fd[2], fd[5], fd[8]);
} else if (dataType == RS_TYPE_MATRIX_2X2) {
- LOGV("Matrix2x2");
- LOGV("{%f, %f", fd[0], fd[2]);
- LOGV(" %f, %f}", fd[1], fd[3]);
+ ALOGV("Matrix2x2");
+ ALOGV("{%f, %f", fd[0], fd[2]);
+ ALOGV(" %f, %f}", fd[1], fd[3]);
} else {
switch (field->getComponent().getVectorSize()) {
case 1:
- LOGV("Uniform 1 = %f", fd[0]);
+ ALOGV("Uniform 1 = %f", fd[0]);
break;
case 2:
- LOGV("Uniform 2 = %f %f", fd[0], fd[1]);
+ ALOGV("Uniform 2 = %f %f", fd[0], fd[1]);
break;
case 3:
- LOGV("Uniform 3 = %f %f %f", fd[0], fd[1], fd[2]);
+ ALOGV("Uniform 3 = %f %f %f", fd[0], fd[1], fd[2]);
break;
case 4:
- LOGV("Uniform 4 = %f %f %f %f", fd[0], fd[1], fd[2], fd[3]);
+ ALOGV("Uniform 4 = %f %f %f %f", fd[0], fd[1], fd[2], fd[3]);
break;
default:
rsAssert(0);
}
}
- LOGE("Element size %u data=%p", elementSize, fd);
+ ALOGE("Element size %u data=%p", elementSize, fd);
fd += elementSize;
- LOGE("New data=%p", fd);
+ ALOGE("New data=%p", fd);
}
}
@@ -404,7 +404,7 @@
uint32_t numTexturesToBind = mRSProgram->mHal.state.texturesCount;
uint32_t numTexturesAvailable = dc->gl.gl.maxFragmentTextureImageUnits;
if (numTexturesToBind >= numTexturesAvailable) {
- LOGE("Attempting to bind %u textures on shader id %u, but only %u are available",
+ ALOGE("Attempting to bind %u textures on shader id %u, but only %u are available",
mRSProgram->mHal.state.texturesCount, (uint32_t)this, numTexturesAvailable);
rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind more textuers than available");
numTexturesToBind = numTexturesAvailable;
@@ -422,7 +422,7 @@
DrvAllocation *drvTex = (DrvAllocation *)mRSProgram->mHal.state.textures[ct]->mHal.drv;
if (drvTex->glTarget != GL_TEXTURE_2D && drvTex->glTarget != GL_TEXTURE_CUBE_MAP) {
- LOGE("Attempting to bind unknown texture to shader id %u, texture unit %u", (uint)this, ct);
+ ALOGE("Attempting to bind unknown texture to shader id %u, texture unit %u", (uint)this, ct);
rsc->setError(RS_ERROR_BAD_SHADER, "Non-texture allocation bound to a shader");
}
RSD_CALL_GL(glBindTexture, drvTex->glTarget, drvTex->textureID);
@@ -450,7 +450,7 @@
for (uint32_t ct=0; ct < mRSProgram->mHal.state.constantsCount; ct++) {
Allocation *alloc = mRSProgram->mHal.state.constants[ct];
if (!alloc) {
- LOGE("Attempting to set constants on shader id %u, but alloc at slot %u is not set",
+ ALOGE("Attempting to set constants on shader id %u, but alloc at slot %u is not set",
(uint32_t)this, ct);
rsc->setError(RS_ERROR_BAD_SHADER, "No constant allocation bound");
continue;
@@ -479,7 +479,7 @@
arraySize = sc->fragUniformSize(uidx);
}
if (rsc->props.mLogShadersUniforms) {
- LOGV("Uniform slot=%i, offset=%i, constant=%i, field=%i, uidx=%i, name=%s",
+ ALOGV("Uniform slot=%i, offset=%i, constant=%i, field=%i, uidx=%i, name=%s",
slot, offset, ct, field, uidx, fieldName);
}
uidx ++;
diff --git a/driver/rsdShaderCache.cpp b/driver/rsdShaderCache.cpp
index d11490c..f6236e7 100644
--- a/driver/rsdShaderCache.cpp
+++ b/driver/rsdShaderCache.cpp
@@ -54,7 +54,7 @@
}
if (rsc->props.mLogShaders) {
- LOGV("%s U, %s = %d, arraySize = %d\n", logTag,
+ ALOGV("%s U, %s = %d, arraySize = %d\n", logTag,
prog->getUniformName(ct).string(), data[ct].slot, data[ct].arraySize);
}
}
@@ -119,23 +119,23 @@
if (!vtx->getShaderID() || !frag->getShaderID()) {
return false;
}
- //LOGV("rsdShaderCache lookup vtx %i, frag %i", vtx->getShaderID(), frag->getShaderID());
+ //ALOGV("rsdShaderCache lookup vtx %i, frag %i", vtx->getShaderID(), frag->getShaderID());
uint32_t entryCount = mEntries.size();
for (uint32_t ct = 0; ct < entryCount; ct ++) {
if ((mEntries[ct]->vtx == vtx->getShaderID()) &&
(mEntries[ct]->frag == frag->getShaderID())) {
- //LOGV("SC using program %i", mEntries[ct]->program);
+ //ALOGV("SC using program %i", mEntries[ct]->program);
glUseProgram(mEntries[ct]->program);
mCurrent = mEntries[ct];
- //LOGV("RsdShaderCache hit, using %i", ct);
+ //ALOGV("RsdShaderCache hit, using %i", ct);
rsdGLCheckError(rsc, "RsdShaderCache::link (hit)");
return true;
}
}
- //LOGV("RsdShaderCache miss");
- //LOGE("e0 %x", glGetError());
+ //ALOGV("RsdShaderCache miss");
+ //ALOGE("e0 %x", glGetError());
ProgramEntry *e = new ProgramEntry(vtx->getAttribCount(),
vtx->getUniformCount(),
frag->getUniformCount());
@@ -147,7 +147,7 @@
if (e->program) {
GLuint pgm = e->program;
glAttachShader(pgm, vtx->getShaderID());
- //LOGE("e1 %x", glGetError());
+ //ALOGE("e1 %x", glGetError());
glAttachShader(pgm, frag->getShaderID());
glBindAttribLocation(pgm, 0, "ATTRIB_position");
@@ -155,9 +155,9 @@
glBindAttribLocation(pgm, 2, "ATTRIB_normal");
glBindAttribLocation(pgm, 3, "ATTRIB_texture0");
- //LOGE("e2 %x", glGetError());
+ //ALOGE("e2 %x", glGetError());
glLinkProgram(pgm);
- //LOGE("e3 %x", glGetError());
+ //ALOGE("e3 %x", glGetError());
GLint linkStatus = GL_FALSE;
glGetProgramiv(pgm, GL_LINK_STATUS, &linkStatus);
if (linkStatus != GL_TRUE) {
@@ -167,7 +167,7 @@
char* buf = (char*) malloc(bufLength);
if (buf) {
glGetProgramInfoLog(pgm, bufLength, NULL, buf);
- LOGE("Could not link program:\n%s\n", buf);
+ ALOGE("Could not link program:\n%s\n", buf);
free(buf);
}
}
@@ -180,7 +180,7 @@
e->vtxAttrs[ct].slot = glGetAttribLocation(pgm, vtx->getAttribName(ct));
e->vtxAttrs[ct].name = vtx->getAttribName(ct).string();
if (rsc->props.mLogShaders) {
- LOGV("vtx A %i, %s = %d\n", ct, vtx->getAttribName(ct).string(), e->vtxAttrs[ct].slot);
+ ALOGV("vtx A %i, %s = %d\n", ct, vtx->getAttribName(ct).string(), e->vtxAttrs[ct].slot);
}
}
@@ -205,7 +205,7 @@
glGetActiveUniform(pgm, ct, maxNameLength, &uniformList[ct]->writtenLength,
&uniformList[ct]->arraySize, &uniformList[ct]->type,
uniformList[ct]->name);
- //LOGE("GL UNI idx=%u, arraySize=%u, name=%s", ct,
+ //ALOGE("GL UNI idx=%u, arraySize=%u, name=%s", ct,
// uniformList[ct]->arraySize, uniformList[ct]->name);
}
}
@@ -229,7 +229,7 @@
}
}
- //LOGV("SC made program %i", e->program);
+ //ALOGV("SC made program %i", e->program);
glUseProgram(e->program);
rsdGLCheckError(rsc, "RsdShaderCache::link (miss)");
diff --git a/driver/rsdVertexArray.cpp b/driver/rsdVertexArray.cpp
index 62ec107..1836e67 100644
--- a/driver/rsdVertexArray.cpp
+++ b/driver/rsdVertexArray.cpp
@@ -65,9 +65,9 @@
void RsdVertexArray::logAttrib(uint32_t idx, uint32_t slot) const {
if (idx == 0) {
- LOGV("Starting vertex attribute binding");
+ ALOGV("Starting vertex attribute binding");
}
- LOGV("va %i: slot=%i name=%s buf=%i ptr=%p size=%i type=0x%x stride=0x%x norm=%i offset=0x%x",
+ ALOGV("va %i: slot=%i name=%s buf=%i ptr=%p size=%i type=0x%x stride=0x%x norm=%i offset=0x%x",
idx, slot,
mAttribs[idx].name.string(),
mAttribs[idx].buffer,
diff --git a/rsAdapter.cpp b/rsAdapter.cpp
index 6e8ca70..177fb60 100644
--- a/rsAdapter.cpp
+++ b/rsAdapter.cpp
@@ -140,7 +140,7 @@
rsAssert(mAllocation->getPtr());
rsAssert(mAllocation->getType());
if (mFace != 0 && !mAllocation->getType()->getDimFaces()) {
- LOGE("Adapter wants cubemap face, but allocation has none");
+ ALOGE("Adapter wants cubemap face, but allocation has none");
return NULL;
}
diff --git a/rsAllocation.cpp b/rsAllocation.cpp
index e732630..2773d5c 100644
--- a/rsAllocation.cpp
+++ b/rsAllocation.cpp
@@ -75,7 +75,7 @@
const uint32_t eSize = mHal.state.type->getElementSizeBytes();
if ((count * eSize) != sizeBytes) {
- LOGE("Allocation::subData called with mismatched size expected %i, got %i",
+ ALOGE("Allocation::subData called with mismatched size expected %i, got %i",
(count * eSize), sizeBytes);
mHal.state.type->dumpLOGV("type info");
return;
@@ -90,10 +90,10 @@
const uint32_t eSize = mHal.state.elementSizeBytes;
const uint32_t lineSize = eSize * w;
- //LOGE("data2d %p, %i %i %i %i %i %i %p %i", this, xoff, yoff, lod, face, w, h, data, sizeBytes);
+ //ALOGE("data2d %p, %i %i %i %i %i %i %p %i", this, xoff, yoff, lod, face, w, h, data, sizeBytes);
if ((lineSize * h) != sizeBytes) {
- LOGE("Allocation size mismatch, expected %i, got %i", (lineSize * h), sizeBytes);
+ ALOGE("Allocation size mismatch, expected %i, got %i", (lineSize * h), sizeBytes);
rsAssert(!"Allocation::subData called with mismatched size");
return;
}
@@ -112,20 +112,20 @@
uint32_t eSize = mHal.state.elementSizeBytes;
if (cIdx >= mHal.state.type->getElement()->getFieldCount()) {
- LOGE("Error Allocation::subElementData component %i out of range.", cIdx);
+ ALOGE("Error Allocation::subElementData component %i out of range.", cIdx);
rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
return;
}
if (x >= mHal.state.dimensionX) {
- LOGE("Error Allocation::subElementData X offset %i out of range.", x);
+ ALOGE("Error Allocation::subElementData X offset %i out of range.", x);
rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
return;
}
const Element * e = mHal.state.type->getElement()->getField(cIdx);
if (sizeBytes != e->getSizeBytes()) {
- LOGE("Error Allocation::subElementData data size %i does not match field size %zu.", sizeBytes, e->getSizeBytes());
+ ALOGE("Error Allocation::subElementData data size %i does not match field size %zu.", sizeBytes, e->getSizeBytes());
rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
return;
}
@@ -139,19 +139,19 @@
uint32_t eSize = mHal.state.elementSizeBytes;
if (x >= mHal.state.dimensionX) {
- LOGE("Error Allocation::subElementData X offset %i out of range.", x);
+ ALOGE("Error Allocation::subElementData X offset %i out of range.", x);
rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
return;
}
if (y >= mHal.state.dimensionY) {
- LOGE("Error Allocation::subElementData X offset %i out of range.", x);
+ ALOGE("Error Allocation::subElementData X offset %i out of range.", x);
rsc->setError(RS_ERROR_BAD_VALUE, "subElementData X offset out of range.");
return;
}
if (cIdx >= mHal.state.type->getElement()->getFieldCount()) {
- LOGE("Error Allocation::subElementData component %i out of range.", cIdx);
+ ALOGE("Error Allocation::subElementData component %i out of range.", cIdx);
rsc->setError(RS_ERROR_BAD_VALUE, "subElementData component out of range.");
return;
}
@@ -159,7 +159,7 @@
const Element * e = mHal.state.type->getElement()->getField(cIdx);
if (sizeBytes != e->getSizeBytes()) {
- LOGE("Error Allocation::subElementData data size %i does not match field size %zu.", sizeBytes, e->getSizeBytes());
+ ALOGE("Error Allocation::subElementData data size %i does not match field size %zu.", sizeBytes, e->getSizeBytes());
rsc->setError(RS_ERROR_BAD_VALUE, "subElementData bad size.");
return;
}
@@ -191,10 +191,85 @@
mHal.state.type->dumpLOGV(s.string());
}
- LOGV("%s allocation ptr=%p mUsageFlags=0x04%x, mMipmapControl=0x%04x",
+ ALOGV("%s allocation ptr=%p mUsageFlags=0x04%x, mMipmapControl=0x%04x",
prefix, getPtr(), mHal.state.usageFlags, mHal.state.mipmapControl);
}
+uint32_t Allocation::getPackedSize() const {
+ uint32_t numItems = mHal.state.type->getSizeBytes() / mHal.state.type->getElementSizeBytes();
+ return numItems * mHal.state.type->getElement()->getSizeBytesUnpadded();
+}
+
+void Allocation::writePackedData(const Type *type,
+ uint8_t *dst, const uint8_t *src, bool dstPadded) {
+ const Element *elem = type->getElement();
+ uint32_t unpaddedBytes = elem->getSizeBytesUnpadded();
+ uint32_t paddedBytes = elem->getSizeBytes();
+ uint32_t numItems = type->getSizeBytes() / paddedBytes;
+
+ uint32_t srcInc = !dstPadded ? paddedBytes : unpaddedBytes;
+ uint32_t dstInc = dstPadded ? paddedBytes : unpaddedBytes;
+
+ // no sub-elements
+ uint32_t fieldCount = elem->getFieldCount();
+ if (fieldCount == 0) {
+ for (uint32_t i = 0; i < numItems; i ++) {
+ memcpy(dst, src, unpaddedBytes);
+ src += srcInc;
+ dst += dstInc;
+ }
+ return;
+ }
+
+ // Cache offsets
+ uint32_t *offsetsPadded = new uint32_t[fieldCount];
+ uint32_t *offsetsUnpadded = new uint32_t[fieldCount];
+ uint32_t *sizeUnpadded = new uint32_t[fieldCount];
+
+ for (uint32_t i = 0; i < fieldCount; i++) {
+ offsetsPadded[i] = elem->getFieldOffsetBytes(i);
+ offsetsUnpadded[i] = elem->getFieldOffsetBytesUnpadded(i);
+ sizeUnpadded[i] = elem->getField(i)->getSizeBytesUnpadded();
+ }
+
+ uint32_t *srcOffsets = !dstPadded ? offsetsPadded : offsetsUnpadded;
+ uint32_t *dstOffsets = dstPadded ? offsetsPadded : offsetsUnpadded;
+
+ // complex elements, need to copy subelem after subelem
+ for (uint32_t i = 0; i < numItems; i ++) {
+ for (uint32_t fI = 0; fI < fieldCount; fI++) {
+ memcpy(dst + dstOffsets[fI], src + srcOffsets[fI], sizeUnpadded[fI]);
+ }
+ src += srcInc;
+ dst += dstInc;
+ }
+
+ delete[] offsetsPadded;
+ delete[] offsetsUnpadded;
+ delete[] sizeUnpadded;
+}
+
+void Allocation::unpackVec3Allocation(const void *data, uint32_t dataSize) {
+ const uint8_t *src = (const uint8_t*)data;
+ uint8_t *dst = (uint8_t*)getPtr();
+
+ writePackedData(getType(), dst, src, true);
+}
+
+void Allocation::packVec3Allocation(OStream *stream) const {
+ uint32_t paddedBytes = getType()->getElement()->getSizeBytes();
+ uint32_t unpaddedBytes = getType()->getElement()->getSizeBytesUnpadded();
+ uint32_t numItems = mHal.state.type->getSizeBytes() / paddedBytes;
+
+ const uint8_t *src = (const uint8_t*)getPtr();
+ uint8_t *dst = new uint8_t[numItems * unpaddedBytes];
+
+ writePackedData(getType(), dst, src, false);
+ stream->addByteArray(dst, getPackedSize());
+
+ delete[] dst;
+}
+
void Allocation::serialize(OStream *stream) const {
// Need to identify ourselves
stream->addU32((uint32_t)getClassId());
@@ -207,17 +282,24 @@
mHal.state.type->serialize(stream);
uint32_t dataSize = mHal.state.type->getSizeBytes();
+ // 3 element vectors are padded to 4 in memory, but padding isn't serialized
+ uint32_t packedSize = getPackedSize();
// Write how much data we are storing
- stream->addU32(dataSize);
- // Now write the data
- stream->addByteArray(getPtr(), dataSize);
+ stream->addU32(packedSize);
+ if (dataSize == packedSize) {
+ // Now write the data
+ stream->addByteArray(getPtr(), dataSize);
+ } else {
+ // Now write the data
+ packVec3Allocation(stream);
+ }
}
Allocation *Allocation::createFromStream(Context *rsc, IStream *stream) {
// First make sure we are reading the correct object
RsA3DClassID classID = (RsA3DClassID)stream->loadU32();
if (classID != RS_A3D_CLASS_ID_ALLOCATION) {
- LOGE("allocation loading skipped due to invalid class id\n");
+ ALOGE("allocation loading skipped due to invalid class id\n");
return NULL;
}
@@ -230,22 +312,30 @@
}
type->compute();
+ Allocation *alloc = Allocation::createAllocation(rsc, type, RS_ALLOCATION_USAGE_SCRIPT);
+ type->decUserRef();
+
// Number of bytes we wrote out for this allocation
uint32_t dataSize = stream->loadU32();
- if (dataSize != type->getSizeBytes()) {
- LOGE("failed to read allocation because numbytes written is not the same loaded type wants\n");
+ // 3 element vectors are padded to 4 in memory, but padding isn't serialized
+ uint32_t packedSize = alloc->getPackedSize();
+ if (dataSize != type->getSizeBytes() &&
+ dataSize != packedSize) {
+ ALOGE("failed to read allocation because numbytes written is not the same loaded type wants\n");
+ ObjectBase::checkDelete(alloc);
ObjectBase::checkDelete(type);
return NULL;
}
- Allocation *alloc = Allocation::createAllocation(rsc, type, RS_ALLOCATION_USAGE_SCRIPT);
alloc->setName(name.string(), name.size());
- type->decUserRef();
- uint32_t count = dataSize / type->getElementSizeBytes();
-
- // Read in all of our allocation data
- alloc->data(rsc, 0, 0, count, stream->getPtr() + stream->getPos(), dataSize);
+ if (dataSize == type->getSizeBytes()) {
+ uint32_t count = dataSize / type->getElementSizeBytes();
+ // Read in all of our allocation data
+ alloc->data(rsc, 0, 0, count, stream->getPtr() + stream->getPos(), dataSize);
+ } else {
+ alloc->unpackVec3Allocation(stream->getPtr() + stream->getPos(), dataSize);
+ }
stream->reset(stream->getPos() + dataSize);
return alloc;
@@ -319,7 +409,7 @@
}
void Allocation::resize2D(Context *rsc, uint32_t dimX, uint32_t dimY) {
- LOGE("not implemented");
+ ALOGE("not implemented");
}
/////////////////
@@ -497,7 +587,7 @@
RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mips, usages);
Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc);
if (texAlloc == NULL) {
- LOGE("Memory allocation failure");
+ ALOGE("Memory allocation failure");
return NULL;
}
@@ -521,7 +611,7 @@
RsAllocation vTexAlloc = rsi_AllocationCreateTyped(rsc, vtype, mips, usages);
Allocation *texAlloc = static_cast<Allocation *>(vTexAlloc);
if (texAlloc == NULL) {
- LOGE("Memory allocation failure");
+ ALOGE("Memory allocation failure");
return NULL;
}
diff --git a/rsAllocation.h b/rsAllocation.h
index 714798a..4ce863a 100644
--- a/rsAllocation.h
+++ b/rsAllocation.h
@@ -135,6 +135,11 @@
private:
void freeChildrenUnlocked();
Allocation(Context *rsc, const Type *, uint32_t usages, RsAllocationMipmapControl mc);
+
+ uint32_t getPackedSize() const;
+ static void writePackedData(const Type *type, uint8_t *dst, const uint8_t *src, bool dstPadded);
+ void unpackVec3Allocation(const void *data, uint32_t dataSize);
+ void packVec3Allocation(OStream *stream) const;
};
}
diff --git a/rsAnimation.cpp b/rsAnimation.cpp
index 48b4f02..a4093d9 100644
--- a/rsAnimation.cpp
+++ b/rsAnimation.cpp
@@ -126,7 +126,7 @@
RsAnimationInterpolation interp,
RsAnimationEdge pre,
RsAnimationEdge post) {
- //LOGE("rsi_ElementCreate %i %i %i %i", dt, dk, norm, vecSize);
+ //ALOGE("rsi_ElementCreate %i %i %i %i", dt, dk, norm, vecSize);
Animation *a = NULL;//Animation::create(rsc, inValues, outValues, valueCount, interp, pre, post);
if (a != NULL) {
a->incUserRef();
diff --git a/rsComponent.cpp b/rsComponent.cpp
index ce06306..21b98f6 100644
--- a/rsComponent.cpp
+++ b/rsComponent.cpp
@@ -169,7 +169,8 @@
break;
}
- mBits = mTypeBits * mVectorSize;
+ mBitsUnpadded = mTypeBits * mVectorSize;
+ mBits = mTypeBits * rsHigherPow2(mVectorSize);
}
bool Component::isReference() const {
@@ -228,10 +229,10 @@
void Component::dumpLOGV(const char *prefix) const {
if (mType >= RS_TYPE_ELEMENT) {
- LOGV("%s Component: %s, %s, vectorSize=%i, bits=%i",
+ ALOGV("%s Component: %s, %s, vectorSize=%i, bits=%i",
prefix, gTypeObjStrings[mType - RS_TYPE_ELEMENT], gKindStrings[mKind], mVectorSize, mBits);
} else {
- LOGV("%s Component: %s, %s, vectorSize=%i, bits=%i",
+ ALOGV("%s Component: %s, %s, vectorSize=%i, bits=%i",
prefix, gTypeBasicStrings[mType], gKindStrings[mKind], mVectorSize, mBits);
}
}
diff --git a/rsComponent.h b/rsComponent.h
index 6ddc990..8629d0d 100644
--- a/rsComponent.h
+++ b/rsComponent.h
@@ -41,6 +41,7 @@
bool getIsFloat() const {return mIsFloat;}
bool getIsSigned() const {return mIsSigned;}
uint32_t getBits() const {return mBits;}
+ uint32_t getBitsUnpadded() const {return mBitsUnpadded;}
// Helpers for reading / writing this class out
void serialize(OStream *stream) const;
@@ -56,6 +57,7 @@
// derived
uint32_t mBits;
+ uint32_t mBitsUnpadded;
uint32_t mTypeBits;
bool mIsFloat;
bool mIsSigned;
diff --git a/rsContext.cpp b/rsContext.cpp
index 5291a1f..ad2ff0f 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -40,7 +40,7 @@
if (!mHal.funcs.initGraphics(this)) {
pthread_mutex_unlock(&gInitMutex);
- LOGE("%p initGraphics failed", this);
+ ALOGE("%p initGraphics failed", this);
return false;
}
@@ -152,7 +152,7 @@
if (props.mLogTimes) {
- LOGV("RS: Frame (%i), Script %2.1f%% (%i), Swap %2.1f%% (%i), Idle %2.1f%% (%lli), Internal %2.1f%% (%lli), Avg fps: %u",
+ ALOGV("RS: Frame (%i), Script %2.1f%% (%i), Swap %2.1f%% (%i), Idle %2.1f%% (%lli), Internal %2.1f%% (%lli), Avg fps: %u",
mTimeMSLastFrame,
100.0 * mTimers[RS_TIMER_SCRIPT] / total, mTimeMSLastScript,
100.0 * mTimers[RS_TIMER_CLEAR_SWAP] / total, mTimeMSLastSwap,
@@ -219,7 +219,7 @@
if (!rsdHalInit(rsc, 0, 0)) {
rsc->setError(RS_ERROR_FATAL_DRIVER, "Failed initializing GL");
- LOGE("Hal init failed");
+ ALOGE("Hal init failed");
return NULL;
}
rsc->mHal.funcs.setPriority(rsc, rsc->mThreadPriority);
@@ -284,7 +284,7 @@
}
}
- LOGV("%p RS Thread exiting", rsc);
+ ALOGV("%p RS Thread exiting", rsc);
if (rsc->mIsGraphicsContext) {
pthread_mutex_lock(&gInitMutex);
@@ -292,12 +292,12 @@
pthread_mutex_unlock(&gInitMutex);
}
- LOGV("%p RS Thread exited", rsc);
+ ALOGV("%p RS Thread exited", rsc);
return NULL;
}
void Context::destroyWorkerThreadResources() {
- //LOGV("destroyWorkerThreadResources 1");
+ //ALOGV("destroyWorkerThreadResources 1");
ObjectBase::zeroAllUserRef(this);
if (mIsGraphicsContext) {
mRaster.clear();
@@ -315,17 +315,17 @@
mFBOCache.deinit(this);
}
ObjectBase::freeAllChildren(this);
- //LOGV("destroyWorkerThreadResources 2");
+ //ALOGV("destroyWorkerThreadResources 2");
mExit = true;
}
void Context::printWatchdogInfo(void *ctx) {
Context *rsc = (Context *)ctx;
if (rsc->watchdog.command && rsc->watchdog.file) {
- LOGE("RS watchdog timeout: %i %s line %i %s", rsc->watchdog.inRoot,
+ ALOGE("RS watchdog timeout: %i %s line %i %s", rsc->watchdog.inRoot,
rsc->watchdog.command, rsc->watchdog.line, rsc->watchdog.file);
} else {
- LOGE("RS watchdog timeout: %i", rsc->watchdog.inRoot);
+ ALOGE("RS watchdog timeout: %i", rsc->watchdog.inRoot);
}
}
@@ -403,7 +403,7 @@
status = pthread_attr_init(&threadAttr);
if (status) {
- LOGE("Failed to init thread attribute.");
+ ALOGE("Failed to init thread attribute.");
return false;
}
@@ -414,7 +414,7 @@
status = pthread_create(&mThreadId, &threadAttr, threadProc, this);
if (status) {
- LOGE("Failed to start rs context thread.");
+ ALOGE("Failed to start rs context thread.");
return false;
}
while (!mRunning && (mError == RS_ERROR_NONE)) {
@@ -422,7 +422,7 @@
}
if (mError != RS_ERROR_NONE) {
- LOGE("Errors during thread init");
+ ALOGE("Errors during thread init");
return false;
}
@@ -431,7 +431,7 @@
}
Context::~Context() {
- LOGV("%p Context::~Context", this);
+ ALOGV("%p Context::~Context", this);
if (!mIsContextLite) {
mIO.coreFlush();
@@ -455,7 +455,7 @@
}
pthread_mutex_unlock(&gInitMutex);
}
- LOGV("%p Context::~Context done", this);
+ ALOGV("%p Context::~Context done", this);
}
void Context::setSurface(uint32_t w, uint32_t h, RsNativeWindow sur) {
@@ -472,6 +472,30 @@
}
}
+uint32_t Context::getCurrentSurfaceWidth() const {
+ for (uint32_t i = 0; i < mFBOCache.mHal.state.colorTargetsCount; i ++) {
+ if (mFBOCache.mHal.state.colorTargets[i] != NULL) {
+ return mFBOCache.mHal.state.colorTargets[i]->getType()->getDimX();
+ }
+ }
+ if (mFBOCache.mHal.state.depthTarget != NULL) {
+ return mFBOCache.mHal.state.depthTarget->getType()->getDimX();
+ }
+ return mWidth;
+}
+
+uint32_t Context::getCurrentSurfaceHeight() const {
+ for (uint32_t i = 0; i < mFBOCache.mHal.state.colorTargetsCount; i ++) {
+ if (mFBOCache.mHal.state.colorTargets[i] != NULL) {
+ return mFBOCache.mHal.state.colorTargets[i]->getType()->getDimY();
+ }
+ }
+ if (mFBOCache.mHal.state.depthTarget != NULL) {
+ return mFBOCache.mHal.state.depthTarget->getType()->getDimY();
+ }
+ return mHeight;
+}
+
void Context::pause() {
rsAssert(mIsGraphicsContext);
mPaused = true;
@@ -578,12 +602,12 @@
void Context::dumpDebug() const {
- LOGE("RS Context debug %p", this);
- LOGE("RS Context debug");
+ ALOGE("RS Context debug %p", this);
+ ALOGE("RS Context debug");
- LOGE(" RS width %i, height %i", mWidth, mHeight);
- LOGE(" RS running %i, exit %i, paused %i", mRunning, mExit, mPaused);
- LOGE(" RS pThreadID %li, nativeThreadID %i", (long int)mThreadId, mNativeThreadId);
+ ALOGE(" RS width %i, height %i", mWidth, mHeight);
+ ALOGE(" RS running %i, exit %i, paused %i", mRunning, mExit, mPaused);
+ ALOGE(" RS pThreadID %li, nativeThreadID %i", (long int)mThreadId, mNativeThreadId);
}
///////////////////////////////////////////////////////////////////////////////////////////
@@ -604,7 +628,7 @@
Sampler *s = static_cast<Sampler *>(vs);
if (slot > RS_MAX_SAMPLER_SLOT) {
- LOGE("Invalid sampler slot");
+ ALOGE("Invalid sampler slot");
return;
}
@@ -672,10 +696,10 @@
}
void rsi_ContextDestroy(Context *rsc) {
- LOGV("%p rsContextDestroy", rsc);
+ ALOGV("%p rsContextDestroy", rsc);
rsContextDestroyWorker(rsc);
delete rsc;
- LOGV("%p rsContextDestroy done", rsc);
+ ALOGV("%p rsContextDestroy done", rsc);
}
@@ -706,7 +730,7 @@
RsContext rsContextCreate(RsDevice vdev, uint32_t version,
uint32_t sdkVersion) {
- LOGV("rsContextCreate dev=%p", vdev);
+ ALOGV("rsContextCreate dev=%p", vdev);
Device * dev = static_cast<Device *>(vdev);
Context *rsc = Context::createContext(dev, NULL);
if (rsc) {
@@ -718,14 +742,14 @@
RsContext rsContextCreateGL(RsDevice vdev, uint32_t version,
uint32_t sdkVersion, RsSurfaceConfig sc,
uint32_t dpi) {
- LOGV("rsContextCreateGL dev=%p", vdev);
+ ALOGV("rsContextCreateGL dev=%p", vdev);
Device * dev = static_cast<Device *>(vdev);
Context *rsc = Context::createContext(dev, &sc);
if (rsc) {
rsc->setTargetSdkVersion(sdkVersion);
rsc->setDPI(dpi);
}
- LOGV("%p rsContextCreateGL ret", rsc);
+ ALOGV("%p rsContextCreateGL ret", rsc);
return rsc;
}
diff --git a/rsContext.h b/rsContext.h
index 199cc5a..61c29f9 100644
--- a/rsContext.h
+++ b/rsContext.h
@@ -50,13 +50,13 @@
#define CHECK_OBJ(o) { \
GET_TLS(); \
if (!ObjectBase::isValid(rsc, (const ObjectBase *)o)) { \
- LOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__); \
+ ALOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__); \
} \
}
#define CHECK_OBJ_OR_NULL(o) { \
GET_TLS(); \
if (o && !ObjectBase::isValid(rsc, (const ObjectBase *)o)) { \
- LOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__); \
+ ALOGE("Bad object %p at %s, %i", o, __FILE__, __LINE__); \
} \
}
#else
@@ -164,6 +164,9 @@
uint32_t getWidth() const {return mWidth;}
uint32_t getHeight() const {return mHeight;}
+ uint32_t getCurrentSurfaceWidth() const;
+ uint32_t getCurrentSurfaceHeight() const;
+
mutable ThreadIO mIO;
// Timers
diff --git a/rsElement.cpp b/rsElement.cpp
index 71e1b91..dff9585 100644
--- a/rsElement.cpp
+++ b/rsElement.cpp
@@ -23,6 +23,7 @@
Element::Element(Context *rsc) : ObjectBase(rsc) {
mBits = 0;
+ mBitsUnpadded = 0;
mFields = NULL;
mFieldCount = 0;
mHasReference = false;
@@ -60,13 +61,25 @@
return total;
}
+size_t Element::getSizeBitsUnpadded() const {
+ if (!mFieldCount) {
+ return mBitsUnpadded;
+ }
+
+ size_t total = 0;
+ for (size_t ct=0; ct < mFieldCount; ct++) {
+ total += mFields[ct].e->mBitsUnpadded * mFields[ct].arraySize;
+ }
+ return total;
+}
+
void Element::dumpLOGV(const char *prefix) const {
ObjectBase::dumpLOGV(prefix);
- LOGV("%s Element: fieldCount: %zu, size bytes: %zu", prefix, mFieldCount, getSizeBytes());
+ ALOGV("%s Element: fieldCount: %zu, size bytes: %zu", prefix, mFieldCount, getSizeBytes());
mComponent.dumpLOGV(prefix);
for (uint32_t ct = 0; ct < mFieldCount; ct++) {
- LOGV("%s Element field index: %u ------------------", prefix, ct);
- LOGV("%s name: %s, offsetBits: %u, arraySize: %u",
+ ALOGV("%s Element field index: %u ------------------", prefix, ct);
+ ALOGV("%s name: %s, offsetBits: %u, arraySize: %u",
prefix, mFields[ct].name.string(), mFields[ct].offsetBits, mFields[ct].arraySize);
mFields[ct].e->dumpLOGV(prefix);
}
@@ -94,7 +107,7 @@
// First make sure we are reading the correct object
RsA3DClassID classID = (RsA3DClassID)stream->loadU32();
if (classID != RS_A3D_CLASS_ID_ELEMENT) {
- LOGE("element loading skipped due to invalid class id\n");
+ ALOGE("element loading skipped due to invalid class id\n");
return NULL;
}
@@ -146,14 +159,18 @@
void Element::compute() {
if (mFieldCount == 0) {
mBits = mComponent.getBits();
+ mBitsUnpadded = mComponent.getBitsUnpadded();
mHasReference = mComponent.isReference();
return;
}
size_t bits = 0;
+ size_t bitsUnpadded = 0;
for (size_t ct=0; ct < mFieldCount; ct++) {
mFields[ct].offsetBits = bits;
+ mFields[ct].offsetBitsUnpadded = bitsUnpadded;
bits += mFields[ct].e->getSizeBits() * mFields[ct].arraySize;
+ bitsUnpadded += mFields[ct].e->getSizeBitsUnpadded() * mFields[ct].arraySize;
if (mFields[ct].e->mHasReference) {
mHasReference = true;
diff --git a/rsElement.h b/rsElement.h
index bfdec53..04010fa 100644
--- a/rsElement.h
+++ b/rsElement.h
@@ -43,6 +43,11 @@
uint32_t getGLType() const;
uint32_t getGLFormat() const;
+ size_t getSizeBitsUnpadded() const;
+ size_t getSizeBytesUnpadded() const {
+ return (getSizeBitsUnpadded() + 7) >> 3;
+ }
+
size_t getSizeBits() const;
size_t getSizeBytes() const {
return (getSizeBits() + 7) >> 3;
@@ -55,6 +60,10 @@
return mFields[componentNumber].offsetBits >> 3;
}
+ size_t getFieldOffsetBytesUnpadded(uint32_t componentNumber) const {
+ return mFields[componentNumber].offsetBitsUnpadded >> 3;
+ }
+
uint32_t getFieldCount() const {return mFieldCount;}
const Element * getField(uint32_t idx) const {return mFields[idx].e.get();}
const char * getFieldName(uint32_t idx) const {return mFields[idx].name.string();}
@@ -64,6 +73,7 @@
RsDataType getType() const {return mComponent.getType();}
RsDataKind getKind() const {return mComponent.getKind();}
uint32_t getBits() const {return mBits;}
+ uint32_t getBitsUnpadded() const {return mBitsUnpadded;}
void dumpLOGV(const char *prefix) const;
virtual void serialize(OStream *stream) const;
@@ -112,6 +122,7 @@
String8 name;
ObjectBaseRef<const Element> e;
uint32_t offsetBits;
+ uint32_t offsetBitsUnpadded;
uint32_t arraySize;
} ElementField_t;
ElementField_t *mFields;
@@ -123,6 +134,7 @@
Element(Context *);
Component mComponent;
+ uint32_t mBitsUnpadded;
uint32_t mBits;
void compute();
diff --git a/rsFBOCache.cpp b/rsFBOCache.cpp
index f4a8bc6..d50f3e0 100644
--- a/rsFBOCache.cpp
+++ b/rsFBOCache.cpp
@@ -46,12 +46,12 @@
void FBOCache::bindColorTarget(Context *rsc, Allocation *a, uint32_t slot) {
if (slot >= mHal.state.colorTargetsCount) {
- LOGE("Invalid render target index");
+ ALOGE("Invalid render target index");
return;
}
if (a != NULL) {
if (!a->getIsTexture()) {
- LOGE("Invalid Color Target");
+ ALOGE("Invalid Color Target");
return;
}
}
@@ -63,7 +63,7 @@
void FBOCache::bindDepthTarget(Context *rsc, Allocation *a) {
if (a != NULL) {
if (!a->getIsRenderTarget()) {
- LOGE("Invalid Depth Target");
+ ALOGE("Invalid Depth Target");
return;
}
}
diff --git a/rsFifoSocket.cpp b/rsFifoSocket.cpp
index 8b8008d..163a44b 100644
--- a/rsFifoSocket.cpp
+++ b/rsFifoSocket.cpp
@@ -48,31 +48,31 @@
if (bytes == 0) {
return;
}
- //LOGE("writeAsync %p %i", data, bytes);
+ //ALOGE("writeAsync %p %i", data, bytes);
size_t ret = ::send(sv[0], data, bytes, 0);
- //LOGE("writeAsync ret %i", ret);
+ //ALOGE("writeAsync ret %i", ret);
rsAssert(ret == bytes);
}
void FifoSocket::writeWaitReturn(void *retData, size_t retBytes) {
- //LOGE("writeWaitReturn %p %i", retData, retBytes);
+ //ALOGE("writeWaitReturn %p %i", retData, retBytes);
size_t ret = ::recv(sv[0], retData, retBytes, 0);
- //LOGE("writeWaitReturn %i", ret);
+ //ALOGE("writeWaitReturn %i", ret);
rsAssert(ret == retBytes);
}
size_t FifoSocket::read(void *data, size_t bytes) {
- //LOGE("read %p %i", data, bytes);
+ //ALOGE("read %p %i", data, bytes);
size_t ret = ::recv(sv[1], data, bytes, 0);
rsAssert(ret == bytes);
- //LOGE("read ret %i", ret);
+ //ALOGE("read ret %i", ret);
return ret;
}
void FifoSocket::readReturn(const void *data, size_t bytes) {
- LOGE("readReturn %p %Zu", data, bytes);
+ ALOGE("readReturn %p %Zu", data, bytes);
size_t ret = ::send(sv[1], data, bytes, 0);
- LOGE("readReturn %Zu", ret);
+ ALOGE("readReturn %Zu", ret);
rsAssert(ret == bytes);
}
diff --git a/rsFileA3D.cpp b/rsFileA3D.cpp
index df5dc12..ac658c8 100644
--- a/rsFileA3D.cpp
+++ b/rsFileA3D.cpp
@@ -68,7 +68,7 @@
for (uint32_t i = 0; i < numIndexEntries; i ++) {
A3DIndexEntry *entry = new A3DIndexEntry();
headerStream->loadString(&entry->mObjectName);
- //LOGV("Header data, entry name = %s", entry->mObjectName.string());
+ //ALOGV("Header data, entry name = %s", entry->mObjectName.string());
entry->mType = (RsA3DClassID)headerStream->loadU32();
if (mUse64BitOffsets){
entry->mOffset = headerStream->loadOffset();
@@ -145,7 +145,7 @@
char magicString[12];
size_t len;
- LOGV("file open 1");
+ ALOGV("file open 1");
len = fread(magicString, 1, 12, f);
if ((len != 12) ||
memcmp(magicString, "Android3D_ff", 12)) {
@@ -181,7 +181,7 @@
return false;
}
- LOGV("file open size = %lli", mDataSize);
+ ALOGV("file open size = %lli", mDataSize);
// We should know enough to read the file in at this point.
mAlloc = malloc(mDataSize);
@@ -196,7 +196,7 @@
mReadStream = new IStream(mData, mUse64BitOffsets);
- LOGV("Header is read an stream initialized");
+ ALOGV("Header is read an stream initialized");
return true;
}
@@ -278,17 +278,17 @@
bool FileA3D::writeFile(const char *filename) {
if (!mWriteStream) {
- LOGE("No objects to write\n");
+ ALOGE("No objects to write\n");
return false;
}
if (mWriteStream->getPos() == 0) {
- LOGE("No objects to write\n");
+ ALOGE("No objects to write\n");
return false;
}
FILE *writeHandle = fopen(filename, "wb");
if (!writeHandle) {
- LOGE("Couldn't open the file for writing\n");
+ ALOGE("Couldn't open the file for writing\n");
return false;
}
@@ -335,7 +335,7 @@
int status = fclose(writeHandle);
if (status != 0) {
- LOGE("Couldn't close file\n");
+ ALOGE("Couldn't close file\n");
return false;
}
@@ -364,12 +364,12 @@
RsObjectBase rsaFileA3DGetEntryByIndex(RsContext con, uint32_t index, RsFile file) {
FileA3D *fa3d = static_cast<FileA3D *>(file);
if (!fa3d) {
- LOGE("Can't load entry. No valid file");
+ ALOGE("Can't load entry. No valid file");
return NULL;
}
ObjectBase *obj = fa3d->initializeFromEntry(index);
- //LOGV("Returning object with name %s", obj->getName());
+ //ALOGV("Returning object with name %s", obj->getName());
return obj;
}
@@ -389,13 +389,13 @@
FileA3D *fa3d = static_cast<FileA3D *>(file);
if (!fa3d) {
- LOGE("Can't load index entries. No valid file");
+ ALOGE("Can't load index entries. No valid file");
return;
}
uint32_t numFileEntries = fa3d->getNumIndexEntries();
if (numFileEntries != numEntries || numEntries == 0 || fileEntries == NULL) {
- LOGE("Can't load index entries. Invalid number requested");
+ ALOGE("Can't load index entries. Invalid number requested");
return;
}
@@ -408,7 +408,7 @@
RsFile rsaFileA3DCreateFromMemory(RsContext con, const void *data, uint32_t len) {
if (data == NULL) {
- LOGE("File load failed. Asset stream is NULL");
+ ALOGE("File load failed. Asset stream is NULL");
return NULL;
}
@@ -432,7 +432,7 @@
RsFile rsaFileA3DCreateFromFile(RsContext con, const char *path) {
if (path == NULL) {
- LOGE("File load failed. Path is NULL");
+ ALOGE("File load failed. Path is NULL");
return NULL;
}
@@ -446,7 +446,7 @@
fa3d->load(f);
fclose(f);
} else {
- LOGE("Could not open file %s", path);
+ ALOGE("Could not open file %s", path);
}
return fa3d;
diff --git a/rsFont.cpp b/rsFont.cpp
index 7efed9d..4f21b3b 100644
--- a/rsFont.cpp
+++ b/rsFont.cpp
@@ -39,7 +39,7 @@
bool Font::init(const char *name, float fontSize, uint32_t dpi, const void *data, uint32_t dataLen) {
#ifndef ANDROID_RS_SERIALIZE
if (mInitialized) {
- LOGE("Reinitialization of fonts not supported");
+ ALOGE("Reinitialization of fonts not supported");
return false;
}
@@ -51,7 +51,7 @@
}
if (error) {
- LOGE("Unable to initialize font %s", name);
+ ALOGE("Unable to initialize font %s", name);
return false;
}
@@ -61,7 +61,7 @@
error = FT_Set_Char_Size(mFace, (FT_F26Dot6)(fontSize * 64.0f), 0, dpi, 0);
if (error) {
- LOGE("Unable to set font size on %s", name);
+ ALOGE("Unable to set font size on %s", name);
return false;
}
@@ -124,7 +124,7 @@
for (cacheX = glyph->mBitmapMinX, bX = nPenX; cacheX < endX; cacheX++, bX++) {
for (cacheY = glyph->mBitmapMinY, bY = nPenY; cacheY < endY; cacheY++, bY++) {
if (bX < 0 || bY < 0 || bX >= (int32_t) bitmapW || bY >= (int32_t) bitmapH) {
- LOGE("Skipping invalid index");
+ ALOGE("Skipping invalid index");
continue;
}
uint8_t tempCol = cacheBuffer[cacheY * cacheWidth + cacheX];
@@ -165,7 +165,7 @@
if (mode == Font::MEASURE) {
if (bounds == NULL) {
- LOGE("No return rectangle provided to measure text");
+ ALOGE("No return rectangle provided to measure text");
return;
}
// Reset min and max of the bounding box to something large
@@ -237,7 +237,7 @@
#ifndef ANDROID_RS_SERIALIZE
FT_Error error = FT_Load_Glyph( mFace, glyph->mGlyphIndex, FT_LOAD_RENDER );
if (error) {
- LOGE("Couldn't load glyph.");
+ ALOGE("Couldn't load glyph.");
return;
}
@@ -378,7 +378,7 @@
if (!mLibrary) {
FT_Error error = FT_Init_FreeType(&mLibrary);
if (error) {
- LOGE("Unable to initialize freetype");
+ ALOGE("Unable to initialize freetype");
return NULL;
}
}
@@ -409,7 +409,7 @@
bool FontState::cacheBitmap(FT_Bitmap *bitmap, uint32_t *retOriginX, uint32_t *retOriginY) {
// If the glyph is too tall, don't cache it
if ((uint32_t)bitmap->rows > mCacheLines[mCacheLines.size()-1]->mMaxHeight) {
- LOGE("Font size to large to fit in cache. width, height = %i, %i", (int)bitmap->width, (int)bitmap->rows);
+ ALOGE("Font size to large to fit in cache. width, height = %i, %i", (int)bitmap->width, (int)bitmap->rows);
return false;
}
@@ -439,7 +439,7 @@
// if we still don't fit, something is wrong and we shouldn't draw
if (!bitmapFit) {
- LOGE("Bitmap doesn't fit in cache. width, height = %i, %i", (int)bitmap->width, (int)bitmap->rows);
+ ALOGE("Bitmap doesn't fit in cache. width, height = %i, %i", (int)bitmap->width, (int)bitmap->rows);
return false;
}
}
@@ -471,7 +471,7 @@
// Some debug code
/*for (uint32_t i = 0; i < mCacheLines.size(); i ++) {
- LOGE("Cache Line: H: %u Empty Space: %f",
+ ALOGE("Cache Line: H: %u Empty Space: %f",
mCacheLines[i]->mMaxHeight,
(1.0f - (float)mCacheLines[i]->mCurrentCol/(float)mCacheLines[i]->mMaxWidth)*100.0f);
@@ -651,43 +651,43 @@
float x4, float y4, float z4,
float u4, float v4) {
const uint32_t vertsPerQuad = 4;
- const uint32_t floatsPerVert = 5;
+ const uint32_t floatsPerVert = 6;
float *currentPos = mTextMeshPtr + mCurrentQuadIndex * vertsPerQuad * floatsPerVert;
- // Cull things that are off the screen
- float width = (float)mRSC->getWidth();
- float height = (float)mRSC->getHeight();
-
- if (x1 > width || y1 < 0.0f || x2 < 0 || y4 > height) {
+ if (x1 > mSurfaceWidth || y1 < 0.0f || x2 < 0 || y4 > mSurfaceHeight) {
return;
}
/*LOGE("V0 x: %f y: %f z: %f", x1, y1, z1);
- LOGE("V1 x: %f y: %f z: %f", x2, y2, z2);
- LOGE("V2 x: %f y: %f z: %f", x3, y3, z3);
- LOGE("V3 x: %f y: %f z: %f", x4, y4, z4);*/
+ ALOGE("V1 x: %f y: %f z: %f", x2, y2, z2);
+ ALOGE("V2 x: %f y: %f z: %f", x3, y3, z3);
+ ALOGE("V3 x: %f y: %f z: %f", x4, y4, z4);*/
(*currentPos++) = x1;
(*currentPos++) = y1;
(*currentPos++) = z1;
+ (*currentPos++) = 0;
(*currentPos++) = u1;
(*currentPos++) = v1;
(*currentPos++) = x2;
(*currentPos++) = y2;
(*currentPos++) = z2;
+ (*currentPos++) = 0;
(*currentPos++) = u2;
(*currentPos++) = v2;
(*currentPos++) = x3;
(*currentPos++) = y3;
(*currentPos++) = z3;
+ (*currentPos++) = 0;
(*currentPos++) = u3;
(*currentPos++) = v3;
(*currentPos++) = x4;
(*currentPos++) = y4;
(*currentPos++) = z4;
+ (*currentPos++) = 0;
(*currentPos++) = u4;
(*currentPos++) = v4;
@@ -742,10 +742,14 @@
currentFont = mDefault.get();
}
if (!currentFont) {
- LOGE("Unable to initialize any fonts");
+ ALOGE("Unable to initialize any fonts");
return;
}
+ // Cull things that are off the screen
+ mSurfaceWidth = (float)mRSC->getCurrentSurfaceWidth();
+ mSurfaceHeight = (float)mRSC->getCurrentSurfaceHeight();
+
currentFont->renderUTF(text, len, x, y, startIndex, numGlyphs,
mode, bounds, bitmap, bitmapW, bitmapH);
diff --git a/rsFont.h b/rsFont.h
index 679591c..4ca794d 100644
--- a/rsFont.h
+++ b/rsFont.h
@@ -160,6 +160,9 @@
protected:
+ float mSurfaceWidth;
+ float mSurfaceHeight;
+
friend class Font;
struct CacheTextureLine {
diff --git a/rsLocklessFifo.cpp b/rsLocklessFifo.cpp
index 8879805..0466d8b 100644
--- a/rsLocklessFifo.cpp
+++ b/rsLocklessFifo.cpp
@@ -45,12 +45,12 @@
// Add room for a buffer reset command
mBuffer = static_cast<uint8_t *>(malloc(sizeInBytes + 4));
if (!mBuffer) {
- LOGE("LocklessFifo allocation failure");
+ ALOGE("LocklessFifo allocation failure");
return false;
}
if (!mSignalToControl.init() || !mSignalToWorker.init()) {
- LOGE("Signal setup failed");
+ ALOGE("Signal setup failed");
free(mBuffer);
return false;
}
@@ -231,7 +231,7 @@
}
void LocklessCommandFifo::dumpState(const char *s) const {
- LOGV("%s %p put %p, get %p, buf %p, end %p", s, this, mPut, mGet, mBuffer, mEnd);
+ ALOGV("%s %p put %p, get %p, buf %p, end %p", s, this, mPut, mGet, mBuffer, mEnd);
}
void LocklessCommandFifo::printDebugData() const {
@@ -244,7 +244,7 @@
for (int ct=0; ct < 16; ct++) {
- LOGV("fifo %p = 0x%08x 0x%08x 0x%08x 0x%08x", pptr, pptr[0], pptr[1], pptr[2], pptr[3]);
+ ALOGV("fifo %p = 0x%08x 0x%08x 0x%08x 0x%08x", pptr, pptr[0], pptr[1], pptr[2], pptr[3]);
pptr += 4;
}
diff --git a/rsMatrix4x4.cpp b/rsMatrix4x4.cpp
index f34af47..c6f96d8 100644
--- a/rsMatrix4x4.cpp
+++ b/rsMatrix4x4.cpp
@@ -307,8 +307,8 @@
}
void Matrix4x4::logv(const char *s) const {
- LOGV("%s {%f, %f, %f, %f", s, m[0], m[4], m[8], m[12]);
- LOGV("%s %f, %f, %f, %f", s, m[1], m[5], m[9], m[13]);
- LOGV("%s %f, %f, %f, %f", s, m[2], m[6], m[10], m[14]);
- LOGV("%s %f, %f, %f, %f}", s, m[3], m[7], m[11], m[15]);
+ ALOGV("%s {%f, %f, %f, %f", s, m[0], m[4], m[8], m[12]);
+ ALOGV("%s %f, %f, %f, %f", s, m[1], m[5], m[9], m[13]);
+ ALOGV("%s %f, %f, %f, %f", s, m[2], m[6], m[10], m[14]);
+ ALOGV("%s %f, %f, %f, %f}", s, m[3], m[7], m[11], m[15]);
}
diff --git a/rsMesh.cpp b/rsMesh.cpp
index bf9284f..67c7299 100644
--- a/rsMesh.cpp
+++ b/rsMesh.cpp
@@ -107,7 +107,7 @@
// First make sure we are reading the correct object
RsA3DClassID classID = (RsA3DClassID)stream->loadU32();
if (classID != RS_A3D_CLASS_ID_MESH) {
- LOGE("mesh loading skipped due to invalid class id");
+ ALOGE("mesh loading skipped due to invalid class id");
return NULL;
}
@@ -178,7 +178,7 @@
void Mesh::renderPrimitive(Context *rsc, uint32_t primIndex) const {
if (primIndex >= mHal.state.primitivesCount) {
- LOGE("Invalid primitive index");
+ ALOGE("Invalid primitive index");
return;
}
@@ -192,7 +192,7 @@
void Mesh::renderPrimitiveRange(Context *rsc, uint32_t primIndex, uint32_t start, uint32_t len) const {
if (len < 1 || primIndex >= mHal.state.primitivesCount) {
- LOGE("Invalid mesh or parameters");
+ ALOGE("Invalid mesh or parameters");
return;
}
@@ -241,7 +241,7 @@
mBBoxMin[0] = mBBoxMin[1] = mBBoxMin[2] = 1e6;
mBBoxMax[0] = mBBoxMax[1] = mBBoxMax[2] = -1e6;
if (!posPtr) {
- LOGE("Unable to compute bounding box");
+ ALOGE("Unable to compute bounding box");
mBBoxMin[0] = mBBoxMin[1] = mBBoxMin[2] = 0.0f;
mBBoxMax[0] = mBBoxMax[1] = mBBoxMax[2] = 0.0f;
return;
diff --git a/rsMutex.cpp b/rsMutex.cpp
index 2105288..6512372 100644
--- a/rsMutex.cpp
+++ b/rsMutex.cpp
@@ -30,7 +30,7 @@
bool Mutex::init() {
int status = pthread_mutex_init(&mMutex, NULL);
if (status) {
- LOGE("Mutex::Mutex init failure");
+ ALOGE("Mutex::Mutex init failure");
return false;
}
return true;
@@ -40,7 +40,7 @@
int status;
status = pthread_mutex_lock(&mMutex);
if (status) {
- LOGE("Mutex: error %i locking.", status);
+ ALOGE("Mutex: error %i locking.", status);
return false;
}
return true;
@@ -50,7 +50,7 @@
int status;
status = pthread_mutex_unlock(&mMutex);
if (status) {
- LOGE("Mutex error %i unlocking.", status);
+ ALOGE("Mutex error %i unlocking.", status);
return false;
}
return true;
diff --git a/rsObjectBase.cpp b/rsObjectBase.cpp
index f5ced26..6a64582 100644
--- a/rsObjectBase.cpp
+++ b/rsObjectBase.cpp
@@ -35,11 +35,11 @@
rsAssert(rsc);
add();
- //LOGV("ObjectBase %p con", this);
+ //ALOGV("ObjectBase %p con", this);
}
ObjectBase::~ObjectBase() {
- //LOGV("~ObjectBase %p ref %i,%i", this, mUserRefCount, mSysRefCount);
+ //ALOGV("~ObjectBase %p ref %i,%i", this, mUserRefCount, mSysRefCount);
#if RS_OBJECT_DEBUG
mStack.dump();
#endif
@@ -60,22 +60,22 @@
void ObjectBase::dumpLOGV(const char *op) const {
if (mName.size()) {
- LOGV("%s RSobj %p, name %s, refs %i,%i links %p,%p,%p",
+ ALOGV("%s RSobj %p, name %s, refs %i,%i links %p,%p,%p",
op, this, mName.string(), mUserRefCount, mSysRefCount, mNext, mPrev, mRSC);
} else {
- LOGV("%s RSobj %p, no-name, refs %i,%i links %p,%p,%p",
+ ALOGV("%s RSobj %p, no-name, refs %i,%i links %p,%p,%p",
op, this, mUserRefCount, mSysRefCount, mNext, mPrev, mRSC);
}
}
void ObjectBase::incUserRef() const {
android_atomic_inc(&mUserRefCount);
- //LOGV("ObjectBase %p incU ref %i, %i", this, mUserRefCount, mSysRefCount);
+ //ALOGV("ObjectBase %p incU ref %i, %i", this, mUserRefCount, mSysRefCount);
}
void ObjectBase::incSysRef() const {
android_atomic_inc(&mSysRefCount);
- //LOGV("ObjectBase %p incS ref %i, %i", this, mUserRefCount, mSysRefCount);
+ //ALOGV("ObjectBase %p incS ref %i, %i", this, mUserRefCount, mSysRefCount);
}
void ObjectBase::preDestroy() const {
@@ -111,7 +111,7 @@
bool ObjectBase::decUserRef() const {
rsAssert(mUserRefCount > 0);
#if RS_OBJECT_DEBUG
- LOGV("ObjectBase %p decU ref %i, %i", this, mUserRefCount, mSysRefCount);
+ ALOGV("ObjectBase %p decU ref %i, %i", this, mUserRefCount, mSysRefCount);
if (mUserRefCount <= 0) {
mStack.dump();
}
@@ -126,7 +126,7 @@
}
bool ObjectBase::zeroUserRef() const {
- //LOGV("ObjectBase %p zeroU ref %i, %i", this, mUserRefCount, mSysRefCount);
+ //ALOGV("ObjectBase %p zeroU ref %i, %i", this, mUserRefCount, mSysRefCount);
android_atomic_acquire_store(0, &mUserRefCount);
if (android_atomic_acquire_load(&mSysRefCount) <= 0) {
return checkDelete(this);
@@ -135,7 +135,7 @@
}
bool ObjectBase::decSysRef() const {
- //LOGV("ObjectBase %p decS ref %i, %i", this, mUserRefCount, mSysRefCount);
+ //ALOGV("ObjectBase %p decS ref %i, %i", this, mUserRefCount, mSysRefCount);
rsAssert(mSysRefCount > 0);
if ((android_atomic_dec(&mSysRefCount) <= 1) &&
(android_atomic_acquire_load(&mUserRefCount) <= 0)) {
@@ -165,7 +165,7 @@
rsAssert(!mNext);
rsAssert(!mPrev);
- //LOGV("calling add rsc %p", mRSC);
+ //ALOGV("calling add rsc %p", mRSC);
mNext = mRSC->mObjHead;
if (mRSC->mObjHead) {
mRSC->mObjHead->mPrev = this;
@@ -176,7 +176,7 @@
}
void ObjectBase::remove() const {
- //LOGV("calling remove rsc %p", mRSC);
+ //ALOGV("calling remove rsc %p", mRSC);
if (!mRSC) {
rsAssert(!mPrev);
rsAssert(!mNext);
@@ -198,32 +198,32 @@
void ObjectBase::zeroAllUserRef(Context *rsc) {
if (rsc->props.mLogObjects) {
- LOGV("Forcing release of all outstanding user refs.");
+ ALOGV("Forcing release of all outstanding user refs.");
}
// This operation can be slow, only to be called during context cleanup.
const ObjectBase * o = rsc->mObjHead;
while (o) {
- //LOGE("o %p", o);
+ //ALOGE("o %p", o);
if (o->zeroUserRef()) {
// deleted the object and possibly others, restart from head.
o = rsc->mObjHead;
- //LOGE("o head %p", o);
+ //ALOGE("o head %p", o);
} else {
o = o->mNext;
- //LOGE("o next %p", o);
+ //ALOGE("o next %p", o);
}
}
if (rsc->props.mLogObjects) {
- LOGV("Objects remaining.");
+ ALOGV("Objects remaining.");
dumpAll(rsc);
}
}
void ObjectBase::freeAllChildren(Context *rsc) {
if (rsc->props.mLogObjects) {
- LOGV("Forcing release of all child objects.");
+ ALOGV("Forcing release of all child objects.");
}
// This operation can be slow, only to be called during context cleanup.
@@ -238,7 +238,7 @@
}
if (rsc->props.mLogObjects) {
- LOGV("Objects remaining.");
+ ALOGV("Objects remaining.");
dumpAll(rsc);
}
}
@@ -246,10 +246,10 @@
void ObjectBase::dumpAll(Context *rsc) {
asyncLock();
- LOGV("Dumping all objects");
+ ALOGV("Dumping all objects");
const ObjectBase * o = rsc->mObjHead;
while (o) {
- LOGV(" Object %p", o);
+ ALOGV(" Object %p", o);
o->dumpLOGV(" ");
o = o->mNext;
}
diff --git a/rsProgram.cpp b/rsProgram.cpp
index a9fd877..8061515 100644
--- a/rsProgram.cpp
+++ b/rsProgram.cpp
@@ -139,13 +139,13 @@
void Program::bindAllocation(Context *rsc, Allocation *alloc, uint32_t slot) {
if (alloc != NULL) {
if (slot >= mHal.state.constantsCount) {
- LOGE("Attempt to bind alloc at slot %u, on shader id %u, but const count is %u",
+ ALOGE("Attempt to bind alloc at slot %u, on shader id %u, but const count is %u",
slot, (uint32_t)this, mHal.state.constantsCount);
rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind allocation");
return;
}
if (alloc->getType() != mConstantTypes[slot].get()) {
- LOGE("Attempt to bind alloc at slot %u, on shader id %u, but types mismatch",
+ ALOGE("Attempt to bind alloc at slot %u, on shader id %u, but types mismatch",
slot, (uint32_t)this);
rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind allocation");
return;
@@ -167,13 +167,13 @@
void Program::bindTexture(Context *rsc, uint32_t slot, Allocation *a) {
if (slot >= mHal.state.texturesCount) {
- LOGE("Attempt to bind texture to slot %u but tex count is %u", slot, mHal.state.texturesCount);
+ ALOGE("Attempt to bind texture to slot %u but tex count is %u", slot, mHal.state.texturesCount);
rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind texture");
return;
}
if (a && a->getType()->getDimFaces() && mHal.state.textureTargets[slot] != RS_TEXTURE_CUBE) {
- LOGE("Attempt to bind cubemap to slot %u but 2d texture needed", slot);
+ ALOGE("Attempt to bind cubemap to slot %u but 2d texture needed", slot);
rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind cubemap to 2d texture slot");
return;
}
@@ -186,7 +186,7 @@
void Program::bindSampler(Context *rsc, uint32_t slot, Sampler *s) {
if (slot >= mHal.state.texturesCount) {
- LOGE("Attempt to bind sampler to slot %u but tex count is %u", slot, mHal.state.texturesCount);
+ ALOGE("Attempt to bind sampler to slot %u but tex count is %u", slot, mHal.state.texturesCount);
rsc->setError(RS_ERROR_BAD_SHADER, "Cannot bind sampler");
return;
}
diff --git a/rsProgramFragment.cpp b/rsProgramFragment.cpp
index 81eedc4..4e73ca6 100644
--- a/rsProgramFragment.cpp
+++ b/rsProgramFragment.cpp
@@ -38,12 +38,12 @@
void ProgramFragment::setConstantColor(Context *rsc, float r, float g, float b, float a) {
if (isUserProgram()) {
- LOGE("Attempting to set fixed function emulation color on user program");
+ ALOGE("Attempting to set fixed function emulation color on user program");
rsc->setError(RS_ERROR_BAD_SHADER, "Cannot set fixed function emulation color on user program");
return;
}
if (mHal.state.constants[0] == NULL) {
- LOGE("Unable to set fixed function emulation color because allocation is missing");
+ ALOGE("Unable to set fixed function emulation color because allocation is missing");
rsc->setError(RS_ERROR_BAD_SHADER, "Unable to set fixed function emulation color because allocation is missing");
return;
}
@@ -63,7 +63,7 @@
for (uint32_t ct=0; ct < mHal.state.texturesCount; ct++) {
if (!mHal.state.textures[ct]) {
- LOGE("No texture bound for shader id %u, texture unit %u", (uint)this, ct);
+ ALOGE("No texture bound for shader id %u, texture unit %u", (uint)this, ct);
rsc->setError(RS_ERROR_BAD_SHADER, "No texture bound");
continue;
}
@@ -131,7 +131,7 @@
size_t paramLength) {
ProgramFragment *pf = new ProgramFragment(rsc, shaderText, shaderLength, params, paramLength);
pf->incUserRef();
- //LOGE("rsi_ProgramFragmentCreate %p", pf);
+ //ALOGE("rsi_ProgramFragmentCreate %p", pf);
return pf;
}
diff --git a/rsProgramVertex.cpp b/rsProgramVertex.cpp
index 4a13622..871caac 100644
--- a/rsProgramVertex.cpp
+++ b/rsProgramVertex.cpp
@@ -206,8 +206,11 @@
void ProgramVertexState::updateSize(Context *rsc) {
float *f = static_cast<float *>(mDefaultAlloc->getPtr());
+ float surfaceWidth = (float)rsc->getCurrentSurfaceWidth();
+ float surfaceHeight = (float)rsc->getCurrentSurfaceHeight();
+
Matrix4x4 m;
- m.loadOrtho(0,rsc->getWidth(), rsc->getHeight(),0, -1,1);
+ m.loadOrtho(0, surfaceWidth, surfaceHeight, 0, -1, 1);
memcpy(&f[RS_PROGRAM_VERTEX_PROJECTION_OFFSET], m.m, sizeof(m));
memcpy(&f[RS_PROGRAM_VERTEX_MVP_OFFSET], m.m, sizeof(m));
diff --git a/rsScript.cpp b/rsScript.cpp
index 93513fe..357dbe3 100644
--- a/rsScript.cpp
+++ b/rsScript.cpp
@@ -15,6 +15,7 @@
*/
#include "rsContext.h"
+#include <time.h>
using namespace android;
using namespace android::renderscript;
@@ -25,6 +26,7 @@
mSlots = NULL;
mTypes = NULL;
+ mInitialized = false;
}
Script::~Script() {
@@ -39,9 +41,9 @@
}
void Script::setSlot(uint32_t slot, Allocation *a) {
- //LOGE("setSlot %i %p", slot, a);
+ //ALOGE("setSlot %i %p", slot, a);
if (slot >= mHal.info.exportedVariableCount) {
- LOGE("Script::setSlot unable to set allocation, invalid slot index");
+ ALOGE("Script::setSlot unable to set allocation, invalid slot index");
return;
}
@@ -54,21 +56,21 @@
}
void Script::setVar(uint32_t slot, const void *val, size_t len) {
- //LOGE("setVar %i %p %i", slot, val, len);
+ //ALOGE("setVar %i %p %i", slot, val, len);
if (slot >= mHal.info.exportedVariableCount) {
- LOGE("Script::setVar unable to set allocation, invalid slot index");
+ ALOGE("Script::setVar unable to set allocation, invalid slot index");
return;
}
mRSC->mHal.funcs.script.setGlobalVar(mRSC, this, slot, (void *)val, len);
}
void Script::setVarObj(uint32_t slot, ObjectBase *val) {
- //LOGE("setVarObj %i %p", slot, val);
+ //ALOGE("setVarObj %i %p", slot, val);
if (slot >= mHal.info.exportedVariableCount) {
- LOGE("Script::setVarObj unable to set allocation, invalid slot index");
+ ALOGE("Script::setVarObj unable to set allocation, invalid slot index");
return;
}
- //LOGE("setvarobj %i %p", slot, val);
+ //ALOGE("setvarobj %i %p", slot, val);
mRSC->mHal.funcs.script.setGlobalObj(mRSC, this, slot, val);
}
@@ -85,12 +87,26 @@
Script *s = static_cast<Script *>(vs);
Allocation *a = static_cast<Allocation *>(va);
s->setSlot(slot, a);
- //LOGE("rsi_ScriptBindAllocation %i %p %p", slot, a, a->getPtr());
+ //ALOGE("rsi_ScriptBindAllocation %i %p %p", slot, a, a->getPtr());
}
void rsi_ScriptSetTimeZone(Context * rsc, RsScript vs, const char * timeZone, size_t length) {
- Script *s = static_cast<Script *>(vs);
- s->mEnviroment.mTimeZone = timeZone;
+ // We unfortunately need to make a new copy of the string, since it is
+ // not NULL-terminated. We then use setenv(), which properly handles
+ // freeing/duplicating the actual string for the environment.
+ char *tz = (char *) malloc(length + 1);
+ if (!tz) {
+ ALOGE("Couldn't allocate memory for timezone buffer");
+ return;
+ }
+ strncpy(tz, timeZone, length);
+ tz[length] = '\0';
+ if (setenv("TZ", tz, 1) == 0) {
+ tzset();
+ } else {
+ ALOGE("Error setting timezone");
+ }
+ free(tz);
}
void rsi_ScriptForEach(Context *rsc, RsScript vs, uint32_t slot,
diff --git a/rsScript.h b/rsScript.h
index d645421..99dceaf 100644
--- a/rsScript.h
+++ b/rsScript.h
@@ -59,7 +59,6 @@
struct Enviroment_t {
int64_t mStartTimeMillis;
int64_t mLastDtTime;
- const char* mTimeZone;
ObjectBaseRef<ProgramVertex> mVertex;
ObjectBaseRef<ProgramFragment> mFragment;
@@ -68,7 +67,6 @@
};
Enviroment_t mEnviroment;
- void initSlots();
void setSlot(uint32_t slot, Allocation *a);
void setVar(uint32_t slot, const void *val, size_t len);
void setVarObj(uint32_t slot, ObjectBase *val);
@@ -86,6 +84,7 @@
virtual void setupScript(Context *rsc) = 0;
virtual uint32_t run(Context *) = 0;
protected:
+ bool mInitialized;
ObjectBaseRef<Allocation> *mSlots;
ObjectBaseRef<const Type> *mTypes;
diff --git a/rsScriptC.cpp b/rsScriptC.cpp
index cd7b3a7..afc8ba0 100644
--- a/rsScriptC.cpp
+++ b/rsScriptC.cpp
@@ -45,8 +45,10 @@
BT = NULL;
}
#endif
- mRSC->mHal.funcs.script.invokeFreeChildren(mRSC, this);
- mRSC->mHal.funcs.script.destroy(mRSC, this);
+ if (mInitialized) {
+ mRSC->mHal.funcs.script.invokeFreeChildren(mRSC, this);
+ mRSC->mHal.funcs.script.destroy(mRSC, this);
+ }
}
void ScriptC::setupScript(Context *rsc) {
@@ -70,7 +72,7 @@
}
const Allocation *ScriptC::ptrToAllocation(const void *ptr) const {
- //LOGE("ptr to alloc %p", ptr);
+ //ALOGE("ptr to alloc %p", ptr);
if (!ptr) {
return NULL;
}
@@ -81,7 +83,7 @@
return mSlots[ct].get();
}
}
- LOGE("ScriptC::ptrToAllocation, failed to find %p", ptr);
+ ALOGE("ScriptC::ptrToAllocation, failed to find %p", ptr);
return NULL;
}
@@ -112,13 +114,13 @@
uint32_t ret = 0;
if (rsc->props.mLogScripts) {
- LOGV("%p ScriptC::run invoking root, ptr %p", rsc, mHal.info.root);
+ ALOGV("%p ScriptC::run invoking root, ptr %p", rsc, mHal.info.root);
}
ret = rsc->mHal.funcs.script.invokeRoot(rsc, this);
if (rsc->props.mLogScripts) {
- LOGV("%p ScriptC::run invoking complete, ret=%i", rsc, ret);
+ ALOGV("%p ScriptC::run invoking complete, ret=%i", rsc, ret);
}
return ret;
@@ -147,7 +149,7 @@
setupScript(rsc);
if (rsc->props.mLogScripts) {
- LOGV("%p ScriptC::Invoke invoking slot %i, ptr %p", rsc, slot, this);
+ ALOGV("%p ScriptC::Invoke invoking slot %i, ptr %p", rsc, slot, this);
}
rsc->mHal.funcs.script.invokeFunction(rsc, this, slot, data, len);
}
@@ -179,7 +181,7 @@
s->mHal.info.isThreadable &= sym->threadable;
return sym->mPtr;
}
- LOGE("ScriptC sym lookup failed for %s", name);
+ ALOGE("ScriptC sym lookup failed for %s", name);
return NULL;
}
*/
@@ -195,12 +197,12 @@
const uint8_t *bitcode,
size_t bitcodeLen) {
- //LOGE("runCompiler %p %p %p %p %p %i", rsc, this, resName, cacheDir, bitcode, bitcodeLen);
+ //ALOGE("runCompiler %p %p %p %p %p %i", rsc, this, resName, cacheDir, bitcode, bitcodeLen);
#ifndef ANDROID_RS_SERIALIZE
uint32_t sdkVersion = 0;
bcinfo::BitcodeWrapper bcWrapper((const char *)bitcode, bitcodeLen);
if (!bcWrapper.unwrap()) {
- LOGE("Bitcode is not in proper container format (raw or wrapper)");
+ ALOGE("Bitcode is not in proper container format (raw or wrapper)");
return false;
}
@@ -221,7 +223,7 @@
BT = new bcinfo::BitcodeTranslator((const char *)bitcode, bitcodeLen,
sdkVersion);
if (!BT->translate()) {
- LOGE("Failed to translate bitcode from version: %u", sdkVersion);
+ ALOGE("Failed to translate bitcode from version: %u", sdkVersion);
delete BT;
BT = NULL;
return false;
@@ -230,8 +232,11 @@
bitcodeLen = BT->getTranslatedBitcodeSize();
#endif
- rsc->mHal.funcs.script.init(rsc, this, resName, cacheDir, bitcode, bitcodeLen, 0);
+ if (!rsc->mHal.funcs.script.init(rsc, this, resName, cacheDir, bitcode, bitcodeLen, 0)) {
+ return false;
+ }
+ mInitialized = true;
mEnviroment.mFragment.set(rsc->getDefaultProgramFragment());
mEnviroment.mVertex.set(rsc->getDefaultProgramVertex());
mEnviroment.mFragmentStore.set(rsc->getDefaultProgramStore());
@@ -242,12 +247,12 @@
for (size_t i=0; i < mHal.info.exportedPragmaCount; ++i) {
const char * key = mHal.info.exportedPragmaKeyList[i];
const char * value = mHal.info.exportedPragmaValueList[i];
- //LOGE("pragma %s %s", keys[i], values[i]);
+ //ALOGE("pragma %s %s", keys[i], values[i]);
if (!strcmp(key, "version")) {
if (!strcmp(value, "1")) {
continue;
}
- LOGE("Invalid version pragma value: %s\n", value);
+ ALOGE("Invalid version pragma value: %s\n", value);
return false;
}
@@ -259,7 +264,7 @@
mEnviroment.mVertex.clear();
continue;
}
- LOGE("Unrecognized value %s passed to stateVertex", value);
+ ALOGE("Unrecognized value %s passed to stateVertex", value);
return false;
}
@@ -271,7 +276,7 @@
mEnviroment.mRaster.clear();
continue;
}
- LOGE("Unrecognized value %s passed to stateRaster", value);
+ ALOGE("Unrecognized value %s passed to stateRaster", value);
return false;
}
@@ -283,7 +288,7 @@
mEnviroment.mFragment.clear();
continue;
}
- LOGE("Unrecognized value %s passed to stateFragment", value);
+ ALOGE("Unrecognized value %s passed to stateFragment", value);
return false;
}
@@ -295,7 +300,7 @@
mEnviroment.mFragmentStore.clear();
continue;
}
- LOGE("Unrecognized value %s passed to stateStore", value);
+ ALOGE("Unrecognized value %s passed to stateStore", value);
return false;
}
}
diff --git a/rsScriptC_Lib.cpp b/rsScriptC_Lib.cpp
index ec15bc0..183e207 100644
--- a/rsScriptC_Lib.cpp
+++ b/rsScriptC_Lib.cpp
@@ -115,7 +115,7 @@
//////////////////////////////////////////////////////////////////////////////
void rsrSetObject(const Context *rsc, const Script *sc, ObjectBase **dst, ObjectBase * src) {
- //LOGE("rsiSetObject %p,%p %p", vdst, *vdst, vsrc);
+ //ALOGE("rsiSetObject %p,%p %p", vdst, *vdst, vsrc);
if (src) {
CHECK_OBJ(src);
src->incSysRef();
@@ -128,7 +128,7 @@
}
void rsrClearObject(const Context *rsc, const Script *sc, ObjectBase **dst) {
- //LOGE("rsiClearObject %p,%p", vdst, *vdst);
+ //ALOGE("rsiClearObject %p,%p", vdst, *vdst);
if (dst[0]) {
CHECK_OBJ(dst[0]);
dst[0]->decSysRef();
@@ -142,12 +142,12 @@
uint32_t rsrToClient(Context *rsc, Script *sc, int cmdID, void *data, int len) {
- //LOGE("SC_toClient %i %i %i", cmdID, len);
+ //ALOGE("SC_toClient %i %i %i", cmdID, len);
return rsc->sendMessageToClient(data, RS_MESSAGE_TO_CLIENT_USER, cmdID, len, false);
}
uint32_t rsrToClientBlocking(Context *rsc, Script *sc, int cmdID, void *data, int len) {
- //LOGE("SC_toClientBlocking %i %i", cmdID, len);
+ //ALOGE("SC_toClientBlocking %i %i", cmdID, len);
return rsc->sendMessageToClient(data, RS_MESSAGE_TO_CLIENT_USER, cmdID, len, true);
}
diff --git a/rsScriptC_LibGL.cpp b/rsScriptC_LibGL.cpp
index 7862f3c..7964792 100644
--- a/rsScriptC_LibGL.cpp
+++ b/rsScriptC_LibGL.cpp
@@ -79,23 +79,28 @@
void rsrBindFrameBufferObjectColorTarget(Context *rsc, Script *sc, Allocation *a, uint32_t slot) {
CHECK_OBJ(va);
rsc->mFBOCache.bindColorTarget(rsc, a, slot);
+ rsc->mStateVertex.updateSize(rsc);
}
void rsrBindFrameBufferObjectDepthTarget(Context *rsc, Script *sc, Allocation *a) {
CHECK_OBJ(va);
rsc->mFBOCache.bindDepthTarget(rsc, a);
+ rsc->mStateVertex.updateSize(rsc);
}
void rsrClearFrameBufferObjectColorTarget(Context *rsc, Script *sc, uint32_t slot) {
rsc->mFBOCache.bindColorTarget(rsc, NULL, slot);
+ rsc->mStateVertex.updateSize(rsc);
}
void rsrClearFrameBufferObjectDepthTarget(Context *rsc, Script *sc) {
rsc->mFBOCache.bindDepthTarget(rsc, NULL);
+ rsc->mStateVertex.updateSize(rsc);
}
void rsrClearFrameBufferObjectTargets(Context *rsc, Script *sc) {
rsc->mFBOCache.resetAll(rsc);
+ rsc->mStateVertex.updateSize(rsc);
}
//////////////////////////////////////////////////////////////////////////////
@@ -142,11 +147,11 @@
return;
}
- //LOGE("Quad");
- //LOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1);
- //LOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2);
- //LOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3);
- //LOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4);
+ //ALOGE("Quad");
+ //ALOGE("%4.2f, %4.2f, %4.2f", x1, y1, z1);
+ //ALOGE("%4.2f, %4.2f, %4.2f", x2, y2, z2);
+ //ALOGE("%4.2f, %4.2f, %4.2f", x3, y3, z3);
+ //ALOGE("%4.2f, %4.2f, %4.2f", x4, y4, z4);
float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4};
const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4};
@@ -191,7 +196,7 @@
}
void rsrDrawRect(Context *rsc, Script *sc, float x1, float y1, float x2, float y2, float z) {
- //LOGE("SC_drawRect %f,%f %f,%f %f", x1, y1, x2, y2, z);
+ //ALOGE("SC_drawRect %f,%f %f,%f %f", x1, y1, x2, y2, z);
rsrDrawQuad(rsc, sc, x1, y2, z, x2, y2, z, x2, y1, z, x1, y1, z);
}
diff --git a/rsSignal.cpp b/rsSignal.cpp
index 413ac2b..3f6a13c 100644
--- a/rsSignal.cpp
+++ b/rsSignal.cpp
@@ -32,13 +32,13 @@
bool Signal::init() {
int status = pthread_mutex_init(&mMutex, NULL);
if (status) {
- LOGE("LocklessFifo mutex init failure");
+ ALOGE("LocklessFifo mutex init failure");
return false;
}
status = pthread_cond_init(&mCondition, NULL);
if (status) {
- LOGE("LocklessFifo condition init failure");
+ ALOGE("LocklessFifo condition init failure");
pthread_mutex_destroy(&mMutex);
return false;
}
@@ -51,7 +51,7 @@
status = pthread_mutex_lock(&mMutex);
if (status) {
- LOGE("LocklessCommandFifo: error %i locking for set condition.", status);
+ ALOGE("LocklessCommandFifo: error %i locking for set condition.", status);
return;
}
@@ -59,12 +59,12 @@
status = pthread_cond_signal(&mCondition);
if (status) {
- LOGE("LocklessCommandFifo: error %i on set condition.", status);
+ ALOGE("LocklessCommandFifo: error %i on set condition.", status);
}
status = pthread_mutex_unlock(&mMutex);
if (status) {
- LOGE("LocklessCommandFifo: error %i unlocking for set condition.", status);
+ ALOGE("LocklessCommandFifo: error %i unlocking for set condition.", status);
}
}
@@ -74,7 +74,7 @@
status = pthread_mutex_lock(&mMutex);
if (status) {
- LOGE("LocklessCommandFifo: error %i locking for condition.", status);
+ ALOGE("LocklessCommandFifo: error %i locking for condition.", status);
return false;
}
@@ -96,13 +96,13 @@
ret = true;
} else {
if (status != ETIMEDOUT) {
- LOGE("LocklessCommandFifo: error %i waiting for condition.", status);
+ ALOGE("LocklessCommandFifo: error %i waiting for condition.", status);
}
}
status = pthread_mutex_unlock(&mMutex);
if (status) {
- LOGE("LocklessCommandFifo: error %i unlocking for condition.", status);
+ ALOGE("LocklessCommandFifo: error %i unlocking for condition.", status);
}
return ret;
diff --git a/rsThreadIO.cpp b/rsThreadIO.cpp
index b1a579a..8ba1a0e 100644
--- a/rsThreadIO.cpp
+++ b/rsThreadIO.cpp
@@ -40,22 +40,22 @@
}
void ThreadIO::shutdown() {
- //LOGE("shutdown 1");
+ //ALOGE("shutdown 1");
mToCore.shutdown();
- //LOGE("shutdown 2");
+ //ALOGE("shutdown 2");
}
void ThreadIO::coreFlush() {
- //LOGE("coreFlush 1");
+ //ALOGE("coreFlush 1");
if (mUsingSocket) {
} else {
mToCore.flush();
}
- //LOGE("coreFlush 2");
+ //ALOGE("coreFlush 2");
}
void * ThreadIO::coreHeader(uint32_t cmdID, size_t dataLen) {
- //LOGE("coreHeader %i %i", cmdID, dataLen);
+ //ALOGE("coreHeader %i %i", cmdID, dataLen);
if (mUsingSocket) {
CoreCmdHeader hdr;
hdr.bytes = dataLen;
@@ -67,40 +67,40 @@
mCoreDataPtr = (uint8_t *)mToCore.reserve(dataLen);
mCoreDataBasePtr = mCoreDataPtr;
}
- //LOGE("coreHeader ret %p", mCoreDataPtr);
+ //ALOGE("coreHeader ret %p", mCoreDataPtr);
return mCoreDataPtr;
}
void ThreadIO::coreData(const void *data, size_t dataLen) {
- //LOGE("coreData %p %i", data, dataLen);
+ //ALOGE("coreData %p %i", data, dataLen);
mToCoreSocket.writeAsync(data, dataLen);
- //LOGE("coreData ret %p", mCoreDataPtr);
+ //ALOGE("coreData ret %p", mCoreDataPtr);
}
void ThreadIO::coreCommit() {
- //LOGE("coreCommit %p %p %i", mCoreDataPtr, mCoreDataBasePtr, mCoreCommandSize);
+ //ALOGE("coreCommit %p %p %i", mCoreDataPtr, mCoreDataBasePtr, mCoreCommandSize);
if (mUsingSocket) {
} else {
rsAssert((size_t)(mCoreDataPtr - mCoreDataBasePtr) <= mCoreCommandSize);
mToCore.commit(mCoreCommandID, mCoreCommandSize);
}
- //LOGE("coreCommit ret");
+ //ALOGE("coreCommit ret");
}
void ThreadIO::coreCommitSync() {
- //LOGE("coreCommitSync %p %p %i", mCoreDataPtr, mCoreDataBasePtr, mCoreCommandSize);
+ //ALOGE("coreCommitSync %p %p %i", mCoreDataPtr, mCoreDataBasePtr, mCoreCommandSize);
if (mUsingSocket) {
} else {
rsAssert((size_t)(mCoreDataPtr - mCoreDataBasePtr) <= mCoreCommandSize);
mToCore.commitSync(mCoreCommandID, mCoreCommandSize);
}
- //LOGE("coreCommitSync ret");
+ //ALOGE("coreCommitSync ret");
}
void ThreadIO::clientShutdown() {
- //LOGE("coreShutdown 1");
+ //ALOGE("coreShutdown 1");
mToClient.shutdown();
- //LOGE("coreShutdown 2");
+ //ALOGE("coreShutdown 2");
}
void ThreadIO::coreSetReturn(const void *data, size_t dataLen) {
@@ -145,11 +145,11 @@
con->timerSet(Context::RS_TIMER_INTERNAL);
}
waitForCommand = false;
- //LOGV("playCoreCommands 3 %i %i", cmdID, cmdSize);
+ //ALOGV("playCoreCommands 3 %i %i", cmdID, cmdSize);
if (cmdID >= (sizeof(gPlaybackFuncs) / sizeof(void *))) {
rsAssert(cmdID < (sizeof(gPlaybackFuncs) / sizeof(void *)));
- LOGE("playCoreCommands error con %p, cmd %i", con, cmdID);
+ ALOGE("playCoreCommands error con %p, cmd %i", con, cmdID);
mToCore.printDebugData();
}
gPlaybackFuncs[cmdID](con, data, cmdSize << 2);
@@ -193,8 +193,8 @@
uint32_t bytesData = 0;
uint32_t commandID = 0;
const uint32_t *d = (const uint32_t *)mToClient.get(&commandID, &bytesData);
- //LOGE("getMessageToClient 3 %i %i", commandID, bytesData);
- //LOGE("getMessageToClient %i %i", commandID, *subID);
+ //ALOGE("getMessageToClient 3 %i %i", commandID, bytesData);
+ //ALOGE("getMessageToClient %i %i", commandID, *subID);
if (bufferLen >= receiveLen[0]) {
memcpy(data, d+1, receiveLen[0]);
mToClient.next();
@@ -224,14 +224,14 @@
}
}
- //LOGE("sendMessageToClient 2");
+ //ALOGE("sendMessageToClient 2");
uint32_t *p = (uint32_t *)mToClient.reserve(dataLen + sizeof(usrID));
p[0] = usrID;
if (dataLen > 0) {
memcpy(p+1, data, dataLen);
}
mToClient.commit(cmdID, dataLen + sizeof(usrID));
- //LOGE("sendMessageToClient 3");
+ //ALOGE("sendMessageToClient 3");
return true;
}
return false;
diff --git a/rsType.cpp b/rsType.cpp
index 9a6a31b..7966470 100644
--- a/rsType.cpp
+++ b/rsType.cpp
@@ -141,7 +141,7 @@
void Type::dumpLOGV(const char *prefix) const {
char buf[1024];
ObjectBase::dumpLOGV(prefix);
- LOGV("%s Type: x=%zu y=%zu z=%zu mip=%i face=%i", prefix, mDimX, mDimY, mDimZ, mDimLOD, mFaces);
+ ALOGV("%s Type: x=%zu y=%zu z=%zu mip=%i face=%i", prefix, mDimX, mDimY, mDimZ, mDimLOD, mFaces);
snprintf(buf, sizeof(buf), "%s element: ", prefix);
mElement->dumpLOGV(buf);
}
@@ -167,7 +167,7 @@
// First make sure we are reading the correct object
RsA3DClassID classID = (RsA3DClassID)stream->loadU32();
if (classID != RS_A3D_CLASS_ID_TYPE) {
- LOGE("type loading skipped due to invalid class id\n");
+ ALOGE("type loading skipped due to invalid class id\n");
return NULL;
}
diff --git a/rsUtils.h b/rsUtils.h
index 3a6c85a..db6f592 100644
--- a/rsUtils.h
+++ b/rsUtils.h
@@ -40,7 +40,7 @@
namespace renderscript {
#if 1
-#define rsAssert(v) do {if(!(v)) LOGE("rsAssert failed: %s, in %s at %i", #v, __FILE__, __LINE__);} while (0)
+#define rsAssert(v) do {if(!(v)) ALOGE("rsAssert failed: %s, in %s at %i", #v, __FILE__, __LINE__);} while (0)
#else
#define rsAssert(v) while (0)
#endif
diff --git a/rsg_generator.c b/rsg_generator.c
index b3f6c55..6b84e56 100644
--- a/rsg_generator.c
+++ b/rsg_generator.c
@@ -235,7 +235,7 @@
}
}
- //fprintf(f, " LOGE(\"add command %s\\n\");\n", api->name);
+ //fprintf(f, " ALOGE(\"add command %s\\n\");\n", api->name);
if (hasInlineDataPointers(api)) {
fprintf(f, " RS_CMD_%s *cmd = NULL;\n", api->name);
fprintf(f, " if (dataSize < 1024) {;\n");
@@ -441,7 +441,7 @@
fprintf(f, "void rsp_%s(Context *con, const void *vp, size_t cmdSizeBytes) {\n", api->name);
- //fprintf(f, " LOGE(\"play command %s\\n\");\n", api->name);
+ //fprintf(f, " ALOGE(\"play command %s\\n\");\n", api->name);
fprintf(f, " const RS_CMD_%s *cmd = static_cast<const RS_CMD_%s *>(vp);\n", api->name, api->name);
fprintf(f, " ");
@@ -469,7 +469,7 @@
fprintf(f, "void rspr_%s(Context *con, Fifo *f, uint8_t *scratch, size_t scratchSize) {\n", api->name);
- //fprintf(f, " LOGE(\"play command %s\\n\");\n", api->name);
+ //fprintf(f, " ALOGE(\"play command %s\\n\");\n", api->name);
fprintf(f, " RS_CMD_%s cmd;\n", api->name);
fprintf(f, " f->read(&cmd, sizeof(cmd));\n");
diff --git a/scriptc/rs_types.rsh b/scriptc/rs_types.rsh
index e9c3c5e..84bca9c 100644
--- a/scriptc/rs_types.rsh
+++ b/scriptc/rs_types.rsh
@@ -364,7 +364,7 @@
typedef float4 rs_quaternion;
#define RS_PACKED __attribute__((packed, aligned(4)))
-#define NULL ((const void *)0)
+#define NULL ((void *)0)
#if (defined(RS_VERSION) && (RS_VERSION >= 14))