summaryrefslogtreecommitdiffstats
path: root/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java')
-rw-r--r--tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java30
1 files changed, 21 insertions, 9 deletions
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java
index c51bd82..8c67026 100644
--- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java
+++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java
@@ -60,7 +60,6 @@ public class RsBenchRS {
mWidth = width;
mHeight = height;
mMode = 0;
- mMaxModes = 0;
mLoops = loops;
mCurrentLoop = 0;
mBenchmarkDimX = 1280;
@@ -88,11 +87,30 @@ public class RsBenchRS {
ScriptField_TestScripts_s.Item[] mIndividualTests;
int mMode;
- int mMaxModes;
String[] mTestNames;
float[] mLocalTestResults;
+ static Allocation createZeroTerminatedAlloc(RenderScript rs,
+ String str,
+ int usage) {
+ byte[] allocArray = null;
+ try {
+ allocArray = str.getBytes("UTF-8");
+ byte[] allocArrayZero = new byte[allocArray.length + 1];
+ System.arraycopy(allocArray, 0, allocArrayZero, 0, allocArray.length);
+ allocArrayZero[allocArrayZero.length - 1] = '\0';
+ Allocation alloc = Allocation.createSized(rs, Element.U8(rs),
+ allocArrayZero.length, usage);
+ alloc.copyFrom(allocArrayZero);
+ return alloc;
+ }
+ catch (Exception e) {
+ throw new RSRuntimeException("Could not convert string to utf-8.");
+ }
+
+ }
+
void appendTests(RsBenchBaseTest testSet) {
ScriptField_TestScripts_s.Item[] newTests = testSet.getTests();
if (mIndividualTests != null) {
@@ -119,6 +137,7 @@ public class RsBenchRS {
void createTestAllocation() {
int numTests = mIndividualTests.length;
+ mLocalTestResults = new float[numTests];
ScriptField_TestScripts_s allTests;
allTests = new ScriptField_TestScripts_s(mRS, numTests);
for (int i = 0; i < numTests; i ++) {
@@ -239,11 +258,6 @@ public class RsBenchRS {
return count;
}
- private void prepareTestData() {
- mTestNames = new String[mMaxModes];
- mLocalTestResults = new float[mMaxModes];
- }
-
public void setDebugMode(int num) {
mScript.invoke_setDebugMode(num);
}
@@ -261,8 +275,6 @@ public class RsBenchRS {
mScript.set_gMaxLoops(mLoops);
- prepareTestData();
-
initProgramVertex();
initProgramFragment();
mScript.set_gFontSerif(Font.create(mRS, mRes, "serif", Font.Style.NORMAL, 8));