diff options
| author | 2013-02-07 16:10:27 -0800 | |
|---|---|---|
| committer | 2013-02-08 16:34:20 -0800 | |
| commit | 7bd280ac8d56a9eb73240ccd5a403855286e6cb9 (patch) | |
| tree | 862a463b39702518566002ec4fd62dfcb69d737c | |
| parent | 6c971bfac3e95a0106dbdc9258656cb91ea033a8 (diff) | |
Fix stride/addressing issues for RS tests.
Change-Id: Icb49b4ef849b2bba9702dbb7817f3715e52091f6
8 files changed, 30 insertions, 26 deletions
diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_alloc.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_alloc.java index a06d8204e9bf..3ea942cc4dd2 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_alloc.java +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_alloc.java @@ -39,6 +39,7 @@ public class UT_alloc extends UnitTest { typeBuilder.setX(X).setY(Y); Allocation A = Allocation.createTyped(RS, typeBuilder.create()); s.bind_a(A); + s.set_aRaw(A); typeBuilder = new Type.Builder(RS, Element.I32(RS)); typeBuilder.setX(X).setY(Y).setFaces(true); @@ -59,6 +60,7 @@ public class UT_alloc extends UnitTest { ScriptC_alloc s = new ScriptC_alloc(pRS); pRS.setMessageHandler(mRsMessage); initializeGlobals(pRS, s); + s.forEach_root(s.get_aRaw()); s.invoke_alloc_test(); pRS.finish(); waitForMessage(); diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach.java index 4951970e605a..6c951097643d 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach.java +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach.java @@ -37,7 +37,7 @@ public class UT_foreach extends UnitTest { s.set_dimY(Y); typeBuilder.setX(X).setY(Y); A = Allocation.createTyped(RS, typeBuilder.create()); - s.bind_a(A); + s.set_aRaw(A); return; } diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java index bda055b4c10b..782f7888b2dc 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_foreach_bounds.java @@ -37,7 +37,7 @@ public class UT_foreach_bounds extends UnitTest { s.set_dimY(Y); typeBuilder.setX(X).setY(Y); A = Allocation.createTyped(RS, typeBuilder.create()); - s.bind_a(A); + s.set_aRaw(A); s.set_s(s); s.set_ain(A); s.set_aout(A); diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_noroot.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_noroot.java index cc485911b1b6..69526a8b4a16 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_noroot.java +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_noroot.java @@ -37,7 +37,7 @@ public class UT_noroot extends UnitTest { s.set_dimY(Y); typeBuilder.setX(X).setY(Y); A = Allocation.createTyped(RS, typeBuilder.create()); - s.bind_a(A); + s.set_aRaw(A); return; } diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/alloc.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/alloc.rs index 3116e5a81aa0..1b5e2ac5ffec 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/alloc.rs +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/alloc.rs @@ -5,39 +5,37 @@ int dimX; int dimY; int dimZ; +rs_allocation aRaw; rs_allocation aFaces; rs_allocation aLOD; rs_allocation aFacesLOD; +void root(int *o, uint32_t x, uint32_t y) { + *o = x + y * dimX; +} + static bool test_alloc_dims() { bool failed = false; int i, j; - for (j = 0; j < dimY; j++) { - for (i = 0; i < dimX; i++) { - a[i + j * dimX] = i + j * dimX; - } - } - - rs_allocation alloc = rsGetAllocation(a); - _RS_ASSERT(rsAllocationGetDimX(alloc) == dimX); - _RS_ASSERT(rsAllocationGetDimY(alloc) == dimY); - _RS_ASSERT(rsAllocationGetDimZ(alloc) == dimZ); + _RS_ASSERT(rsAllocationGetDimX(aRaw) == dimX); + _RS_ASSERT(rsAllocationGetDimY(aRaw) == dimY); + _RS_ASSERT(rsAllocationGetDimZ(aRaw) == dimZ); // Test 2D addressing for (j = 0; j < dimY; j++) { for (i = 0; i < dimX; i++) { rsDebug("Verifying ", i + j * dimX); - const void *p = rsGetElementAt(alloc, i, j); + const void *p = rsGetElementAt(aRaw, i, j); int val = *(const int *)p; _RS_ASSERT(val == (i + j * dimX)); } } // Test 1D addressing - for (i = 0; i < dimX * dimY; i++) { + for (i = 0; i < dimX; i++) { rsDebug("Verifying ", i); - const void *p = rsGetElementAt(alloc, i); + const void *p = rsGetElementAt(aRaw, i); int val = *(const int *)p; _RS_ASSERT(val == i); } @@ -46,7 +44,7 @@ static bool test_alloc_dims() { for (j = 0; j < dimY; j++) { for (i = 0; i < dimX; i++) { rsDebug("Verifying ", i + j * dimX); - const void *p = rsGetElementAt(alloc, i, j, 0); + const void *p = rsGetElementAt(aRaw, i, j, 0); int val = *(const int *)p; _RS_ASSERT(val == (i + j * dimX)); } diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach.rs index ac527b597432..08e6bede73d0 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach.rs +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach.rs @@ -1,6 +1,6 @@ #include "shared.rsh" -int *a; +rs_allocation aRaw; int dimX; int dimY; static bool failed = false; @@ -21,7 +21,8 @@ static bool test_root_output() { for (j = 0; j < dimY; j++) { for (i = 0; i < dimX; i++) { - _RS_ASSERT(a[i + j * dimX] == (i + j * dimX)); + int v = rsGetElementAt_int(aRaw, i, j); + _RS_ASSERT(v == (i + j * dimX)); } } @@ -41,7 +42,8 @@ static bool test_foo_output() { for (j = 0; j < dimY; j++) { for (i = 0; i < dimX; i++) { - _RS_ASSERT(a[i + j * dimX] == (99 + i + j * dimX)); + int v = rsGetElementAt_int(aRaw, i, j); + _RS_ASSERT(v == (99 + i + j * dimX)); } } diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs index ddf17f81e5ec..89df090da1bf 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/foreach_bounds.rs @@ -1,6 +1,5 @@ #include "shared.rsh" -int *a; int dimX; int dimY; int xStart = 0; @@ -9,6 +8,7 @@ int yStart = 0; int yEnd = 0; rs_script s; +rs_allocation aRaw; rs_allocation ain; rs_allocation aout; @@ -26,13 +26,14 @@ static bool test_root_output() { for (j = 0; j < dimY; j++) { for (i = 0; i < dimX; i++) { + int v = rsGetElementAt_int(aRaw, i, j); rsDebug("i: ", i); rsDebug("j: ", j); - rsDebug("a[j][i]: ", a[i + j * dimX]); + rsDebug("a[j][i]: ", v); if (i < xStart || i >= xEnd || j < yStart || j >= yEnd) { - _RS_ASSERT(a[i + j * dimX] == 0); + _RS_ASSERT(v == 0); } else { - _RS_ASSERT(a[i + j * dimX] == (i + j * dimX)); + _RS_ASSERT(v == (i + j * dimX)); } } } diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/noroot.rs b/tests/RenderScriptTests/tests/src/com/android/rs/test/noroot.rs index 33944aa15510..2c807bdf032d 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/noroot.rs +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/noroot.rs @@ -1,6 +1,6 @@ #include "shared.rsh" -int *a; +rs_allocation aRaw; int dimX; int dimY; static bool failed = false; @@ -15,7 +15,8 @@ static bool test_foo_output() { for (j = 0; j < dimY; j++) { for (i = 0; i < dimX; i++) { - _RS_ASSERT(a[i + j * dimX] == (99 + i + j * dimX)); + int v = rsGetElementAt_int(aRaw, i, j); + _RS_ASSERT(v == (99 + i + j * dimX)); } } |