summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/RenderScript.cpp2
-rw-r--r--cpp/rsCppStructs.h4
-rw-r--r--driver/rsdAllocation.cpp2
-rw-r--r--driver/rsdCore.cpp2
-rw-r--r--java/tests/Balls/src/com/example/android/rs/balls/balls.rs2
-rw-r--r--java/tests/ComputeBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs23
-rw-r--r--java/tests/ImageProcessing/src/com/android/rs/image/bwfilter.rs2
-rw-r--r--java/tests/ImageProcessing/src/com/android/rs/image/threshold.rs5
-rw-r--r--java/tests/ImageProcessing/src/com/android/rs/image/vibrance.rs7
-rw-r--r--java/tests/ImageProcessing2/src/com/android/rs/image/vibrance.rs1
-rw-r--r--java/tests/ImageProcessing_jb/src/com/android/rs/image/bwfilter.rs2
-rw-r--r--java/tests/ImageProcessing_jb/src/com/android/rs/image/threshold.rs5
-rw-r--r--java/tests/ImageProcessing_jb/src/com/android/rs/image/vibrance.rs7
-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
-rw-r--r--java/tests/RsTest/src/com/android/rs/test/element.rs8
-rw-r--r--java/tests/RsTest/src/com/android/rs/test/fp_mad.rs8
-rw-r--r--java/tests/RsTest/src/com/android/rs/test/math.rs3
-rw-r--r--java/tests/RsTest/src/com/android/rs/test/math_agree.rs7
-rw-r--r--java/tests/RsTest/src/com/android/rs/test/rstypes.rs14
-rw-r--r--java/tests/RsTest/src/com/android/rs/test/shared.rsh25
-rw-r--r--java/tests/RsTest_11/src/com/android/rs/test/fp_mad.rs8
-rw-r--r--java/tests/RsTest_11/src/com/android/rs/test/rstypes.rs18
-rw-r--r--java/tests/RsTest_11/src/com/android/rs/test/shared.rsh5
-rw-r--r--java/tests/RsTest_14/src/com/android/rs/test/fp_mad.rs8
-rw-r--r--java/tests/RsTest_14/src/com/android/rs/test/rstypes.rs20
-rw-r--r--java/tests/RsTest_14/src/com/android/rs/test/shared.rsh5
-rw-r--r--java/tests/RsTest_16/src/com/android/rs/test/fp_mad.rs8
-rw-r--r--java/tests/RsTest_16/src/com/android/rs/test/rstypes.rs18
-rw-r--r--java/tests/RsTest_16/src/com/android/rs/test/shared.rsh5
-rw-r--r--java/tests/ScriptGroupTest/src/com/android/rs/sgtest/vibrance_f.rs1
-rw-r--r--java/tests/VrDemo/src/com/example/android/rs/vr/engine/bugdroid.rs2
-rw-r--r--java/tests/VrDemo/src/com/example/android/rs/vr/engine/mandelbulb.rs6
-rw-r--r--java/tests/VrDemo/src/com/example/android/rs/vr/engine/vr.rs5
-rw-r--r--rsAllocation.cpp6
-rw-r--r--rsContext.cpp30
-rw-r--r--rsContext.h26
-rw-r--r--rsDefines.h3
-rw-r--r--rsDriverLoader.cpp1
-rw-r--r--rs_hal.h5
-rwxr-xr-xupdate_rs_prebuilts.sh15
44 files changed, 217 insertions, 173 deletions
diff --git a/cpp/RenderScript.cpp b/cpp/RenderScript.cpp
index c05e0f90..aa7dbd72 100644
--- a/cpp/RenderScript.cpp
+++ b/cpp/RenderScript.cpp
@@ -165,7 +165,7 @@ bool RS::init(const char * name, int targetApi, uint32_t flags) {
}
if (flags & ~(RS_CONTEXT_SYNCHRONOUS | RS_CONTEXT_LOW_LATENCY |
- RS_CONTEXT_LOW_POWER)) {
+ RS_CONTEXT_LOW_POWER | RS_CONTEXT_WAIT_FOR_ATTACH)) {
ALOGE("Invalid flags passed");
return false;
}
diff --git a/cpp/rsCppStructs.h b/cpp/rsCppStructs.h
index f3f7f31e..e7acbedc 100644
--- a/cpp/rsCppStructs.h
+++ b/cpp/rsCppStructs.h
@@ -80,7 +80,9 @@ class Sampler;
enum RSInitFlags {
RS_INIT_SYNCHRONOUS = 1, ///< All RenderScript calls will be synchronous. May reduce latency.
RS_INIT_LOW_LATENCY = 2, ///< Prefer low latency devices over potentially higher throughput devices.
- RS_INIT_MAX = 4
+ // Bitflag 4 is reserved for the context flag low power
+ RS_INIT_WAIT_FOR_ATTACH = 8, ///< Kernel execution will hold to give time for a debugger to be attached
+ RS_INIT_MAX = 16
};
/**
diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp
index 34670867..94efab24 100644
--- a/driver/rsdAllocation.cpp
+++ b/driver/rsdAllocation.cpp
@@ -553,7 +553,7 @@ void rsdAllocationDestroy(const Context *rsc, Allocation *alloc) {
if (nw) {
GraphicBufferMapper &mapper = GraphicBufferMapper::get();
mapper.unlock(drv->wndBuffer->handle);
- int32_t r = nw->queueBuffer(nw, drv->wndBuffer, -1);
+ int32_t r = nw->cancelBuffer(nw, drv->wndBuffer, -1);
drv->wndSurface = nullptr;
native_window_api_disconnect(nw, NATIVE_WINDOW_API_CPU);
diff --git a/driver/rsdCore.cpp b/driver/rsdCore.cpp
index 9c4755c5..d65460c8 100644
--- a/driver/rsdCore.cpp
+++ b/driver/rsdCore.cpp
@@ -154,6 +154,8 @@ extern "C" bool rsdHalQueryHal(RsHalInitEnums entry, void **fnPtr) {
fnPtr[0] = (void *)rsdAllocationUpdateCachedObject; break;
case RS_HAL_ALLOCATION_ADAPTER_OFFSET:
fnPtr[0] = (void *)rsdAllocationAdapterOffset; break;
+ case RS_HAL_ALLOCATION_GET_POINTER:
+ fnPtr[0] = (void *)nullptr; break;
case RS_HAL_SAMPLER_INIT:
fnPtr[0] = (void *)rsdSamplerInit; break;
diff --git a/java/tests/Balls/src/com/example/android/rs/balls/balls.rs b/java/tests/Balls/src/com/example/android/rs/balls/balls.rs
index 077916db..bb51db65 100644
--- a/java/tests/Balls/src/com/example/android/rs/balls/balls.rs
+++ b/java/tests/Balls/src/com/example/android/rs/balls/balls.rs
@@ -46,7 +46,7 @@ int root() {
int2 gridDims = (int2){ rsAllocationGetDimX(gGrid),
rsAllocationGetDimY(gGrid) };
- rs_allocation aNull; // Empty rs_allocation, since we don't have an input.
+ rs_allocation aNull = {0}; // Empty rs_allocation, since we don't have an input.
rs_allocation aout = rsGetAllocation(balls);
int32_t dimX = rsAllocationGetDimX(aout);
diff --git a/java/tests/ComputeBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs b/java/tests/ComputeBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs
index 2ee56ec9..fb8baaae 100644
--- a/java/tests/ComputeBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs
+++ b/java/tests/ComputeBenchmark/src/com/example/android/rs/computebench/compute_benchmark.rs
@@ -60,13 +60,22 @@ static volatile long4 prefix##_l_4 = 1; \
static volatile ulong prefix##_ul_1 = 1; \
static volatile ulong2 prefix##_ul_2 = 1; \
static volatile ulong3 prefix##_ul_3 = 1; \
-static volatile ulong4 prefix##_ul_4 = 1; \
+static volatile ulong4 prefix##_ul_4 = 1;
DECL_VAR_SET(res)
DECL_VAR_SET(src1)
DECL_VAR_SET(src2)
-DECL_VAR_SET(src3)
+static volatile float src3_f_1 = 1; \
+static volatile float2 src3_f_2 = 1; \
+static volatile float3 src3_f_3 = 1; \
+static volatile float4 src3_f_4 = 1; \
+static volatile char src3_c_1 = 1; \
+static volatile uchar src3_uc_1 = 1; \
+static volatile short src3_s_1 = 1; \
+static volatile ushort src3_us_1 = 1; \
+static volatile int src3_i_1 = 1; \
+static volatile uint src3_ui_1 = 1; \
// Testing macros
@@ -95,6 +104,8 @@ DECL_VAR_SET(src3)
BENCH_BASIC_OP_TYPE(op, us) \
BENCH_BASIC_OP_TYPE(op, i) \
BENCH_BASIC_OP_TYPE(op, ui) \
+ BENCH_BASIC_OP_TYPE(op, l) \
+ BENCH_BASIC_OP_TYPE(op, ul) \
RUN_BENCH(res_l_1 = src1_l_1 op src2_l_1, "l1 " #op " l1") \
RUN_BENCH(res_ul_1 = src1_ul_1 op src2_ul_1, "ul1 " #op " ul1")
@@ -116,6 +127,8 @@ DECL_VAR_SET(src3)
BENCH_CVT(to, us, type); \
BENCH_CVT(to, i, type); \
BENCH_CVT(to, ui, type); \
+ BENCH_CVT(to, l, type); \
+ BENCH_CVT(to, ul, type); \
BENCH_CVT(to, f, type); \
#define BENCH_XN_FUNC_YN(typeout, fnc, typein) \
@@ -266,7 +279,6 @@ DECL_VAR_SET(src3)
// Testing functions
static void bench_basic_operators() {
- int i = 0;
BENCH_BASIC_OP(+);
BENCH_BASIC_OP(-);
BENCH_BASIC_OP(*);
@@ -283,6 +295,8 @@ static void bench_convert() {
BENCH_CVT_MATRIX(us, ushort);
BENCH_CVT_MATRIX(i, int);
BENCH_CVT_MATRIX(ui, uint);
+ BENCH_CVT_MATRIX(l, long);
+ BENCH_CVT_MATRIX(ul, ulong);
BENCH_CVT_MATRIX(f, float);
}
@@ -291,7 +305,7 @@ static void bench_int_math() {
BENCH_IN_FUNC_IN(clz);
BENCH_IN_FUNC_IN_IN(min);
BENCH_IN_FUNC_IN_IN(max);
- BENCH_I_FUNC_I_I_I(rsClamp);
+ BENCH_I_FUNC_I_I_I(clamp);
}
static void bench_fp_math() {
@@ -404,4 +418,3 @@ void bench() {
bench_fp_math();
bench_approx_math();
}
-
diff --git a/java/tests/ImageProcessing/src/com/android/rs/image/bwfilter.rs b/java/tests/ImageProcessing/src/com/android/rs/image/bwfilter.rs
index e2116209..23f64f59 100644
--- a/java/tests/ImageProcessing/src/com/android/rs/image/bwfilter.rs
+++ b/java/tests/ImageProcessing/src/com/android/rs/image/bwfilter.rs
@@ -48,5 +48,5 @@ void bwFilterKernel(const uchar4 *in, uchar4 *out) {
localMax = fmax(g,b);
localMax = fmax(r,localMax);
avg = (localMin+localMax) * 0.5f;
- out->r = out->g = out->b = rsClamp(avg, 0, 255);
+ out->r = out->g = out->b = clamp((int) avg, 0, 255);
}
diff --git a/java/tests/ImageProcessing/src/com/android/rs/image/threshold.rs b/java/tests/ImageProcessing/src/com/android/rs/image/threshold.rs
index 40d4fa2d..1309df59 100644
--- a/java/tests/ImageProcessing/src/com/android/rs/image/threshold.rs
+++ b/java/tests/ImageProcessing/src/com/android/rs/image/threshold.rs
@@ -85,7 +85,7 @@ uchar4 RS_KERNEL vert(uint32_t x, uint32_t y) {
}
} else {
for (int r = -radius; r <= radius; r ++) {
- int validH = rsClamp((int)y + r, (int)0, (int)(height - 1));
+ int validH = clamp((int)y + r, (int)0, (int)(height - 1));
float4 i = rsGetElementAt_float4(ScratchPixel2, x, validH);
blurredPixel += i.xyz * gaussian[gi++];
}
@@ -107,7 +107,7 @@ float4 RS_KERNEL horz(uint32_t x, uint32_t y) {
} else {
for (int r = -radius; r <= radius; r ++) {
// Stepping left and right away from the pixel
- int validX = rsClamp((int)x + r, (int)0, (int)(width - 1));
+ int validX = clamp((int)x + r, (int)0, (int)(width - 1));
float4 i = rsGetElementAt_float4(ScratchPixel1, validX, y);
blurredPixel += i * gaussian[gi++];
}
@@ -115,4 +115,3 @@ float4 RS_KERNEL horz(uint32_t x, uint32_t y) {
return blurredPixel;
}
-
diff --git a/java/tests/ImageProcessing/src/com/android/rs/image/vibrance.rs b/java/tests/ImageProcessing/src/com/android/rs/image/vibrance.rs
index 865c77ef..acd9cf9a 100644
--- a/java/tests/ImageProcessing/src/com/android/rs/image/vibrance.rs
+++ b/java/tests/ImageProcessing/src/com/android/rs/image/vibrance.rs
@@ -35,7 +35,6 @@ uchar4 RS_KERNEL vibranceKernel(uchar4 in) {
float Rt = Rf * MS;
float Gt = Gf * MS;
float Bt = Bf * MS;
- int t = (r + g) >> 1;
float R = r;
float G = g;
@@ -46,9 +45,9 @@ uchar4 RS_KERNEL vibranceKernel(uchar4 in) {
float Bc = R * Rt + G * Gt + B * (Bt + S);
uchar4 o;
- o.r = rsClamp(Rc, 0, 255);
- o.g = rsClamp(Gc, 0, 255);
- o.b = rsClamp(Bc, 0, 255);
+ o.r = clamp((int) Rc, 0, 255);
+ o.g = clamp((int) Gc, 0, 255);
+ o.b = clamp((int) Bc, 0, 255);
o.a = 0xff;
return o;
}
diff --git a/java/tests/ImageProcessing2/src/com/android/rs/image/vibrance.rs b/java/tests/ImageProcessing2/src/com/android/rs/image/vibrance.rs
index 865c77ef..7a492c08 100644
--- a/java/tests/ImageProcessing2/src/com/android/rs/image/vibrance.rs
+++ b/java/tests/ImageProcessing2/src/com/android/rs/image/vibrance.rs
@@ -35,7 +35,6 @@ uchar4 RS_KERNEL vibranceKernel(uchar4 in) {
float Rt = Rf * MS;
float Gt = Gf * MS;
float Bt = Bf * MS;
- int t = (r + g) >> 1;
float R = r;
float G = g;
diff --git a/java/tests/ImageProcessing_jb/src/com/android/rs/image/bwfilter.rs b/java/tests/ImageProcessing_jb/src/com/android/rs/image/bwfilter.rs
index e2116209..23f64f59 100644
--- a/java/tests/ImageProcessing_jb/src/com/android/rs/image/bwfilter.rs
+++ b/java/tests/ImageProcessing_jb/src/com/android/rs/image/bwfilter.rs
@@ -48,5 +48,5 @@ void bwFilterKernel(const uchar4 *in, uchar4 *out) {
localMax = fmax(g,b);
localMax = fmax(r,localMax);
avg = (localMin+localMax) * 0.5f;
- out->r = out->g = out->b = rsClamp(avg, 0, 255);
+ out->r = out->g = out->b = clamp((int) avg, 0, 255);
}
diff --git a/java/tests/ImageProcessing_jb/src/com/android/rs/image/threshold.rs b/java/tests/ImageProcessing_jb/src/com/android/rs/image/threshold.rs
index 40d4fa2d..1309df59 100644
--- a/java/tests/ImageProcessing_jb/src/com/android/rs/image/threshold.rs
+++ b/java/tests/ImageProcessing_jb/src/com/android/rs/image/threshold.rs
@@ -85,7 +85,7 @@ uchar4 RS_KERNEL vert(uint32_t x, uint32_t y) {
}
} else {
for (int r = -radius; r <= radius; r ++) {
- int validH = rsClamp((int)y + r, (int)0, (int)(height - 1));
+ int validH = clamp((int)y + r, (int)0, (int)(height - 1));
float4 i = rsGetElementAt_float4(ScratchPixel2, x, validH);
blurredPixel += i.xyz * gaussian[gi++];
}
@@ -107,7 +107,7 @@ float4 RS_KERNEL horz(uint32_t x, uint32_t y) {
} else {
for (int r = -radius; r <= radius; r ++) {
// Stepping left and right away from the pixel
- int validX = rsClamp((int)x + r, (int)0, (int)(width - 1));
+ int validX = clamp((int)x + r, (int)0, (int)(width - 1));
float4 i = rsGetElementAt_float4(ScratchPixel1, validX, y);
blurredPixel += i * gaussian[gi++];
}
@@ -115,4 +115,3 @@ float4 RS_KERNEL horz(uint32_t x, uint32_t y) {
return blurredPixel;
}
-
diff --git a/java/tests/ImageProcessing_jb/src/com/android/rs/image/vibrance.rs b/java/tests/ImageProcessing_jb/src/com/android/rs/image/vibrance.rs
index 865c77ef..acd9cf9a 100644
--- a/java/tests/ImageProcessing_jb/src/com/android/rs/image/vibrance.rs
+++ b/java/tests/ImageProcessing_jb/src/com/android/rs/image/vibrance.rs
@@ -35,7 +35,6 @@ uchar4 RS_KERNEL vibranceKernel(uchar4 in) {
float Rt = Rf * MS;
float Gt = Gf * MS;
float Bt = Bf * MS;
- int t = (r + g) >> 1;
float R = r;
float G = g;
@@ -46,9 +45,9 @@ uchar4 RS_KERNEL vibranceKernel(uchar4 in) {
float Bc = R * Rt + G * Gt + B * (Bt + S);
uchar4 o;
- o.r = rsClamp(Rc, 0, 255);
- o.g = rsClamp(Gc, 0, 255);
- o.b = rsClamp(Bc, 0, 255);
+ o.r = clamp((int) Rc, 0, 255);
+ o.g = clamp((int) Gc, 0, 255);
+ o.b = clamp((int) Bc, 0, 255);
o.a = 0xff;
return o;
}
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;
-
diff --git a/java/tests/RsTest/src/com/android/rs/test/element.rs b/java/tests/RsTest/src/com/android/rs/test/element.rs
index 419ce074..95b29a31 100644
--- a/java/tests/RsTest/src/com/android/rs/test/element.rs
+++ b/java/tests/RsTest/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]) {
diff --git a/java/tests/RsTest/src/com/android/rs/test/fp_mad.rs b/java/tests/RsTest/src/com/android/rs/test/fp_mad.rs
index b6f2b2a6..62ef3ecf 100644
--- a/java/tests/RsTest/src/com/android/rs/test/fp_mad.rs
+++ b/java/tests/RsTest/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++) {
@@ -170,5 +164,3 @@ void fp_mad_test(uint32_t index, int test_num) {
rsDebug("fp_mad_test PASSED", 0);
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
}
-
-
diff --git a/java/tests/RsTest/src/com/android/rs/test/math.rs b/java/tests/RsTest/src/com/android/rs/test/math.rs
index 2c0521bf..f3eac553 100644
--- a/java/tests/RsTest/src/com/android/rs/test/math.rs
+++ b/java/tests/RsTest/src/com/android/rs/test/math.rs
@@ -355,7 +355,7 @@ static bool test_int_math(uint32_t index) {
TEST_IN_FUNC_IN(clz);
TEST_IN_FUNC_IN_IN(min);
TEST_IN_FUNC_IN_IN(max);
- TEST_I_FUNC_I_I_I(rsClamp);
+ TEST_I_FUNC_I_I_I(clamp);
float time = end(index);
@@ -442,4 +442,3 @@ void math_test(uint32_t index, int test_num) {
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
}
}
-
diff --git a/java/tests/RsTest/src/com/android/rs/test/math_agree.rs b/java/tests/RsTest/src/com/android/rs/test/math_agree.rs
index 5bfbb2bf..489cc277 100644
--- a/java/tests/RsTest/src/com/android/rs/test/math_agree.rs
+++ b/java/tests/RsTest/src/com/android/rs/test/math_agree.rs
@@ -343,13 +343,9 @@ TEST_UC_UC_ALL(func) \
TEST_SS_SS_ALL(func) \
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_UI_UI_ALL(func) \
TEST_SL_SL_ALL(func) \
TEST_UL_UL_ALL(func)
-#endif
#define DECLARE_TEMP_SET(type, abbrev) \
volatile type temp_##abbrev##1; \
@@ -406,4 +402,3 @@ void math_agree_test() {
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
}
}
-
diff --git a/java/tests/RsTest/src/com/android/rs/test/rstypes.rs b/java/tests/RsTest/src/com/android/rs/test/rstypes.rs
index bec124dd..088fe508 100644
--- a/java/tests/RsTest/src/com/android/rs/test/rstypes.rs
+++ b/java/tests/RsTest/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,12 +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;
-
- //allocationTestLocal = allocationTest;
-
- //allocationTest = allocationTestLocal;
+ (void) structTest;
/*for (int i = 0; i < 4; i++) {
fontTestLocalArray[i] = fontTestLocal;
@@ -58,4 +63,3 @@ void test_rstypes(uint32_t index, int test_num) {
rsDebug("rstypes_test PASSED", 0);
}
}
-
diff --git a/java/tests/RsTest/src/com/android/rs/test/shared.rsh b/java/tests/RsTest/src/com/android/rs/test/shared.rsh
index 0281383b..de7135cc 100644
--- a/java/tests/RsTest/src/com/android/rs/test/shared.rsh
+++ b/java/tests/RsTest/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);
@@ -38,42 +38,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);
}
@@ -87,13 +87,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);
@@ -114,4 +114,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;
-
diff --git a/java/tests/RsTest_11/src/com/android/rs/test/fp_mad.rs b/java/tests/RsTest_11/src/com/android/rs/test/fp_mad.rs
index b6f2b2a6..62ef3ecf 100644
--- a/java/tests/RsTest_11/src/com/android/rs/test/fp_mad.rs
+++ b/java/tests/RsTest_11/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++) {
@@ -170,5 +164,3 @@ void fp_mad_test(uint32_t index, int test_num) {
rsDebug("fp_mad_test PASSED", 0);
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
}
-
-
diff --git a/java/tests/RsTest_11/src/com/android/rs/test/rstypes.rs b/java/tests/RsTest_11/src/com/android/rs/test/rstypes.rs
index f3bf2448..afda39f8 100644
--- a/java/tests/RsTest_11/src/com/android/rs/test/rstypes.rs
+++ b/java/tests/RsTest_11/src/com/android/rs/test/rstypes.rs
@@ -28,6 +28,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;
@@ -41,12 +44,26 @@ static bool basic_test(uint32_t index) {
rs_program_raster program_rasterTestLocal;
rs_program_store program_storeTestLocal;
rs_font fontTestLocal;
+ (void) elementTestLocal;
+ (void) typeTestLocal;
+ (void) allocationTestLocal;
+ (void) samplerTestLocal;
+ (void) scriptTestLocal;
+ (void) meshTestLocal;
+ (void) program_fragmentTestLocal;
+ (void) program_vertexTestLocal;
+ (void) program_rasterTestLocal;
+ (void) program_storeTestLocal;
+ (void) fontTestLocal;
rs_font fontTestLocalArray[4];
+ (void) fontTestLocalArray;
rs_font fontTestLocalPreInit = fontTest;
+ (void) fontTestLocalPreInit;
struct my_struct structTest;
+ (void) structTest;
rsSetObject(&fontTestLocal, fontTest);
//allocationTestLocal = allocationTest;
@@ -76,4 +93,3 @@ void test_rstypes(uint32_t index, int test_num) {
rsDebug("rstypes_test PASSED", 0);
}
}
-
diff --git a/java/tests/RsTest_11/src/com/android/rs/test/shared.rsh b/java/tests/RsTest_11/src/com/android/rs/test/shared.rsh
index 6d34481c..b548e120 100644
--- a/java/tests/RsTest_11/src/com/android/rs/test/shared.rsh
+++ b/java/tests/RsTest_11/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,4 +35,3 @@ do { \
/* These constants must match those in UnitTest.java */
static const int RS_MSG_TEST_PASSED = 100;
static const int RS_MSG_TEST_FAILED = 101;
-
diff --git a/java/tests/RsTest_14/src/com/android/rs/test/fp_mad.rs b/java/tests/RsTest_14/src/com/android/rs/test/fp_mad.rs
index b6f2b2a6..62ef3ecf 100644
--- a/java/tests/RsTest_14/src/com/android/rs/test/fp_mad.rs
+++ b/java/tests/RsTest_14/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++) {
@@ -170,5 +164,3 @@ void fp_mad_test(uint32_t index, int test_num) {
rsDebug("fp_mad_test PASSED", 0);
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
}
-
-
diff --git a/java/tests/RsTest_14/src/com/android/rs/test/rstypes.rs b/java/tests/RsTest_14/src/com/android/rs/test/rstypes.rs
index 22d9c138..8577604d 100644
--- a/java/tests/RsTest_14/src/com/android/rs/test/rstypes.rs
+++ b/java/tests/RsTest_14/src/com/android/rs/test/rstypes.rs
@@ -28,6 +28,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;
@@ -41,18 +44,30 @@ static bool basic_test(uint32_t index) {
rs_program_raster program_rasterTestLocal;
rs_program_store program_storeTestLocal;
rs_font fontTestLocal;
+ (void) elementTestLocal;
+ (void) typeTestLocal;
+ (void) allocationTestLocal;
+ (void) samplerTestLocal;
+ (void) scriptTestLocal;
+ (void) meshTestLocal;
+ (void) program_fragmentTestLocal;
+ (void) program_vertexTestLocal;
+ (void) program_rasterTestLocal;
+ (void) program_storeTestLocal;
+ (void) fontTestLocal;
rs_font fontTestLocalArray[4];
+ (void) fontTestLocalArray;
rs_font fontTestLocalPreInit = fontTest;
+ (void) fontTestLocalPreInit;
struct my_struct structTest;
+ (void) structTest;
fontTestLocal = fontTest;
- //allocationTestLocal = allocationTest;
fontTest = fontTestLocal;
- //allocationTest = allocationTestLocal;
/*for (int i = 0; i < 4; i++) {
fontTestLocalArray[i] = fontTestLocal;
@@ -76,4 +91,3 @@ void test_rstypes(uint32_t index, int test_num) {
rsDebug("rstypes_test PASSED", 0);
}
}
-
diff --git a/java/tests/RsTest_14/src/com/android/rs/test/shared.rsh b/java/tests/RsTest_14/src/com/android/rs/test/shared.rsh
index 4a7151ff..40f1062c 100644
--- a/java/tests/RsTest_14/src/com/android/rs/test/shared.rsh
+++ b/java/tests/RsTest_14/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,4 +35,3 @@ do { \
/* These constants must match those in UnitTest.java */
static const int RS_MSG_TEST_PASSED = 100;
static const int RS_MSG_TEST_FAILED = 101;
-
diff --git a/java/tests/RsTest_16/src/com/android/rs/test/fp_mad.rs b/java/tests/RsTest_16/src/com/android/rs/test/fp_mad.rs
index b6f2b2a6..62ef3ecf 100644
--- a/java/tests/RsTest_16/src/com/android/rs/test/fp_mad.rs
+++ b/java/tests/RsTest_16/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++) {
@@ -170,5 +164,3 @@ void fp_mad_test(uint32_t index, int test_num) {
rsDebug("fp_mad_test PASSED", 0);
rsSendToClientBlocking(RS_MSG_TEST_PASSED);
}
-
-
diff --git a/java/tests/RsTest_16/src/com/android/rs/test/rstypes.rs b/java/tests/RsTest_16/src/com/android/rs/test/rstypes.rs
index 22d9c138..a517189f 100644
--- a/java/tests/RsTest_16/src/com/android/rs/test/rstypes.rs
+++ b/java/tests/RsTest_16/src/com/android/rs/test/rstypes.rs
@@ -28,6 +28,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;
@@ -41,12 +44,26 @@ static bool basic_test(uint32_t index) {
rs_program_raster program_rasterTestLocal;
rs_program_store program_storeTestLocal;
rs_font fontTestLocal;
+ rsClearObject(&elementTestLocal);
+ rsClearObject(&typeTestLocal);
+ rsClearObject(&allocationTestLocal);
+ rsClearObject(&samplerTestLocal);
+ rsClearObject(&scriptTestLocal);
+ rsClearObject(&meshTestLocal);
+ rsClearObject(&program_fragmentTestLocal);
+ rsClearObject(&program_vertexTestLocal);
+ rsClearObject(&program_rasterTestLocal);
+ rsClearObject(&program_storeTestLocal);
+ rsClearObject(&fontTestLocal);
rs_font fontTestLocalArray[4];
+ (void) fontTestLocalArray;
rs_font fontTestLocalPreInit = fontTest;
+ (void) fontTestLocalPreInit;
struct my_struct structTest;
+ (void) structTest;
fontTestLocal = fontTest;
//allocationTestLocal = allocationTest;
@@ -76,4 +93,3 @@ void test_rstypes(uint32_t index, int test_num) {
rsDebug("rstypes_test PASSED", 0);
}
}
-
diff --git a/java/tests/RsTest_16/src/com/android/rs/test/shared.rsh b/java/tests/RsTest_16/src/com/android/rs/test/shared.rsh
index b5057d06..17222f30 100644
--- a/java/tests/RsTest_16/src/com/android/rs/test/shared.rsh
+++ b/java/tests/RsTest_16/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,4 +35,3 @@ do { \
/* These constants must match those in UnitTest.java */
static const int RS_MSG_TEST_PASSED = 100;
static const int RS_MSG_TEST_FAILED = 101;
-
diff --git a/java/tests/ScriptGroupTest/src/com/android/rs/sgtest/vibrance_f.rs b/java/tests/ScriptGroupTest/src/com/android/rs/sgtest/vibrance_f.rs
index 663652cc..d13ef0d4 100644
--- a/java/tests/ScriptGroupTest/src/com/android/rs/sgtest/vibrance_f.rs
+++ b/java/tests/ScriptGroupTest/src/com/android/rs/sgtest/vibrance_f.rs
@@ -35,7 +35,6 @@ float4 RS_KERNEL vibranceKernel(float4 in) {
float Rt = Rf * MS;
float Gt = Gf * MS;
float Bt = Bf * MS;
- int t = (r + g) >> 1;
float R = r;
float G = g;
diff --git a/java/tests/VrDemo/src/com/example/android/rs/vr/engine/bugdroid.rs b/java/tests/VrDemo/src/com/example/android/rs/vr/engine/bugdroid.rs
index 4cdfc121..1f72f2e6 100644
--- a/java/tests/VrDemo/src/com/example/android/rs/vr/engine/bugdroid.rs
+++ b/java/tests/VrDemo/src/com/example/android/rs/vr/engine/bugdroid.rs
@@ -92,11 +92,13 @@ static float distanceDisk(float3 center, float radius, float3 normal,
return tmp1;
}
+/* Unused function:
static short disk(float3 center, float circleRadius, float3 normal, float rad,
short max, float3 img) {
return (short) (max
* sigmoid(distanceDisk(center, circleRadius, normal, img) - rad));
}
+*/
static short cogDisk(float3 center, float circleRadius, float3 normal,
float rad, short max, float3 img) {
diff --git a/java/tests/VrDemo/src/com/example/android/rs/vr/engine/mandelbulb.rs b/java/tests/VrDemo/src/com/example/android/rs/vr/engine/mandelbulb.rs
index 23c1bc64..52bf75ca 100644
--- a/java/tests/VrDemo/src/com/example/android/rs/vr/engine/mandelbulb.rs
+++ b/java/tests/VrDemo/src/com/example/android/rs/vr/engine/mandelbulb.rs
@@ -22,6 +22,7 @@ int size;
int z;
rs_allocation volume;
+/* Unused function:
static float3 nylander(float3 p, int n) {
float3 out;
float r = length(p);
@@ -33,6 +34,7 @@ static float3 nylander(float3 p, int n) {
out.z = cos(n * theta);
return out * rn;
}
+*/
/**
* 8 x faster than the above for n = 3
@@ -48,10 +50,6 @@ static float3 nylander3(float3 p) {
return out;
}
-static float vsize(float3 p) {
- return sqrt(p.x * p.x + p.y * p.y + p.z * p.z);
-}
-
short __attribute__((kernel)) mandelbulb(uint32_t x, uint32_t y) {
int size2 = size / 2;
if (z < size2) {
diff --git a/java/tests/VrDemo/src/com/example/android/rs/vr/engine/vr.rs b/java/tests/VrDemo/src/com/example/android/rs/vr/engine/vr.rs
index 2b51eeee..e3004cc4 100644
--- a/java/tests/VrDemo/src/com/example/android/rs/vr/engine/vr.rs
+++ b/java/tests/VrDemo/src/com/example/android/rs/vr/engine/vr.rs
@@ -104,7 +104,6 @@ uchar4 __attribute__ ((kernel)) draw_z_buffer(float2 in, uint32_t x, uint32_t y)
float zstart = zsuface;
float zend = in.y - 2.f;//0.5f;
float zlen = zend - zstart;
- float step_dist = length(dz);
if (zstart == FLOAT_MAX || zlen < 0) {
return out;
@@ -124,7 +123,7 @@ uchar4 __attribute__ ((kernel)) draw_z_buffer(float2 in, uint32_t x, uint32_t y)
int intensity = (((short) pix) & 0xFFFF);
// intensity = clamp(intensity,0,400);
uchar4 color = rsGetElementAt_uchar4(color_map, intensity * 2);
- int op = rsGetElementAt_uchar(opacity, intensity);
+ // int op = rsGetElementAt_uchar(opacity, intensity);
out.r = color.r;
out.g = color.g;
@@ -167,7 +166,7 @@ uchar4 __attribute__ ((kernel)) draw_z_buffer(float2 in, uint32_t x, uint32_t y)
float4 fcolor = convert_float4(color);;
float ambient = mat.x * (1/255.f);
- float specular = mat.y * (1/255.f);
+ // float specular = mat.y * (1/255.f);
float diffuse = mat.z * (1/255.f);
float lop = (ambient + diffuse * dot_prod) * light * opf;
light -= opf;
diff --git a/rsAllocation.cpp b/rsAllocation.cpp
index a7601a46..3bdbf7b9 100644
--- a/rsAllocation.cpp
+++ b/rsAllocation.cpp
@@ -167,8 +167,12 @@ void * Allocation::getPointer(const Context *rsc, uint32_t lod, RsAllocationCube
return nullptr;
}
+ if (mRSC->mHal.funcs.allocation.getPointer != nullptr) {
+ // Notify the driver, if present that the user is mapping the buffer
+ mRSC->mHal.funcs.allocation.getPointer(rsc, this, lod, face, z, array);
+ }
+
size_t s = 0;
- //void *ptr = mRSC->mHal.funcs.allocation.lock1D(rsc, this);
if ((stride != nullptr) && mHal.drvState.lod[0].dimY) {
*stride = mHal.drvState.lod[lod].stride;
}
diff --git a/rsContext.cpp b/rsContext.cpp
index 29b4036f..c21542f1 100644
--- a/rsContext.cpp
+++ b/rsContext.cpp
@@ -45,6 +45,8 @@
#include "rsCompatibilityLib.h"
#endif
+int gDebuggerPresent = 0;
+
#ifdef RS_SERVER
// Android exposes gettid(), standard Linux does not
static pid_t gettid() {
@@ -459,6 +461,29 @@ Context::Context() {
mContextType = RS_CONTEXT_TYPE_NORMAL;
mSynchronous = false;
mFatalErrorOccured = false;
+
+ memset(mCacheDir, 0, sizeof(mCacheDir));
+#ifdef RS_COMPATIBILITY_LIB
+ memset(nativeLibDir, 0, sizeof(nativeLibDir));
+#endif
+}
+
+void Context::setCacheDir(const char * cacheDir_arg, uint32_t length) {
+ if (!hasSetCacheDir) {
+ if (length <= PATH_MAX) {
+ memcpy(mCacheDir, cacheDir_arg, length);
+ mCacheDir[length] = 0;
+ hasSetCacheDir = true;
+ } else {
+ setError(RS_ERROR_BAD_VALUE, "Invalid path");
+ }
+ }
+}
+
+void Context::waitForDebugger() {
+ while (!gDebuggerPresent) {
+ sleep(0);
+ }
}
Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc,
@@ -478,6 +503,11 @@ Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc,
delete rsc;
return nullptr;
}
+
+ if (flags & RS_CONTEXT_WAIT_FOR_ATTACH) {
+ rsc->waitForDebugger();
+ }
+
return rsc;
}
diff --git a/rsContext.h b/rsContext.h
index 6cb0ed76..918e5e3f 100644
--- a/rsContext.h
+++ b/rsContext.h
@@ -45,6 +45,13 @@
#endif
+/*
+ * This global will be found by the debugger and will have its value flipped.
+ * It's independent of the Context class to allow the debugger to do the above
+ * without knowing the type makeup. This allows the debugger to be attached at
+ * an earlier stage.
+*/
+extern "C" int gDebuggerPresent;
// ---------------------------------------------------------------------------
namespace android {
@@ -258,6 +265,7 @@ public:
if (!hasSetNativeLibDir) {
if (length <= PATH_MAX) {
memcpy(nativeLibDir, libDir, length);
+ nativeLibDir[length] = 0;
hasSetNativeLibDir = true;
} else {
setError(RS_ERROR_BAD_VALUE, "Invalid path");
@@ -269,18 +277,12 @@ public:
}
#endif
- void setCacheDir(const char * cacheDir_arg, uint32_t length) {
- if (!hasSetCacheDir) {
- if (length <= PATH_MAX) {
- memcpy(mCacheDir, cacheDir_arg, length);
- hasSetCacheDir = true;
- } else {
- setError(RS_ERROR_BAD_VALUE, "Invalid path");
- }
- }
- }
+ void setCacheDir(const char * cacheDir_arg, uint32_t length);
const char * getCacheDir() {
- return mCacheDir;
+ if (hasSetCacheDir) {
+ return mCacheDir;
+ }
+ return nullptr;
}
// Returns the actual loaded driver's name (like "libRSDriver.so").
@@ -326,7 +328,7 @@ protected:
private:
Context();
bool initContext(Device *, const RsSurfaceConfig *sc);
-
+ void waitForDebugger();
bool mSynchronous;
bool initGLThread();
void deinitEGL();
diff --git a/rsDefines.h b/rsDefines.h
index fdb07208..a8957a86 100644
--- a/rsDefines.h
+++ b/rsDefines.h
@@ -252,7 +252,8 @@ typedef struct {
enum RsContextFlags {
RS_CONTEXT_SYNCHRONOUS = 0x0001,
RS_CONTEXT_LOW_LATENCY = 0x0002,
- RS_CONTEXT_LOW_POWER = 0x0004
+ RS_CONTEXT_LOW_POWER = 0x0004,
+ RS_CONTEXT_WAIT_FOR_ATTACH = 0x0008
};
enum RsBlasTranspose {
diff --git a/rsDriverLoader.cpp b/rsDriverLoader.cpp
index 2bc53b6a..5bfb8e5c 100644
--- a/rsDriverLoader.cpp
+++ b/rsDriverLoader.cpp
@@ -108,6 +108,7 @@ static bool LoadHalTable(Context *rsc, HalQueryHal fn, bool loadGraphics) {
ret &= fn(RS_HAL_ALLOCATION_GENERATE_MIPMAPS, (void **)&rsc->mHal.funcs.allocation.generateMipmaps);
ret &= fn(RS_HAL_ALLOCATION_UPDATE_CACHED_OBJECT, (void **)&rsc->mHal.funcs.allocation.updateCachedObject);
ret &= fn(RS_HAL_ALLOCATION_ADAPTER_OFFSET, (void **)&rsc->mHal.funcs.allocation.adapterOffset);
+ ret &= fn(RS_HAL_ALLOCATION_GET_POINTER, (void **)&rsc->mHal.funcs.allocation.getPointer);
ret &= fn(RS_HAL_SAMPLER_INIT, (void **)&rsc->mHal.funcs.sampler.init);
ret &= fn(RS_HAL_SAMPLER_DESTROY, (void **)&rsc->mHal.funcs.sampler.destroy);
diff --git a/rs_hal.h b/rs_hal.h
index 77c2d261..c500e5a2 100644
--- a/rs_hal.h
+++ b/rs_hal.h
@@ -275,6 +275,10 @@ typedef struct {
void (*updateCachedObject)(const Context *rsc, const Allocation *alloc, rs_allocation *obj);
void (*adapterOffset)(const Context *rsc, const Allocation *alloc);
+
+ void (*getPointer)(const Context *rsc, const Allocation *alloc,
+ uint32_t lod, RsAllocationCubemapFace face,
+ uint32_t z, uint32_t array);
} allocation;
struct {
@@ -402,6 +406,7 @@ enum RsHalInitEnums {
RS_HAL_ALLOCATION_UPDATE_CACHED_OBJECT = 2024,
RS_HAL_ALLOCATION_ADAPTER_OFFSET = 2025,
RS_HAL_ALLOCATION_INIT_OEM = 2026,
+ RS_HAL_ALLOCATION_GET_POINTER = 2027,
RS_HAL_SAMPLER_INIT = 3000,
RS_HAL_SAMPLER_DESTROY = 3001,
diff --git a/update_rs_prebuilts.sh b/update_rs_prebuilts.sh
index 2526384e..89d7ac1b 100755
--- a/update_rs_prebuilts.sh
+++ b/update_rs_prebuilts.sh
@@ -161,14 +161,21 @@ libc++.$SONAME
libLLVM.$SONAME
"
+TOOLS_LIB32="libc++.$SONAME"
+
for a in $TOOLS_BIN; do
- cp $ANDROID_HOST_OUT/bin/$a tools/$SHORT_OSNAME/
- strip tools/$SHORT_OSNAME/$a
+ cp $ANDROID_HOST_OUT/bin/$a tools/$SHORT_OSNAME/bin
+ strip tools/$SHORT_OSNAME/bin/$a
done
for a in $TOOLS_LIB; do
- cp $HOST_LIB64_DIR/$a tools/$SHORT_OSNAME/
- strip tools/$SHORT_OSNAME/$a
+ cp $HOST_LIB64_DIR/$a tools/$SHORT_OSNAME/lib64
+ strip tools/$SHORT_OSNAME/lib64/$a
+done
+
+for a in $TOOLS_LIB32; do
+ cp $HOST_LIB_DIR/$a tools/$SHORT_OSNAME/lib
+ strip tools/$SHORT_OSNAME/lib/$a
done
if [ $DARWIN -eq 0 ]; then