diff options
author | Jason Sams <jsams@google.com> | 2012-01-06 17:30:29 -0800 |
---|---|---|
committer | Jason Sams <jsams@google.com> | 2012-01-06 17:56:33 -0800 |
commit | c3cff15b90e191b9d96ba383e65300e1f0807107 (patch) | |
tree | bb618402b4a53a05b1c830f6f716380dc1823d85 /tests/RenderScriptTests/PerfTest/src/com/android/perftest | |
parent | 2443e25aefa89796a70623c567725c01311d1fb6 (diff) | |
download | frameworks_base-c3cff15b90e191b9d96ba383e65300e1f0807107.zip frameworks_base-c3cff15b90e191b9d96ba383e65300e1f0807107.tar.gz frameworks_base-c3cff15b90e191b9d96ba383e65300e1f0807107.tar.bz2 |
Add more fill tests.
Change-Id: I43ae760cdac391580e4af590e212b38afd183d1e
Diffstat (limited to 'tests/RenderScriptTests/PerfTest/src/com/android/perftest')
-rw-r--r-- | tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java | 19 | ||||
-rw-r--r-- | tests/RenderScriptTests/PerfTest/src/com/android/perftest/fill_test.rs | 31 |
2 files changed, 44 insertions, 6 deletions
diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java index ba70c71..41f664a 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/FillTest.java @@ -35,18 +35,22 @@ public class FillTest implements RsBenchBaseTest{ // Custom shaders private ProgramFragment mProgFragmentMultitex; private ProgramFragment mProgFragmentSingletex; + private ProgramFragment mProgFragmentSingletexModulate; private final BitmapFactory.Options mOptionsARGB = new BitmapFactory.Options(); int mBenchmarkDimX; int mBenchmarkDimY; private ScriptC_fill_test mFillScript; ScriptField_TestScripts_s.Item[] mTests; + ScriptField_FillTestFragData_s mFragData; private final String[] mNames = { "Fill screen 10x singletexture", "Fill screen 10x 3tex multitexture", "Fill screen 10x blended singletexture", - "Fill screen 10x blended 3tex multitexture" + "Fill screen 10x blended 3tex multitexture", + "Fill screen 3x modulate blended singletexture", + "Fill screen 1x modulate blended singletexture", }; public FillTest() { @@ -88,6 +92,8 @@ public class FillTest implements RsBenchBaseTest{ addTest(index++, 0 /*testId*/, 0 /*blend*/, 10 /*quadCount*/); addTest(index++, 1 /*testId*/, 1 /*blend*/, 10 /*quadCount*/); addTest(index++, 0 /*testId*/, 1 /*blend*/, 10 /*quadCount*/); + addTest(index++, 2 /*testId*/, 1 /*blend*/, 3 /*quadCount*/); + addTest(index++, 2 /*testId*/, 1 /*blend*/, 1 /*quadCount*/); return true; } @@ -112,6 +118,14 @@ public class FillTest implements RsBenchBaseTest{ pfbCustom.setShader(mRes, R.raw.singletexf); pfbCustom.addTexture(Program.TextureType.TEXTURE_2D); mProgFragmentSingletex = pfbCustom.create(); + + pfbCustom = new ProgramFragment.Builder(mRS); + pfbCustom.setShader(mRes, R.raw.singletexfm); + pfbCustom.addTexture(Program.TextureType.TEXTURE_2D); + mFragData = new ScriptField_FillTestFragData_s(mRS, 1); + pfbCustom.addConstant(mFragData.getType()); + mProgFragmentSingletexModulate = pfbCustom.create(); + mProgFragmentSingletexModulate.bindConstants(mFragData.getAllocation(), 0); } private Allocation loadTextureARGB(int id) { @@ -140,6 +154,7 @@ public class FillTest implements RsBenchBaseTest{ mFillScript.set_gProgVertex(progVertex); mFillScript.set_gProgFragmentTexture(mProgFragmentSingletex); + mFillScript.set_gProgFragmentTextureModulate(mProgFragmentSingletexModulate); mFillScript.set_gProgFragmentMultitex(mProgFragmentMultitex); mFillScript.set_gProgStoreBlendNone(ProgramStore.BLEND_NONE_DEPTH_NONE(mRS)); mFillScript.set_gProgStoreBlendAlpha(ProgramStore.BLEND_ALPHA_DEPTH_NONE(mRS)); @@ -150,5 +165,7 @@ public class FillTest implements RsBenchBaseTest{ mFillScript.set_gTexOpaque(loadTextureRGB(R.drawable.data)); mFillScript.set_gTexTransparent(loadTextureARGB(R.drawable.leaf)); mFillScript.set_gTexChecker(loadTextureRGB(R.drawable.checker)); + + mFillScript.bind_gFragData(mFragData); } } diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/fill_test.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/fill_test.rs index 23832d3..281f830 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/fill_test.rs +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/fill_test.rs @@ -21,6 +21,7 @@ rs_program_vertex gProgVertex; rs_program_fragment gProgFragmentTexture; +rs_program_fragment gProgFragmentTextureModulate; rs_program_fragment gProgFragmentMultitex; rs_program_store gProgStoreBlendNone; @@ -41,6 +42,11 @@ typedef struct FillTestData_s { } FillTestData; FillTestData *gData; +typedef struct FillTestFragData_s { + float4 modulate; +} FillTestFragData; +FillTestFragData *gFragData; + static float gDt = 0.0f; void init() { @@ -58,7 +64,7 @@ static void bindProgramVertexOrtho() { rsgProgramVertexLoadProjectionMatrix(&proj); } -static void displaySingletexFill(bool blend, int quadCount) { +static void displaySingletexFill(bool blend, int quadCount, bool modulate) { bindProgramVertexOrtho(); rs_matrix4x4 matrix; rsMatrixLoadIdentity(&matrix); @@ -70,9 +76,21 @@ static void displaySingletexFill(bool blend, int quadCount) { } else { rsgBindProgramStore(gProgStoreBlendAlpha); } - rsgBindProgramFragment(gProgFragmentTexture); - rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp); - rsgBindTexture(gProgFragmentTexture, 0, gTexOpaque); + if (modulate) { + rsgBindProgramFragment(gProgFragmentTextureModulate); + rsgBindSampler(gProgFragmentTextureModulate, 0, gLinearClamp); + rsgBindTexture(gProgFragmentTextureModulate, 0, gTexOpaque); + + gFragData->modulate.r = 0.8f; + gFragData->modulate.g = 0.7f; + gFragData->modulate.b = 0.8f; + gFragData->modulate.a = 0.5f; + rsgAllocationSyncAll(rsGetAllocation(gFragData)); + } else { + rsgBindProgramFragment(gProgFragmentTexture); + rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp); + rsgBindTexture(gProgFragmentTexture, 0, gTexOpaque); + } for (int i = 0; i < quadCount; i ++) { float startX = 5 * i, startY = 5 * i; @@ -128,7 +146,10 @@ void root(const void *v_in, void *v_out, const void *usrData, uint32_t x, uint32 displayMultitextureSample(gData->blend == 1 ? true : false, gData->quadCount); break; case 1: - displaySingletexFill(gData->blend == 1 ? true : false, gData->quadCount); + displaySingletexFill(gData->blend == 1 ? true : false, gData->quadCount, false); + break; + case 2: + displaySingletexFill(gData->blend == 1 ? true : false, gData->quadCount, true); break; default: rsDebug("Wrong test number", 0); |