am f98a800f: am 9e9c892a: Merge "Fix CTS use of bind"
* commit 'f98a800f71d7e9e054a807b0eece5bcaaf5aee06':
Fix CTS use of bind
diff --git a/tests/src/android/renderscript/cts/foreach.rs b/tests/src/android/renderscript/cts/foreach.rs
index 8747961..08e6bed 100644
--- a/tests/src/android/renderscript/cts/foreach.rs
+++ b/tests/src/android/renderscript/cts/foreach.rs
@@ -1,6 +1,5 @@
#include "shared.rsh"
-int *a;
rs_allocation aRaw;
int dimX;
int dimY;
diff --git a/tests/src/android/renderscript/cts/sample.rs b/tests/src/android/renderscript/cts/sample.rs
index 7a8d5bb..64fb262 100644
--- a/tests/src/android/renderscript/cts/sample.rs
+++ b/tests/src/android/renderscript/cts/sample.rs
@@ -8,46 +8,11 @@
rs_sampler gMipNearest;
rs_sampler gMipLinear;
-uint8_t *gAllocPtr;
-
static uchar4 lod0Color = {255, 255, 0, 0};
static uchar4 lod1Color = {255, 0, 255, 0};
static uchar4 lod2Color = {0, 255, 255, 0};
static uchar4 lod3Color = {255, 255, 255, 0};
-// Allocation has been bound to gAllocPtr
-void init_RGBA(rs_allocation a) {
- // Fill base level with one color, mips with something else
- uchar4 *allocPtr = (uchar4*)gAllocPtr;
- uint32_t dimX = rsAllocationGetDimX(a);
- uint32_t dimY = rsAllocationGetDimY(a);
- uint32_t minSize = 1;
- dimX = max(dimX, minSize);
- dimY = max(dimY, minSize);
-
- uint32_t numPixels = dimX * dimY;
- for (uint32_t i = 0; i < numPixels; i ++) {
- (*allocPtr++) = lod0Color;
- }
- dimX = max(dimX >> 1, minSize);
- dimY = max(dimY >> 1, minSize);
- numPixels = dimX * dimY;
- for (uint32_t i = 0; i < numPixels; i ++) {
- (*allocPtr++) = lod1Color;
- }
- dimX = max(dimX >> 1, minSize);
- dimY = max(dimY >> 1, minSize);
- numPixels = dimX * dimY;
- for (uint32_t i = 0; i < numPixels; i ++) {
- (*allocPtr++) = lod2Color;
- }
- dimX = max(dimX >> 1, minSize);
- dimY = max(dimY >> 1, minSize);
- numPixels = dimX * dimY;
- for (uint32_t i = 0; i < numPixels; i ++) {
- (*allocPtr++) = lod3Color;
- }
-}
static bool compare(float4 expected, float4 value) {
float allowedDelta = 10.0f;
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/ForEachTest.java b/tests/tests/renderscript/src/android/renderscript/cts/ForEachTest.java
index 433b7e6..8e82f1f 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/ForEachTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/ForEachTest.java
@@ -470,7 +470,6 @@
s.set_dimY(Y);
typeBuilder.setX(X).setY(Y);
Allocation A = Allocation.createTyped(mRS, typeBuilder.create());
- s.bind_a(A);
s.set_aRaw(A);
s.forEach_root(A);
s.invoke_verify_root();
@@ -478,6 +477,7 @@
s.invoke_verify_foo();
s.invoke_foreach_test();
mRS.finish();
+ checkForErrors();
waitForMessage();
}
@@ -491,7 +491,6 @@
s.set_dimY(Y);
typeBuilder.setX(X).setY(Y);
Allocation A = Allocation.createTyped(mRS, typeBuilder.create());
- s.bind_a(A);
s.set_aRaw(A);
s.forEach_foo(A, A);
s.invoke_verify_foo();
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/KernelTest.java b/tests/tests/renderscript/src/android/renderscript/cts/KernelTest.java
index 56b5e89..dcfc0ba 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/KernelTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/KernelTest.java
@@ -470,7 +470,6 @@
s.set_dimY(Y);
typeBuilder.setX(X).setY(Y);
Allocation A = Allocation.createTyped(mRS, typeBuilder.create());
- s.bind_a(A);
s.set_aRaw(A);
s.forEach_root(A);
s.invoke_verify_root();
@@ -478,6 +477,7 @@
s.invoke_verify_foo();
s.invoke_foreach_test();
mRS.finish();
+ checkForErrors();
waitForMessage();
}
@@ -491,7 +491,6 @@
s.set_dimY(Y);
typeBuilder.setX(X).setY(Y);
Allocation A = Allocation.createTyped(mRS, typeBuilder.create());
- s.bind_a(A);
s.set_aRaw(A);
s.forEach_foo(A, A);
s.invoke_verify_foo();
diff --git a/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java b/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java
index 3c8650d..1729aeb 100644
--- a/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java
+++ b/tests/tests/renderscript/src/android/renderscript/cts/SampleTest.java
@@ -34,6 +34,36 @@
Allocation mAlloc_RGBA_1D;
Allocation mAlloc_RGBA_2D;
+ Allocation createAlloc(Type t) {
+ Allocation a = Allocation.createTyped(mRS, t, Allocation.MipmapControl.MIPMAP_FULL,
+ Allocation.USAGE_SCRIPT);
+
+ int[] tmp = new int[t.getCount()];
+ int idx = 0;
+ int w = t.getY();
+ if (w < 1) {
+ w = 1;
+ }
+
+ for (int ct = 0; ct < (8 * w); ct++) {
+ tmp[idx++] = 0x0000ffff;
+ }
+ w = (w + 1) >> 1;
+ for (int ct = 0; ct < (4 * w); ct++) {
+ tmp[idx++] = 0x00ff00ff;
+ }
+ w = (w + 1) >> 1;
+ for (int ct = 0; ct < (2 * w); ct++) {
+ tmp[idx++] = 0x00ffff00;
+ }
+ w = (w + 1) >> 1;
+ for (int ct = 0; ct < (1 * 1); ct++) {
+ tmp[idx++] = 0xffffff00;
+ }
+ a.copyFromUnchecked(tmp);
+ return a;
+ }
+
@Override
protected void setUp() throws Exception {
super.setUp();
@@ -41,18 +71,10 @@
Element format = Element.RGBA_8888(mRS);
Type.Builder b = new Type.Builder(mRS, format);
b.setMipmaps(true);
- mAlloc_RGBA_1D = Allocation.createTyped(mRS, b.setX(8).create(),
- Allocation.MipmapControl.MIPMAP_FULL,
- Allocation.USAGE_SCRIPT);
- mAlloc_RGBA_2D = Allocation.createTyped(mRS, b.setX(8).setY(8).create(),
- Allocation.MipmapControl.MIPMAP_FULL,
- Allocation.USAGE_SCRIPT);
+ mAlloc_RGBA_1D = createAlloc(b.setX(8).create());
+ mAlloc_RGBA_2D = createAlloc(b.setX(8).setY(8).create());
mScript = new ScriptC_sample(mRS, mRes, R.raw.sample);
- mScript.bind_gAllocPtr(mAlloc_RGBA_1D);
- mScript.invoke_init_RGBA(mAlloc_RGBA_1D);
- mScript.bind_gAllocPtr(mAlloc_RGBA_2D);
- mScript.invoke_init_RGBA(mAlloc_RGBA_2D);
mScript.set_gNearest(Sampler.CLAMP_NEAREST(mRS));
mScript.set_gLinear(Sampler.CLAMP_LINEAR(mRS));