Merge "Fixing file writing bug"
This commit is contained in:
committed by
Android (Google) Code Review
commit
7cee31835d
@@ -62,6 +62,9 @@ public class FillTest implements RsBenchBaseTest{
|
||||
mTests[index].testName = Allocation.createFromString(mRS,
|
||||
mNames[index],
|
||||
Allocation.USAGE_SCRIPT);
|
||||
mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS,
|
||||
mNames[index],
|
||||
Allocation.USAGE_SCRIPT);
|
||||
|
||||
ScriptField_FillTestData_s.Item dataItem = new ScriptField_FillTestData_s.Item();
|
||||
dataItem.testId = testId;
|
||||
|
||||
@@ -69,6 +69,9 @@ public class MeshTest implements RsBenchBaseTest{
|
||||
mTests[index].testName = Allocation.createFromString(mRS,
|
||||
mNames[index],
|
||||
Allocation.USAGE_SCRIPT);
|
||||
mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS,
|
||||
mNames[index],
|
||||
Allocation.USAGE_SCRIPT);
|
||||
|
||||
ScriptField_MeshTestData_s.Item dataItem = new ScriptField_MeshTestData_s.Item();
|
||||
dataItem.meshNum = meshNum;
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -48,6 +48,9 @@ public class TextTest implements RsBenchBaseTest{
|
||||
mTests[index].testName = Allocation.createFromString(mRS,
|
||||
mNames[index],
|
||||
Allocation.USAGE_SCRIPT);
|
||||
mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS,
|
||||
mNames[index],
|
||||
Allocation.USAGE_SCRIPT);
|
||||
|
||||
ScriptField_TextTestData_s.Item dataItem = new ScriptField_TextTestData_s.Item();
|
||||
dataItem.fillNum = fillNum;
|
||||
|
||||
@@ -98,6 +98,9 @@ public class TorusTest implements RsBenchBaseTest{
|
||||
mTests[index].testName = Allocation.createFromString(mRS,
|
||||
mNames[index],
|
||||
Allocation.USAGE_SCRIPT);
|
||||
mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS,
|
||||
mNames[index],
|
||||
Allocation.USAGE_SCRIPT);
|
||||
|
||||
ScriptField_TorusTestData_s.Item dataItem = new ScriptField_TorusTestData_s.Item();
|
||||
dataItem.testId = testId;
|
||||
|
||||
@@ -82,6 +82,9 @@ public class UiTest implements RsBenchBaseTest{
|
||||
mTests[index].testName = Allocation.createFromString(mRS,
|
||||
mNames[index],
|
||||
Allocation.USAGE_SCRIPT);
|
||||
mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS,
|
||||
mNames[index],
|
||||
Allocation.USAGE_SCRIPT);
|
||||
|
||||
ScriptField_UiTestData_s.Item dataItem = new ScriptField_UiTestData_s.Item();
|
||||
dataItem.testId = testId;
|
||||
|
||||
@@ -45,6 +45,7 @@ VertexShaderInputs *gVSInputs;
|
||||
typedef struct TestScripts_s {
|
||||
rs_allocation testData;
|
||||
rs_allocation testName;
|
||||
rs_allocation debugName;
|
||||
rs_script testScript;
|
||||
} TestScripts;
|
||||
TestScripts *gTestScripts;
|
||||
@@ -195,7 +196,8 @@ static void benchmark() {
|
||||
|
||||
int64_t end = rsUptimeMillis();
|
||||
float fps = (float)(frameCount) / ((float)(end - start)*0.001f);
|
||||
rsDebug("Finishes test ", fps);
|
||||
const char *testName = rsGetElementAt(gTestScripts[benchMode].debugName, 0);
|
||||
rsDebug(testName, fps);
|
||||
|
||||
gResultBuffer[benchMode] = fps;
|
||||
int bufferW = rsAllocationGetDimX(gRenderBufferColor);
|
||||
|
||||
Reference in New Issue
Block a user