summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2010-10-11 10:54:21 -0700
committerStephen Hines <srhines@google.com>2010-10-11 12:32:33 -0700
commit031ec58cfc7a20927302a5300eba3f5fc1709b50 (patch)
tree4a5719c7c6c89b66d8a304d0df333810b2a2aa3f /libs
parentc2a443250768086a609c5666f23d93316d84252c (diff)
downloadframeworks_base-031ec58cfc7a20927302a5300eba3f5fc1709b50.zip
frameworks_base-031ec58cfc7a20927302a5300eba3f5fc1709b50.tar.gz
frameworks_base-031ec58cfc7a20927302a5300eba3f5fc1709b50.tar.bz2
Fix support for 64-bit integers.
Change-Id: I4e2146a5fda41f280ee3f6f685a34f3cff28f05e
Diffstat (limited to 'libs')
-rw-r--r--libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java58
-rw-r--r--libs/rs/java/tests/src/com/android/rs/test/UnitTest.java22
-rw-r--r--libs/rs/java/tests/src/com/android/rs/test/primitives.rs12
-rw-r--r--libs/rs/rs.spec6
-rw-r--r--libs/rs/rsScript.cpp6
5 files changed, 85 insertions, 19 deletions
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java b/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java
index fb355dd..32b55d9 100644
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java
+++ b/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java
@@ -27,13 +27,65 @@ public class UT_primitives extends UnitTest {
mRes = res;
}
+ private boolean initializeGlobals(ScriptC_primitives s) {
+ float pF = s.get_floatTest();
+ if (pF != 1.99f) {
+ return false;
+ }
+ s.set_floatTest(2.99f);
+
+ double pD = s.get_doubleTest();
+ if (pD != 2.05) {
+ return false;
+ }
+ s.set_doubleTest(3.05);
+
+ byte pC = s.get_charTest();
+ if (pC != -8) {
+ return false;
+ }
+ s.set_charTest((byte)-16);
+
+ short pS = s.get_shortTest();
+ if (pS != -16) {
+ return false;
+ }
+ s.set_shortTest((short)-32);
+
+ int pI = s.get_intTest();
+ if (pI != -32) {
+ return false;
+ }
+ s.set_intTest(-64);
+
+ /*long pL = s.get_longTest();
+ if (pL != 17179869184l) {
+ return false;
+ }
+ s.set_longTest(17179869185l);*/
+
+ long pLL = s.get_longlongTest();
+ if (pLL != 68719476736L) {
+ return false;
+ }
+ s.set_longlongTest(68719476735L);
+ //s.set_longlongTest(0);
+
+ return true;
+ }
+
public void run() {
RenderScript pRS = RenderScript.create();
ScriptC_primitives s = new ScriptC_primitives(pRS, mRes, R.raw.primitives, true);
pRS.mMessageCallback = mRsMessage;
- s.invoke_primitives_test(0, 0);
- pRS.finish();
- waitForMessage();
+ if (!initializeGlobals(s)) {
+ // initializeGlobals failed
+ result = -1;
+ } else {
+ s.invoke_primitives_test(0, 0);
+ pRS.finish();
+ waitForMessage();
+ }
pRS.destroy();
}
}
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java b/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java
index c9d88a6..90bb8a3 100644
--- a/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java
+++ b/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java
@@ -55,16 +55,18 @@ public class UnitTest extends Thread {
protected RSMessage mRsMessage = new RSMessage() {
public void run() {
- switch (mID) {
- case RS_MSG_TEST_PASSED:
- result = 1;
- break;
- case RS_MSG_TEST_FAILED:
- result = -1;
- break;
- default:
- android.util.Log.v("RenderScript", "Unit test got unexpected message");
- return;
+ if (result == 0) {
+ switch (mID) {
+ case RS_MSG_TEST_PASSED:
+ result = 1;
+ break;
+ case RS_MSG_TEST_FAILED:
+ result = -1;
+ break;
+ default:
+ android.util.Log.v("RenderScript", "Unit test got unexpected message");
+ return;
+ }
}
if (mItem != null) {
diff --git a/libs/rs/java/tests/src/com/android/rs/test/primitives.rs b/libs/rs/java/tests/src/com/android/rs/test/primitives.rs
index ac0dc12..2db82da 100644
--- a/libs/rs/java/tests/src/com/android/rs/test/primitives.rs
+++ b/libs/rs/java/tests/src/com/android/rs/test/primitives.rs
@@ -20,13 +20,13 @@ static bool test_primitive_types(uint32_t index) {
bool failed = false;
start();
- _RS_ASSERT(floatTest == 1.99f);
- _RS_ASSERT(doubleTest == 2.05);
- _RS_ASSERT(charTest == -8);
- _RS_ASSERT(shortTest == -16);
- _RS_ASSERT(intTest == -32);
+ _RS_ASSERT(floatTest == 2.99f);
+ _RS_ASSERT(doubleTest == 3.05);
+ _RS_ASSERT(charTest == -16);
+ _RS_ASSERT(shortTest == -32);
+ _RS_ASSERT(intTest == -64);
_RS_ASSERT(longTest == 17179869184l);
- _RS_ASSERT(longlongTest == 68719476736l);
+ _RS_ASSERT(longlongTest == 68719476735l);
_RS_ASSERT(ucharTest == 8);
_RS_ASSERT(ushortTest == 16);
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index a1c0671..8a25a97 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -338,6 +338,12 @@ ScriptSetVarI {
param int value
}
+ScriptSetVarJ {
+ param RsScript s
+ param uint32_t slot
+ param int64_t value
+ }
+
ScriptSetVarF {
param RsScript s
param uint32_t slot
diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp
index c2f9689..c5632b5 100644
--- a/libs/rs/rsScript.cpp
+++ b/libs/rs/rsScript.cpp
@@ -115,6 +115,12 @@ void rsi_ScriptSetVarI(Context *rsc, RsScript vs, uint32_t slot, int value)
s->setVar(slot, &value, sizeof(value));
}
+void rsi_ScriptSetVarJ(Context *rsc, RsScript vs, uint32_t slot, long long value)
+{
+ Script *s = static_cast<Script *>(vs);
+ s->setVar(slot, &value, sizeof(value));
+}
+
void rsi_ScriptSetVarF(Context *rsc, RsScript vs, uint32_t slot, float value)
{
Script *s = static_cast<Script *>(vs);