summaryrefslogtreecommitdiff
path: root/java/tests/RSTest_CompatLib
diff options
context:
space:
mode:
Diffstat (limited to 'java/tests/RSTest_CompatLib')
-rw-r--r--java/tests/RSTest_CompatLib/src/com/android/rs/test/element.rs9
-rw-r--r--java/tests/RSTest_CompatLib/src/com/android/rs/test/fp_mad.rs6
-rw-r--r--java/tests/RSTest_CompatLib/src/com/android/rs/test/math_agree.rs17
-rw-r--r--java/tests/RSTest_CompatLib/src/com/android/rs/test/rstypes.rs9
-rw-r--r--java/tests/RSTest_CompatLib/src/com/android/rs/test/shared.rsh25
5 files changed, 25 insertions, 41 deletions
diff --git a/java/tests/RSTest_CompatLib/src/com/android/rs/test/element.rs b/java/tests/RSTest_CompatLib/src/com/android/rs/test/element.rs
index 1f247753..c7a7a87f 100644
--- a/java/tests/RSTest_CompatLib/src/com/android/rs/test/element.rs
+++ b/java/tests/RSTest_CompatLib/src/com/android/rs/test/element.rs
@@ -57,14 +57,6 @@ static uint32_t subElemArraySizes[] = {
1,
};
-static void resetStruct() {
- uint8_t *bytePtr = (uint8_t*)complexStruct;
- uint32_t sizeOfStruct = sizeof(*complexStruct);
- for(uint32_t i = 0; i < sizeOfStruct; i ++) {
- bytePtr[i] = 0;
- }
-}
-
static bool equals(const char *name0, const char * name1, uint32_t len) {
for (uint32_t i = 0; i < len; i ++) {
if (name0[i] != name1[i]) {
@@ -153,4 +145,3 @@ void element_test() {
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
}
}
-
diff --git a/java/tests/RSTest_CompatLib/src/com/android/rs/test/fp_mad.rs b/java/tests/RSTest_CompatLib/src/com/android/rs/test/fp_mad.rs
index b6f2b2a6..3e8889ed 100644
--- a/java/tests/RSTest_CompatLib/src/com/android/rs/test/fp_mad.rs
+++ b/java/tests/RSTest_CompatLib/src/com/android/rs/test/fp_mad.rs
@@ -8,7 +8,6 @@ static float4 data_f4[1025];
static void test_mad4(uint32_t index) {
start();
- float total = 0;
// Do ~1 billion ops
for (int ct=0; ct < 1000 * (1000 / 80); ct++) {
for (int i=0; i < (1000); i++) {
@@ -32,7 +31,6 @@ static void test_mad4(uint32_t index) {
static void test_mad(uint32_t index) {
start();
- float total = 0;
// Do ~1 billion ops
for (int ct=0; ct < 1000 * (1000 / 20); ct++) {
for (int i=0; i < (1000); i++) {
@@ -56,7 +54,6 @@ static void test_mad(uint32_t index) {
static void test_norm(uint32_t index) {
start();
- float total = 0;
// Do ~10 M ops
for (int ct=0; ct < 1000 * 10; ct++) {
for (int i=0; i < (1000); i++) {
@@ -71,7 +68,6 @@ static void test_norm(uint32_t index) {
static void test_sincos4(uint32_t index) {
start();
- float total = 0;
// Do ~10 M ops
for (int ct=0; ct < 1000 * 10 / 4; ct++) {
for (int i=0; i < (1000); i++) {
@@ -86,7 +82,6 @@ static void test_sincos4(uint32_t index) {
static void test_sincos(uint32_t index) {
start();
- float total = 0;
// Do ~10 M ops
for (int ct=0; ct < 1000 * 10; ct++) {
for (int i=0; i < (1000); i++) {
@@ -127,7 +122,6 @@ static void test_clamp(uint32_t index) {
static void test_clamp4(uint32_t index) {
start();
- float total = 0;
// Do ~100 M ops
for (int ct=0; ct < 1000 * 100 /4; ct++) {
for (int i=0; i < (1000); i++) {
diff --git a/java/tests/RSTest_CompatLib/src/com/android/rs/test/math_agree.rs b/java/tests/RSTest_CompatLib/src/com/android/rs/test/math_agree.rs
index 5bfbb2bf..80f73bef 100644
--- a/java/tests/RSTest_CompatLib/src/com/android/rs/test/math_agree.rs
+++ b/java/tests/RSTest_CompatLib/src/com/android/rs/test/math_agree.rs
@@ -345,16 +345,10 @@ TEST_US_US_ALL(func) \
TEST_SI_SI_ALL(func) \
TEST_UI_UI_ALL(func)
-// TODO: add long types to ALL macro
-#if 0
-TEST_SL_SL_ALL(func) \
-TEST_UL_UL_ALL(func)
-#endif
-
#define DECLARE_TEMP_SET(type, abbrev) \
-volatile type temp_##abbrev##1; \
-volatile type##2 temp_##abbrev##2; \
-volatile type##3 temp_##abbrev##3; \
+volatile type temp_##abbrev##1; \
+volatile type##2 temp_##abbrev##2; \
+volatile type##3 temp_##abbrev##3; \
volatile type##4 temp_##abbrev##4;
#define DECLARE_ALL_TEMP_SETS() \
@@ -364,9 +358,7 @@ DECLARE_TEMP_SET(uchar, uc); \
DECLARE_TEMP_SET(short, ss); \
DECLARE_TEMP_SET(ushort, us); \
DECLARE_TEMP_SET(int, si); \
-DECLARE_TEMP_SET(uint, ui); \
-DECLARE_TEMP_SET(long, sl); \
-DECLARE_TEMP_SET(ulong, ul);
+DECLARE_TEMP_SET(uint, ui);
static bool test_math_agree() {
bool failed = false;
@@ -406,4 +398,3 @@ void math_agree_test() {
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
}
}
-
diff --git a/java/tests/RSTest_CompatLib/src/com/android/rs/test/rstypes.rs b/java/tests/RSTest_CompatLib/src/com/android/rs/test/rstypes.rs
index bec124dd..afada817 100644
--- a/java/tests/RSTest_CompatLib/src/com/android/rs/test/rstypes.rs
+++ b/java/tests/RSTest_CompatLib/src/com/android/rs/test/rstypes.rs
@@ -22,6 +22,9 @@ static bool basic_test(uint32_t index) {
rs_matrix4x4 matrix4x4TestLocal;
rs_matrix3x3 matrix3x3TestLocal;
rs_matrix2x2 matrix2x2TestLocal;
+ (void) matrix4x4TestLocal;
+ (void) matrix3x3TestLocal;
+ (void) matrix2x2TestLocal;
// This test focuses primarily on compilation-time, not run-time.
rs_element elementTestLocal;
@@ -29,8 +32,14 @@ static bool basic_test(uint32_t index) {
rs_allocation allocationTestLocal;
rs_sampler samplerTestLocal;
rs_script scriptTestLocal;
+ (void) elementTestLocal;
+ (void) typeTestLocal;
+ (void) allocationTestLocal;
+ (void) samplerTestLocal;
+ (void) scriptTestLocal;
struct my_struct structTest;
+ (void) structTest;
//allocationTestLocal = allocationTest;
diff --git a/java/tests/RSTest_CompatLib/src/com/android/rs/test/shared.rsh b/java/tests/RSTest_CompatLib/src/com/android/rs/test/shared.rsh
index b05a354b..04974afb 100644
--- a/java/tests/RSTest_CompatLib/src/com/android/rs/test/shared.rsh
+++ b/java/tests/RSTest_CompatLib/src/com/android/rs/test/shared.rsh
@@ -12,11 +12,11 @@ typedef struct TestResult_s {
static int64_t g_time;
-static void start(void) {
+static inline void start(void) {
g_time = rsUptimeMillis();
}
-static float end(uint32_t idx) {
+static inline float end(uint32_t idx) {
int64_t t = rsUptimeMillis() - g_time;
//g_results[idx].time = t;
//rsDebug("test time", (int)t);
@@ -35,42 +35,42 @@ do { \
static const int iposinf = 0x7f800000;
static const int ineginf = 0xff800000;
-static const float posinf() {
+static inline const float posinf() {
float f = *((float*)&iposinf);
return f;
}
-static const float neginf() {
+static inline const float neginf() {
float f = *((float*)&ineginf);
return f;
}
-static bool isposinf(float f) {
+static inline bool isposinf(float f) {
int i = *((int*)(void*)&f);
return (i == iposinf);
}
-static bool isneginf(float f) {
+static inline bool isneginf(float f) {
int i = *((int*)(void*)&f);
return (i == ineginf);
}
-static bool isnan(float f) {
+static inline bool isnan(float f) {
int i = *((int*)(void*)&f);
return (((i & 0x7f800000) == 0x7f800000) && (i & 0x007fffff));
}
-static bool isposzero(float f) {
+static inline bool isposzero(float f) {
int i = *((int*)(void*)&f);
return (i == 0x00000000);
}
-static bool isnegzero(float f) {
+static inline bool isnegzero(float f) {
int i = *((int*)(void*)&f);
return (i == 0x80000000);
}
-static bool iszero(float f) {
+static inline bool iszero(float f) {
return isposzero(f) || isnegzero(f);
}
@@ -84,13 +84,13 @@ static bool iszero(float f) {
/* Calculate the difference in ULPs between the two values. (Return zero on
perfect equality.) */
-static int float_dist(float f1, float f2) {
+static inline int float_dist(float f1, float f2) {
return *((int *)(&f1)) - *((int *)(&f2));
}
/* Check if two floats are essentially equal. Will fail with some values
due to design. (Validate using FLT_EPSILON or similar if necessary.) */
-static bool float_almost_equal(float f1, float f2) {
+static inline bool float_almost_equal(float f1, float f2) {
int *i1 = (int*)(&f1);
int *i2 = (int*)(&f2);
@@ -111,4 +111,3 @@ static bool float_almost_equal(float f1, float f2) {
/* These constants must match those in UnitTest.java */
static const int RS_MSG_TEST_PASSED = 100;
static const int RS_MSG_TEST_FAILED = 101;
-