Merge changes from topic 'global_info'
* changes:
Update RS driver to support extraction of global variable properties.
Use "override" instead of "virtual" when replacing methods.
diff --git a/Android.mk b/Android.mk
index 81a30d8..ef885de 100644
--- a/Android.mk
+++ b/Android.mk
@@ -134,7 +134,6 @@
LOCAL_GENERATED_SOURCES += $(GEN)
LOCAL_SRC_FILES:= \
- rsAdapter.cpp \
rsAllocation.cpp \
rsAnimation.cpp \
rsComponent.cpp \
@@ -240,7 +239,6 @@
LOCAL_CPPFLAGS += -fno-exceptions
LOCAL_SRC_FILES:= \
- rsAdapter.cpp \
rsAllocation.cpp \
rsAnimation.cpp \
rsComponent.cpp \
diff --git a/cpp/RenderScript.cpp b/cpp/RenderScript.cpp
index c05e0f9..aa7dbd7 100644
--- a/cpp/RenderScript.cpp
+++ b/cpp/RenderScript.cpp
@@ -165,7 +165,7 @@
}
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 f3f7f31..e7acbed 100644
--- a/cpp/rsCppStructs.h
+++ b/cpp/rsCppStructs.h
@@ -80,7 +80,9 @@
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/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp
index 9bcb4ac..decafc6 100644
--- a/cpu_ref/rsCpuScript.cpp
+++ b/cpu_ref/rsCpuScript.cpp
@@ -181,7 +181,7 @@
break;
}
- if (TEMP_FAILURE_RETRY(close(FD)) != 0) {
+ if (close(FD) != 0) {
ALOGE("Cannot close file \'%s\' after computing checksum", fileName);
return false;
}
diff --git a/driver/rsdAllocation.cpp b/driver/rsdAllocation.cpp
index 3467086..94efab2 100644
--- a/driver/rsdAllocation.cpp
+++ b/driver/rsdAllocation.cpp
@@ -553,7 +553,7 @@
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 9c4755c..d65460c 100644
--- a/driver/rsdCore.cpp
+++ b/driver/rsdCore.cpp
@@ -154,6 +154,8 @@
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 077916d..bb51db6 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 @@
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 2ee56ec..fb8baaa 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 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 @@
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 @@
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 @@
// Testing functions
static void bench_basic_operators() {
- int i = 0;
BENCH_BASIC_OP(+);
BENCH_BASIC_OP(-);
BENCH_BASIC_OP(*);
@@ -283,6 +295,8 @@
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 @@
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 @@
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 e211620..23f64f5 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 @@
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 40d4fa2..1309df5 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 @@
}
} 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 @@
} 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 @@
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 865c77e..acd9cf9 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 @@
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 @@
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 865c77e..7a492c0 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 @@
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 e211620..23f64f5 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 @@
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 40d4fa2..1309df5 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 @@
}
} 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 @@
} 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 @@
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 865c77e..acd9cf9 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 @@
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 @@
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 1f24775..c7a7a87 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 @@
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 @@
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 b6f2b2a..3e8889e 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 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_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_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_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_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_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 5bfbb2b..80f73be 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_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(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 @@
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 bec124d..afada81 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 @@
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 @@
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 b05a354..04974af 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 @@
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 @@
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 @@
/* 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 @@
/* 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 419ce07..95b29a3 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 @@
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 b6f2b2a..62ef3ec 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 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_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_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_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_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_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 @@
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 2c0521b..f3eac55 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 @@
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 @@
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 5bfbb2b..489cc27 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_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 @@
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 bec124d..088fe50 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 @@
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 @@
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 @@
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 0281383..de7135c 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 @@
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 @@
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 @@
/* 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 @@
/* 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 b6f2b2a..62ef3ec 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 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_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_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_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_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_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 @@
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 f3bf244..afda39f 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 @@
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 @@
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 @@
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 6d34481..b548e12 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 @@
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 @@
/* 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 b6f2b2a..62ef3ec 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 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_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_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_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_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_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 @@
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 22d9c13..8577604 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 @@
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 @@
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 @@
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 4a7151f..40f1062 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 @@
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 @@
/* 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 b6f2b2a..62ef3ec 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 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_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_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_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_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_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 @@
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 22d9c13..a517189 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 @@
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 @@
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 @@
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 b5057d0..17222f3 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 @@
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 @@
/* 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 663652c..d13ef0d 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 @@
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 4cdfc12..1f72f2e 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 @@
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 23c1bc6..52bf75c 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 z;
rs_allocation volume;
+/* Unused function:
static float3 nylander(float3 p, int n) {
float3 out;
float r = length(p);
@@ -33,6 +34,7 @@
out.z = cos(n * theta);
return out * rn;
}
+*/
/**
* 8 x faster than the above for n = 3
@@ -48,10 +50,6 @@
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 2b51eee..e3004cc 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 @@
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 @@
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 @@
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/rsAdapter.cpp b/rsAdapter.cpp
deleted file mode 100644
index 52d8ec7..0000000
--- a/rsAdapter.cpp
+++ /dev/null
@@ -1,166 +0,0 @@
-
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "rsContext.h"
-#include "rsAdapter.h"
-
-using namespace android;
-using namespace android::renderscript;
-
-Adapter1D::Adapter1D(Context *rsc) : ObjectBase(rsc) {
- reset();
-}
-
-Adapter1D::Adapter1D(Context *rsc, Allocation *a) : ObjectBase(rsc) {
- reset();
- setAllocation(a);
-}
-
-void Adapter1D::reset() {
- mY = 0;
- mZ = 0;
- mLOD = 0;
- mFace = RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X;
-}
-
-void Adapter1D::data(Context *rsc, uint32_t x, uint32_t count, const void *data, size_t sizeBytes) {
- mAllocation->data(rsc, x, mY, mLOD, mFace, count, 1, data, sizeBytes, 0);
-}
-
-void Adapter1D::serialize(Context *rsc, OStream *stream) const {
-}
-
-Adapter1D *Adapter1D::createFromStream(Context *rsc, IStream *stream) {
- return nullptr;
-}
-
-namespace android {
-namespace renderscript {
-
-RsAdapter1D rsi_Adapter1DCreate(Context *rsc) {
- Adapter1D *a = new Adapter1D(rsc);
- a->incUserRef();
- return a;
-}
-
-void rsi_Adapter1DBindAllocation(Context *rsc, RsAdapter1D va, RsAllocation valloc) {
- Adapter1D * a = static_cast<Adapter1D *>(va);
- Allocation * alloc = static_cast<Allocation *>(valloc);
- a->setAllocation(alloc);
-}
-
-void rsi_Adapter1DSetConstraint(Context *rsc, RsAdapter1D va, RsDimension dim, uint32_t value) {
- Adapter1D * a = static_cast<Adapter1D *>(va);
- switch (dim) {
- case RS_DIMENSION_X:
- rsAssert(!"Cannot contrain X in an 1D adapter");
- return;
- case RS_DIMENSION_Y:
- a->setY(value);
- break;
- case RS_DIMENSION_Z:
- a->setZ(value);
- break;
- case RS_DIMENSION_LOD:
- a->setLOD(value);
- break;
- case RS_DIMENSION_FACE:
- a->setFace((RsAllocationCubemapFace)value);
- break;
- default:
- rsAssert(!"Unimplemented constraint");
- return;
- }
-}
-
-}
-}
-
-//////////////////////////
-
-Adapter2D::Adapter2D(Context *rsc) : ObjectBase(rsc) {
- reset();
-}
-
-Adapter2D::Adapter2D(Context *rsc, Allocation *a) : ObjectBase(rsc) {
- reset();
- setAllocation(a);
-}
-
-void Adapter2D::reset() {
- mZ = 0;
- mLOD = 0;
- mFace = RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X;
-}
-
-
-void Adapter2D::data(Context *rsc, uint32_t x, uint32_t y, uint32_t w, uint32_t h,
- const void *data, size_t sizeBytes) {
- mAllocation->data(rsc, x, y, mLOD, mFace, w, h, data, sizeBytes, 0);
-}
-
-
-void Adapter2D::serialize(Context *rsc, OStream *stream) const {
-}
-
-Adapter2D *Adapter2D::createFromStream(Context *rsc, IStream *stream) {
- return nullptr;
-}
-
-
-namespace android {
-namespace renderscript {
-
-RsAdapter2D rsi_Adapter2DCreate(Context *rsc) {
- Adapter2D *a = new Adapter2D(rsc);
- a->incUserRef();
- return a;
-}
-
-void rsi_Adapter2DBindAllocation(Context *rsc, RsAdapter2D va, RsAllocation valloc) {
- Adapter2D * a = static_cast<Adapter2D *>(va);
- Allocation * alloc = static_cast<Allocation *>(valloc);
- a->setAllocation(alloc);
-}
-
-void rsi_Adapter2DSetConstraint(Context *rsc, RsAdapter2D va, RsDimension dim, uint32_t value) {
- Adapter2D * a = static_cast<Adapter2D *>(va);
- switch (dim) {
- case RS_DIMENSION_X:
- rsAssert(!"Cannot contrain X in an 2D adapter");
- return;
- case RS_DIMENSION_Y:
- rsAssert(!"Cannot contrain Y in an 2D adapter");
- break;
- case RS_DIMENSION_Z:
- a->setZ(value);
- break;
- case RS_DIMENSION_LOD:
- a->setLOD(value);
- break;
- case RS_DIMENSION_FACE:
- a->setFace((RsAllocationCubemapFace)value);
- break;
- default:
- rsAssert(!"Unimplemented constraint");
- return;
- }
-}
-
-
-}
-}
diff --git a/rsAdapter.h b/rsAdapter.h
deleted file mode 100644
index 7b189cf..0000000
--- a/rsAdapter.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2009 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_RS_ADAPTER_H
-#define ANDROID_RS_ADAPTER_H
-
-#include "rsAllocation.h"
-
-// ---------------------------------------------------------------------------
-namespace android {
-namespace renderscript {
-
-
-class Adapter1D : public ObjectBase {
-
-public:
- // By policy this allocation will hold a pointer to the type
- // but will not destroy it on destruction.
- Adapter1D(Context *);
- Adapter1D(Context *, Allocation *);
- void reset();
-
- void setAllocation(Allocation *a) {mAllocation.set(a);}
-
- uint32_t getDimX() const {return mAllocation->getType()->getLODDimX(mLOD);}
-
- const Type * getBaseType() const {return mAllocation->getType();}
-
- inline void setY(uint32_t y) {mY = y;}
- inline void setZ(uint32_t z) {mZ = z;}
- inline void setLOD(uint32_t lod) {mLOD = lod;}
- inline void setFace(RsAllocationCubemapFace face) {mFace = face;}
-
- void data(Context *rsc, uint32_t xoff, uint32_t count, const void *data, size_t sizeBytes);
-
- virtual void serialize(Context *rsc, OStream *stream) const;
- virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ADAPTER_1D; }
- static Adapter1D *createFromStream(Context *rsc, IStream *stream);
-
-protected:
- ObjectBaseRef<Allocation> mAllocation;
- uint32_t mY;
- uint32_t mZ;
- uint32_t mLOD;
- RsAllocationCubemapFace mFace;
-};
-
-class Adapter2D : public ObjectBase {
-
-public:
- // By policy this allocation will hold a pointer to the type
- // but will not destroy it on destruction.
- Adapter2D(Context *);
- Adapter2D(Context *, Allocation *);
- void reset();
-
- uint32_t getDimX() const {return mAllocation->getType()->getLODDimX(mLOD);}
- uint32_t getDimY() const {return mAllocation->getType()->getLODDimY(mLOD);}
- const Type * getBaseType() const {return mAllocation->getType();}
-
- void setAllocation(Allocation *a) {mAllocation.set(a);}
- inline void setZ(uint32_t z) {mZ = z;}
- inline void setLOD(uint32_t lod) {mLOD = lod;}
- inline void setFace(RsAllocationCubemapFace face) {mFace = face;}
-
- void data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t w, uint32_t h,
- const void *data, size_t sizeBytes);
-
- virtual void serialize(Context *rsc, OStream *stream) const;
- virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_ADAPTER_2D; }
- static Adapter2D *createFromStream(Context *rsc, IStream *stream);
-
-protected:
- ObjectBaseRef<Allocation> mAllocation;
- uint32_t mZ;
- uint32_t mLOD;
- RsAllocationCubemapFace mFace;
-};
-
-}
-}
-#endif
-
diff --git a/rsAllocation.cpp b/rsAllocation.cpp
index a7601a4..f024b7d 100644
--- a/rsAllocation.cpp
+++ b/rsAllocation.cpp
@@ -16,7 +16,6 @@
#include "rsContext.h"
#include "rsAllocation.h"
-#include "rsAdapter.h"
#include "rs_hal.h"
#if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB)
@@ -167,8 +166,12 @@
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 29b4036..c21542f 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 @@
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 @@
delete rsc;
return nullptr;
}
+
+ if (flags & RS_CONTEXT_WAIT_FOR_ATTACH) {
+ rsc->waitForDebugger();
+ }
+
return rsc;
}
diff --git a/rsContext.h b/rsContext.h
index 6cb0ed7..918e5e3 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 @@
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 @@
}
#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 @@
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 18ba08a..839520f 100644
--- a/rsDefines.h
+++ b/rsDefines.h
@@ -29,8 +29,6 @@
typedef void * RsAsyncVoidPtr;
-typedef void * RsAdapter1D;
-typedef void * RsAdapter2D;
typedef void * RsAllocation;
typedef void * RsAnimation;
typedef void * RsClosure;
@@ -252,7 +250,8 @@
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 2bc53b6..5bfb8e5 100644
--- a/rsDriverLoader.cpp
+++ b/rsDriverLoader.cpp
@@ -108,6 +108,7 @@
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/rsEnv.h b/rsEnv.h
index 924e171..a633f79 100644
--- a/rsEnv.h
+++ b/rsEnv.h
@@ -1,8 +1,6 @@
#include <stdint.h>
-typedef void * RsAdapter1D;
-typedef void * RsAdapter2D;
typedef void * RsAllocation;
typedef void * RsContext;
typedef void * RsDevice;
diff --git a/rsGrallocConsumer.cpp b/rsGrallocConsumer.cpp
index f19f171..eca25ce 100644
--- a/rsGrallocConsumer.cpp
+++ b/rsGrallocConsumer.cpp
@@ -18,7 +18,6 @@
#include "rsContext.h"
#include "rsAllocation.h"
-#include "rsAdapter.h"
#include "rs_hal.h"
#include <cutils/compiler.h>
diff --git a/rs_hal.h b/rs_hal.h
index 77c2d26..c500e5a 100644
--- a/rs_hal.h
+++ b/rs_hal.h
@@ -275,6 +275,10 @@
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 @@
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,