From cf9c894a9b7523cd5ec707218b89517f67caa047 Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Tue, 14 Jan 2014 16:18:14 -0800 Subject: 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 --- rs/java/android/renderscript/Script.java | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'rs/java/android/renderscript/Script.java') diff --git a/rs/java/android/renderscript/Script.java b/rs/java/android/renderscript/Script.java index 5ab18f744c2b..a1f228718436 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); -- cgit v1.2.3