diff options
author | Stephen Hines <srhines@google.com> | 2013-04-20 21:37:10 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2013-04-20 21:37:10 -0700 |
commit | 0f59d6d34e2a22b263a7787fcb1d2d519cb6a3c3 (patch) | |
tree | 80ecf4693ac7ea25c590c7ca6dd62f0a3ad0b3ec /graphics/java/android/renderscript/RenderScript.java | |
parent | 4a96970e55adb8004daac50c8300a133bd29d97f (diff) | |
parent | 4a84af896c830d6ef613d1baa607d472cf865073 (diff) |
am 4a84af89: am b322f994: Merge "Add new error code for Debug Context work." into jb-mr2-dev
* commit '4a84af896c830d6ef613d1baa607d472cf865073':
Add new error code for Debug Context work.
Diffstat (limited to 'graphics/java/android/renderscript/RenderScript.java')
-rw-r--r-- | graphics/java/android/renderscript/RenderScript.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index a2878b905a6b..8717638404b4 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -136,6 +136,8 @@ public class RenderScript { } } + ContextType mContextType; + // Methods below are wrapped to protect the non-threadsafe // lockless fifo. native int rsnContextCreateGL(int dev, int ver, int sdkVer, @@ -1023,6 +1025,7 @@ public class RenderScript { static final int RS_MESSAGE_TO_CLIENT_USER = 4; static final int RS_MESSAGE_TO_CLIENT_NEW_BUFFER = 5; + static final int RS_ERROR_FATAL_DEBUG = 0x0800; static final int RS_ERROR_FATAL_UNKNOWN = 0x1000; MessageThread(RenderScript rs) { @@ -1065,7 +1068,17 @@ public class RenderScript { if (msg == RS_MESSAGE_TO_CLIENT_ERROR) { String e = mRS.nContextGetErrorMessage(mRS.mContext); - if (subID >= RS_ERROR_FATAL_UNKNOWN) { + // Throw RSRuntimeException under the following conditions: + // + // 1) It is an unknown fatal error. + // 2) It is a debug fatal error, and we are not in a + // debug context. + // 3) It is a debug fatal error, and we do not have an + // error callback. + if (subID >= RS_ERROR_FATAL_UNKNOWN || + (subID >= RS_ERROR_FATAL_DEBUG && + (mRS.mContextType != ContextType.DEBUG || + mRS.mErrorCallback == null))) { throw new RSRuntimeException("Fatal error " + subID + ", details: " + e); } @@ -1100,6 +1113,7 @@ public class RenderScript { } RenderScript(Context ctx) { + mContextType = ContextType.NORMAL; if (ctx != null) { mApplicationContext = ctx.getApplicationContext(); } @@ -1138,6 +1152,7 @@ public class RenderScript { rs.mDev = rs.nDeviceCreate(); rs.mContext = rs.nContextCreate(rs.mDev, 0, sdkVersion, ct.mID); + rs.mContextType = ct; if (rs.mContext == 0) { throw new RSDriverException("Failed to create RS context."); } |