diff options
author | Stephen Hines <srhines@google.com> | 2013-03-12 03:27:42 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-03-12 03:27:42 +0000 |
commit | 9f6421a36574b3319d10d700a6e6e506e490ce66 (patch) | |
tree | 46dcee453f6571f0648954f1b6a9cd9e264d6cb8 | |
parent | 2a2ead93a96b1e57098b5b6c14ec88906927d0cd (diff) | |
parent | 8b571d85777ecb57a61ea0e1e939cf6703e8fe66 (diff) | |
download | frameworks_base-9f6421a36574b3319d10d700a6e6e506e490ce66.zip frameworks_base-9f6421a36574b3319d10d700a6e6e506e490ce66.tar.gz frameworks_base-9f6421a36574b3319d10d700a6e6e506e490ce66.tar.bz2 |
Merge "Update RSTest_v14 for stride changes." into jb-mr2-dev
4 files changed, 29 insertions, 25 deletions
diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_alloc.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_alloc.java index da42b29..079fcce 100644 --- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_alloc.java +++ b/tests/RenderScriptTests/tests_v14/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); @@ -56,9 +57,10 @@ public class UT_alloc extends UnitTest { public void run() { RenderScript pRS = RenderScript.create(mCtx); - ScriptC_alloc s = new ScriptC_alloc(pRS, mRes, R.raw.alloc); + 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_v14/src/com/android/rs/test/UT_foreach.java b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_foreach.java index aeb5bb7..31f4114 100644 --- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_foreach.java +++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/UT_foreach.java @@ -37,17 +37,18 @@ 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; } public void run() { RenderScript pRS = RenderScript.create(mCtx); - ScriptC_foreach s = new ScriptC_foreach(pRS, mRes, R.raw.foreach); + ScriptC_foreach s = new ScriptC_foreach(pRS); pRS.setMessageHandler(mRsMessage); initializeGlobals(pRS, s); s.forEach_root(A); + s.invoke_verify_root(); s.invoke_foreach_test(); pRS.finish(); waitForMessage(); diff --git a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/alloc.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/alloc.rs index 3116e5a..1b5e2ac 100644 --- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/alloc.rs +++ b/tests/RenderScriptTests/tests_v14/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_v14/src/com/android/rs/test/foreach.rs b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs index 3ba3eef..3fa8f85 100644 --- a/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs +++ b/tests/RenderScriptTests/tests_v14/src/com/android/rs/test/foreach.rs @@ -1,37 +1,40 @@ #include "shared.rsh" -int *a; +rs_allocation aRaw; int dimX; int dimY; +static bool failed = false; void root(int *out, uint32_t x, uint32_t y) { *out = x + y * dimX; } -static bool test_foreach_output() { +static bool test_root_output() { bool failed = false; int i, j; 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)); } } if (failed) { - rsDebug("test_foreach_output FAILED", 0); + rsDebug("test_root_output FAILED", 0); } else { - rsDebug("test_foreach_output PASSED", 0); + rsDebug("test_root_output PASSED", 0); } return failed; } -void foreach_test() { - bool failed = false; - failed |= test_foreach_output(); +void verify_root() { + failed |= test_root_output(); +} +void foreach_test() { if (failed) { rsSendToClientBlocking(RS_MSG_TEST_FAILED); } |