summaryrefslogtreecommitdiffstats
path: root/rs
diff options
context:
space:
mode:
authorJason Sams <jsams@google.com>2014-01-14 16:18:14 -0800
committerJason Sams <jsams@google.com>2014-01-14 16:18:14 -0800
commit9eb8b3ae097bceb13490341c615ffac6e85bdc7d (patch)
tree68b8785610e0e6ce3ffa681f6d4b28b8e45a2e79 /rs
parent17fc100ea1d759ad35126b79e6194b5faa61e5db (diff)
downloadframeworks_base-9eb8b3ae097bceb13490341c615ffac6e85bdc7d.zip
frameworks_base-9eb8b3ae097bceb13490341c615ffac6e85bdc7d.tar.gz
frameworks_base-9eb8b3ae097bceb13490341c615ffac6e85bdc7d.tar.bz2
Check that bound allocations are 1D
We do not support higher order bound allocations. The stride is not available to the script so they cannot walk the allocation correctly. Change-Id: I9447a5d43c3ae1b88fc9522628a17bd5a317ffc6
Diffstat (limited to 'rs')
-rw-r--r--rs/java/android/renderscript/Script.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/rs/java/android/renderscript/Script.java b/rs/java/android/renderscript/Script.java
index 5ab18f7..a1f2287 100644
--- a/rs/java/android/renderscript/Script.java
+++ b/rs/java/android/renderscript/Script.java
@@ -188,6 +188,13 @@ public class Script extends BaseObj {
public void bindAllocation(Allocation va, int slot) {
mRS.validate();
if (va != null) {
+ if (mRS.getApplicationContext().getApplicationInfo().targetSdkVersion >= 20) {
+ final Type t = va.mType;
+ if (t.hasMipmaps() || t.hasFaces() || (t.getY() != 0) || (t.getZ() != 0)) {
+ throw new RSIllegalArgumentException(
+ "API 20+ only allows simple 1D allocations to be used with bind.");
+ }
+ }
mRS.nScriptBindAllocation(getID(mRS), va.getID(mRS), slot);
} else {
mRS.nScriptBindAllocation(getID(mRS), 0, slot);