diff options
author | Yang Ni <yangni@google.com> | 2016-05-04 09:44:48 -0700 |
---|---|---|
committer | Yang Ni <yangni@google.com> | 2016-05-04 11:05:40 -0700 |
commit | 7784b5d777b50b4e38568b8632ad666384f017c5 (patch) | |
tree | 5c691fbbcc5ed61f08971ca01bf26455faddcc59 | |
parent | 7f9621d3d8a16cea1020b0eee40538b217c06475 (diff) | |
download | rs-7784b5d777b50b4e38568b8632ad666384f017c5.tar.gz |
Avoid breaking on dead launch options
Bug: 28463187
Launch options array[2-4] are not initialized by the support library
in the current SDK.
They may have arbitrary values that invalide the checks that this CL
is removing, and cause a kernel launch to bail out unnecessarily.
This CL removes those checks, since the array.*Start and array.*End
fields in the launch options are not used anywhere in the current
runtime.
Change-Id: Ib8a2e551619f770b402f569acbde635ee047675a
-rw-r--r-- | cpu_ref/rsCpuScript.cpp | 6 | ||||
-rw-r--r-- | rsScriptC.cpp | 9 |
2 files changed, 2 insertions, 13 deletions
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp index a88af2fe..0400fab7 100644 --- a/cpu_ref/rsCpuScript.cpp +++ b/cpu_ref/rsCpuScript.cpp @@ -548,10 +548,8 @@ bool RsdCpuScriptImpl::setUpMtlsDimensions(MTLaunchStructCommon *mtls, SET_UP_DIMENSION(x, x); SET_UP_DIMENSION(y, y); SET_UP_DIMENSION(z, z); - SET_UP_DIMENSION(array[0], array); - SET_UP_DIMENSION(array[1], array2); - SET_UP_DIMENSION(array[2], array3); - SET_UP_DIMENSION(array[3], array4); + // Checks and setup of fields other than x, y, z are ignored, since those + // fields are not used in the runtime and are not visible in the Java API. #undef SET_UP_DIMENSION return true; diff --git a/rsScriptC.cpp b/rsScriptC.cpp index d2d5b1fd..eaef8490 100644 --- a/rsScriptC.cpp +++ b/rsScriptC.cpp @@ -183,15 +183,6 @@ void ScriptC::runForEach(Context *rsc, const void * usr, size_t usrBytes, const RsScriptCall *sc) { - // Make a copy of RsScriptCall and zero out extra fields that are absent - // in API levels below 23. - RsScriptCall sc_copy; - if (sc != nullptr && getApiLevel() < 23) { - memset(&sc_copy, 0, sizeof(sc_copy)); - memcpy(&sc_copy, sc, 7*4); - sc = &sc_copy; - } - if (slot >= mHal.info.exportedForEachCount) { rsc->setError(RS_ERROR_BAD_SCRIPT, "The forEach kernel index is out of bounds"); |