diff options
| author | Tim Murray <timmurray@google.com> | 2013-08-15 16:25:03 -0700 |
|---|---|---|
| committer | Tim Murray <timmurray@google.com> | 2013-08-19 12:07:52 -0700 |
| commit | 21fa7a0a23eddab88ff261017f6d7a2548b4d89a (patch) | |
| tree | 38d9b9d3dd271bf7b5eb09ba23b85ca793cdaf4f /cpp/RenderScript.cpp | |
| parent | 2d7d0b276ed4b3cedf72342a4d2ab287d4653ce0 (diff) | |
Add error handling, move to create methods for intrinsics.
Change-Id: I81a0d481fef8b9396c648fdf18aee716a2056612
Diffstat (limited to 'cpp/RenderScript.cpp')
| -rw-r--r-- | cpp/RenderScript.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/cpp/RenderScript.cpp b/cpp/RenderScript.cpp index 18e71178..561b58f9 100644 --- a/cpp/RenderScript.cpp +++ b/cpp/RenderScript.cpp @@ -46,6 +46,7 @@ RS::RS() { mMessageFunc = NULL; mMessageRun = false; mInit = false; + mCurrentError = RS_SUCCESS; memset(&mElements, 0, sizeof(mElements)); memset(&mSamplers, 0, sizeof(mSamplers)); @@ -496,10 +497,13 @@ bool RS::init(int targetApi, bool forceCpu, bool synchronous) { return true; } -void RS::throwError(const char *err) const { - ALOGE("RS CPP error: %s", err); - int * v = NULL; - v[0] = 0; +void RS::throwError(RSError error, const char *errMsg) { + if (mCurrentError == RS_SUCCESS) { + mCurrentError = error; + ALOGE("RS CPP error: %s", errMsg); + } else { + ALOGE("RS CPP error (masked by previous error): %s", errMsg); + } } @@ -533,7 +537,7 @@ void * RS::threadProc(void *vrsc) { switch(r) { case RS_MESSAGE_TO_CLIENT_ERROR: ALOGE("RS Error %s", (const char *)rbuf); - + rs->throwError(RS_ERROR_RUNTIME_ERROR, "Error returned from runtime"); if(rs->mMessageFunc != NULL) { rs->mErrorFunc(usrID, (const char *)rbuf); } |
