Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5de7657a authored by Alex Sakhartchouk's avatar Alex Sakhartchouk
Browse files

Fixing file writing bug

Change-Id: I01b6fa9f14ecf01e8957cb1b9277ba88eea46845
parent 16bf40b8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;
+3 −0
Original line number Diff line number Diff line
@@ -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;
+21 −9
Original line number Diff line number Diff line
@@ -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));
+3 −0
Original line number Diff line number Diff line
@@ -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;
+3 −0
Original line number Diff line number Diff line
@@ -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;
Loading