Merge "Add new error code for Debug Context work." into jb-mr2-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b322f99476
@@ -128,6 +128,8 @@ public class RenderScript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContextType mContextType;
|
||||||
|
|
||||||
// Methods below are wrapped to protect the non-threadsafe
|
// Methods below are wrapped to protect the non-threadsafe
|
||||||
// lockless fifo.
|
// lockless fifo.
|
||||||
native int rsnContextCreateGL(int dev, int ver, int sdkVer,
|
native int rsnContextCreateGL(int dev, int ver, int sdkVer,
|
||||||
@@ -1015,6 +1017,7 @@ public class RenderScript {
|
|||||||
static final int RS_MESSAGE_TO_CLIENT_USER = 4;
|
static final int RS_MESSAGE_TO_CLIENT_USER = 4;
|
||||||
static final int RS_MESSAGE_TO_CLIENT_NEW_BUFFER = 5;
|
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;
|
static final int RS_ERROR_FATAL_UNKNOWN = 0x1000;
|
||||||
|
|
||||||
MessageThread(RenderScript rs) {
|
MessageThread(RenderScript rs) {
|
||||||
@@ -1057,7 +1060,17 @@ public class RenderScript {
|
|||||||
if (msg == RS_MESSAGE_TO_CLIENT_ERROR) {
|
if (msg == RS_MESSAGE_TO_CLIENT_ERROR) {
|
||||||
String e = mRS.nContextGetErrorMessage(mRS.mContext);
|
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);
|
throw new RSRuntimeException("Fatal error " + subID + ", details: " + e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1092,6 +1105,7 @@ public class RenderScript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RenderScript(Context ctx) {
|
RenderScript(Context ctx) {
|
||||||
|
mContextType = ContextType.NORMAL;
|
||||||
if (ctx != null) {
|
if (ctx != null) {
|
||||||
mApplicationContext = ctx.getApplicationContext();
|
mApplicationContext = ctx.getApplicationContext();
|
||||||
}
|
}
|
||||||
@@ -1125,6 +1139,7 @@ public class RenderScript {
|
|||||||
|
|
||||||
rs.mDev = rs.nDeviceCreate();
|
rs.mDev = rs.nDeviceCreate();
|
||||||
rs.mContext = rs.nContextCreate(rs.mDev, 0, sdkVersion, ct.mID);
|
rs.mContext = rs.nContextCreate(rs.mDev, 0, sdkVersion, ct.mID);
|
||||||
|
rs.mContextType = ct;
|
||||||
if (rs.mContext == 0) {
|
if (rs.mContext == 0) {
|
||||||
throw new RSDriverException("Failed to create RS context.");
|
throw new RSDriverException("Failed to create RS context.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user