Loading tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java +12 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ public class RsBenchRS { private static final String TAG = "RsBenchRS"; private static final String SAMPLE_TEXT = "Bench Test"; private static final String LIST_TEXT = "This is a sample list of text to show in the list view"; int mWidth; int mHeight; Loading Loading @@ -128,6 +130,7 @@ public class RsBenchRS { private ScriptField_ListAllocs_s mTextureAllocs; private ScriptField_ListAllocs_s mSampleTextAllocs; private ScriptField_ListAllocs_s mSampleListViewAllocs; private ScriptC_rsbench mScript; Loading Loading @@ -567,6 +570,15 @@ public class RsBenchRS { mSampleTextAllocs.copyAll(); mScript.bind_gSampleTextList100(mSampleTextAllocs); mSampleListViewAllocs = new ScriptField_ListAllocs_s(mRS, 1000); for (int i = 0; i < 1000; i++) { ScriptField_ListAllocs_s.Item textElem = new ScriptField_ListAllocs_s.Item(); textElem.item = Allocation.createFromString(mRS, LIST_TEXT, Allocation.USAGE_SCRIPT); mSampleListViewAllocs.set(textElem, i, false); } mSampleListViewAllocs.copyAll(); mScript.bind_gListViewText(mSampleListViewAllocs); mRS.bindRootScript(mScript); } } tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs +39 −9 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ const int RS_MSG_TEST_DONE = 100; const int RS_MSG_RESULTS_READY = 101; const int gMaxModes = 29; const int gMaxModes = 30; int gMaxLoops; // Allocation to send test names back to java Loading Loading @@ -52,6 +52,7 @@ typedef struct ListAllocs_s { ListAllocs *gTexList100; ListAllocs *gSampleTextList100; ListAllocs *gListViewText; rs_mesh g10by10Mesh; rs_mesh g100by100Mesh; Loading Loading @@ -303,6 +304,35 @@ static void displayImageWithText(int wResolution, int hResolution, int meshMode) } } // Display a list of text as the list view static void displayListView() { // set text color rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f); rsgBindFont(gFontSans); // get the size of the list rs_allocation textAlloc; textAlloc = rsGetAllocation(gListViewText); int allocSize = rsAllocationGetDimX(textAlloc); int listItemHeight = 80; int yOffset = listItemHeight; // set the color for the list divider rsgBindProgramFragment(gProgFragmentColor); rsgProgramFragmentConstantColor(gProgFragmentColor, 1.0, 1.0, 1.0, 1); // draw the list with divider for (int i = 0; i < allocSize; i++) { if (yOffset - listItemHeight > gRenderSurfaceH) { break; } rsgDrawRect(0, yOffset - 1, gRenderSurfaceW, yOffset, 0); rsgDrawText(gListViewText[i].item, 20, yOffset - 10); yOffset += listItemHeight; } } static float gTorusRotation = 0; static void updateModelMatrix(rs_matrix4x4 *matrix, void *buffer) { if (buffer == 0) { Loading Loading @@ -602,14 +632,11 @@ static const char *testNames[] = { "Geo test 25.6k heavy fragment heavy vertex", "Geo test 51.2k heavy fragment heavy vertex", "Geo test 204.8k small tries heavy fragment heavy vertex", "UI test with icon display 10 by 10", // 25 "UI test with icon display 100 by 100", // 26 "UI test with image and text display 3 pages", // 27 "UI test with image and text display 5 pages", // 28 "UI test with list view", // 29 // "UI test with live wallpaper", // 30 // "Mesh with 10 by 10 texture", // "Mesh with 100 by 100 texture", "UI test with icon display 10 by 10", "UI test with icon display 100 by 100", "UI test with image and text display 3 pages", "UI test with image and text display 5 pages", "UI test with list view", }; void getTestName(int testIndex) { Loading Loading @@ -714,6 +741,9 @@ static void runTest(int index) { case 28: displayImageWithText(7, 5, 1); break; case 29: displayListView(); break; } } Loading Loading
tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java +12 −0 Original line number Diff line number Diff line Loading @@ -45,6 +45,8 @@ public class RsBenchRS { private static final String TAG = "RsBenchRS"; private static final String SAMPLE_TEXT = "Bench Test"; private static final String LIST_TEXT = "This is a sample list of text to show in the list view"; int mWidth; int mHeight; Loading Loading @@ -128,6 +130,7 @@ public class RsBenchRS { private ScriptField_ListAllocs_s mTextureAllocs; private ScriptField_ListAllocs_s mSampleTextAllocs; private ScriptField_ListAllocs_s mSampleListViewAllocs; private ScriptC_rsbench mScript; Loading Loading @@ -567,6 +570,15 @@ public class RsBenchRS { mSampleTextAllocs.copyAll(); mScript.bind_gSampleTextList100(mSampleTextAllocs); mSampleListViewAllocs = new ScriptField_ListAllocs_s(mRS, 1000); for (int i = 0; i < 1000; i++) { ScriptField_ListAllocs_s.Item textElem = new ScriptField_ListAllocs_s.Item(); textElem.item = Allocation.createFromString(mRS, LIST_TEXT, Allocation.USAGE_SCRIPT); mSampleListViewAllocs.set(textElem, i, false); } mSampleListViewAllocs.copyAll(); mScript.bind_gListViewText(mSampleListViewAllocs); mRS.bindRootScript(mScript); } }
tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs +39 −9 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ const int RS_MSG_TEST_DONE = 100; const int RS_MSG_RESULTS_READY = 101; const int gMaxModes = 29; const int gMaxModes = 30; int gMaxLoops; // Allocation to send test names back to java Loading Loading @@ -52,6 +52,7 @@ typedef struct ListAllocs_s { ListAllocs *gTexList100; ListAllocs *gSampleTextList100; ListAllocs *gListViewText; rs_mesh g10by10Mesh; rs_mesh g100by100Mesh; Loading Loading @@ -303,6 +304,35 @@ static void displayImageWithText(int wResolution, int hResolution, int meshMode) } } // Display a list of text as the list view static void displayListView() { // set text color rsgFontColor(0.9f, 0.9f, 0.9f, 1.0f); rsgBindFont(gFontSans); // get the size of the list rs_allocation textAlloc; textAlloc = rsGetAllocation(gListViewText); int allocSize = rsAllocationGetDimX(textAlloc); int listItemHeight = 80; int yOffset = listItemHeight; // set the color for the list divider rsgBindProgramFragment(gProgFragmentColor); rsgProgramFragmentConstantColor(gProgFragmentColor, 1.0, 1.0, 1.0, 1); // draw the list with divider for (int i = 0; i < allocSize; i++) { if (yOffset - listItemHeight > gRenderSurfaceH) { break; } rsgDrawRect(0, yOffset - 1, gRenderSurfaceW, yOffset, 0); rsgDrawText(gListViewText[i].item, 20, yOffset - 10); yOffset += listItemHeight; } } static float gTorusRotation = 0; static void updateModelMatrix(rs_matrix4x4 *matrix, void *buffer) { if (buffer == 0) { Loading Loading @@ -602,14 +632,11 @@ static const char *testNames[] = { "Geo test 25.6k heavy fragment heavy vertex", "Geo test 51.2k heavy fragment heavy vertex", "Geo test 204.8k small tries heavy fragment heavy vertex", "UI test with icon display 10 by 10", // 25 "UI test with icon display 100 by 100", // 26 "UI test with image and text display 3 pages", // 27 "UI test with image and text display 5 pages", // 28 "UI test with list view", // 29 // "UI test with live wallpaper", // 30 // "Mesh with 10 by 10 texture", // "Mesh with 100 by 100 texture", "UI test with icon display 10 by 10", "UI test with icon display 100 by 100", "UI test with image and text display 3 pages", "UI test with image and text display 5 pages", "UI test with list view", }; void getTestName(int testIndex) { Loading Loading @@ -714,6 +741,9 @@ static void runTest(int index) { case 28: displayImageWithText(7, 5, 1); break; case 29: displayListView(); break; } } Loading