diff options
author | Xia Wang <xiaw@google.com> | 2011-06-20 18:29:26 -0700 |
---|---|---|
committer | Xia Wang <xiaw@google.com> | 2011-06-20 18:39:04 -0700 |
commit | 8596457bc34151dff2a465c90994130deac7f148 (patch) | |
tree | 3ef68b0edfad24bd512b6a3b6e09fb35a1c54b76 /tests/RenderScriptTests | |
parent | df02afe8355e1e7a6f8f02549f41a166c3ee6932 (diff) | |
download | frameworks_base-8596457bc34151dff2a465c90994130deac7f148.zip frameworks_base-8596457bc34151dff2a465c90994130deac7f148.tar.gz frameworks_base-8596457bc34151dff2a465c90994130deac7f148.tar.bz2 |
Fix issues in Opengl Benchmark tests:
- fix live wallpaper drawing, bind the global vertex program after it
- scale the icons according to render surface in display icons, also
add a background for the icon display test case.
Change-Id: I410dfd745a7ebe0ce8a62fc590963bd1f86d1c1a
Diffstat (limited to 'tests/RenderScriptTests')
-rw-r--r-- | tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java | 13 | ||||
-rw-r--r-- | tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs | 22 |
2 files changed, 26 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 3f57799..c706286 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java @@ -100,6 +100,7 @@ public class RsBenchRS { private ProgramVertex mProgVertex; private ProgramVertexFixedFunction.Constants mPVA; + private ProgramVertexFixedFunction.Constants mPvProjectionAlloc; // Custom shaders private ProgramVertex mProgVertexCustom; @@ -388,6 +389,7 @@ public class RsBenchRS { i.Proj = projNorm; i.MVP = projNorm; mPvStarAlloc.set(i, 0, true); + mPvProjectionAlloc.setProjection(projNorm); } private void initProgramVertex() { @@ -405,8 +407,14 @@ public class RsBenchRS { // For galaxy live wallpaper mPvStarAlloc = new ScriptField_VpConsts(mRS, 1); mScript.bind_vpConstants(mPvStarAlloc); + mPvProjectionAlloc = new ProgramVertexFixedFunction.Constants(mRS); updateProjectionMatrices(); + pvb = new ProgramVertexFixedFunction.Builder(mRS); + ProgramVertex pvbp = pvb.create(); + ((ProgramVertexFixedFunction)pvbp).bindConstants(mPvProjectionAlloc); + mScript.set_gPVBkProj(pvbp); + ProgramVertex.Builder sb = new ProgramVertex.Builder(mRS); String t = "varying vec4 varColor;\n" + "varying vec2 varTex0;\n" + @@ -648,10 +656,10 @@ public class RsBenchRS { prepareTestData(); initSamplers(); - initProgramStore(); - initProgramFragment(); initMesh(); initProgramVertex(); + initProgramStore(); + initProgramFragment(); initFonts(); loadImages(); initProgramRaster(); @@ -674,7 +682,6 @@ public class RsBenchRS { Allocation.USAGE_GRAPHICS_RENDER_TARGET); mScript.set_gRenderBufferDepth(offscreen); - mTextureAllocs = new ScriptField_ListAllocs_s(mRS, 100); for (int i = 0; i < 100; i++) { ScriptField_ListAllocs_s.Item texElem = new ScriptField_ListAllocs_s.Item(); diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs index 6d80b0e..bb81862 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs @@ -393,19 +393,28 @@ static void displayIcons(int meshMode) { rsgBindProgramStore(gProgStoreBlendAlpha); rsgBindProgramFragment(gProgFragmentTexture); rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp); + rsgBindTexture(gProgFragmentTexture, 0, gTexTorus); + rsgDrawQuadTexCoords( + 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, + 0.0f, gRenderSurfaceH, 0.0f, 0.0f, 1.0f, + gRenderSurfaceW, gRenderSurfaceH, 0.0f, 1.0f, 1.0f, + gRenderSurfaceW, 0.0f, 0.0f, 1.0f, 0.0f); int meshCount = (int)pow(10.0f, (float)(meshMode + 1)); - float size = 50.0; + float wSize = gRenderSurfaceW/(float)meshCount; + float hSize = gRenderSurfaceH/(float)meshCount; rs_matrix4x4 matrix; - rsMatrixLoadScale(&matrix, size, size, 1.0); + rsMatrixLoadScale(&matrix, wSize, hSize, 1.0); float yPos = 0; + float yPad = hSize / 2; + float xPad = wSize / 2; for (int y = 0; y < meshCount; y++) { - yPos = (y + 1) * 50; + yPos = y * hSize + yPad; float xPos = 0; for (int x = 0; x < meshCount; x++) { - xPos = (x + 1) * 50; + xPos = x * wSize + xPad; rs_matrix4x4 transMatrix; rsMatrixLoadTranslate(&transMatrix, xPos, yPos, 0); rsMatrixMultiply(&transMatrix, &matrix); @@ -529,11 +538,12 @@ static void drawGalaxy() { } // Display images and text with live wallpaper in the background -static void dispalyLiveWallPaper(int wResolution, int hResolution) { +static void displayLiveWallPaper(int wResolution, int hResolution) { bindProgramVertexOrtho(); drawGalaxy(); + rsgBindProgramVertex(gProgVertex); rsgBindProgramStore(gProgStoreBlendAlpha); rsgBindProgramFragment(gProgFragmentTexture); rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp); @@ -958,7 +968,7 @@ static void runTest(int index) { displayListView(); break; case 30: - dispalyLiveWallPaper(7, 5); + displayLiveWallPaper(7, 5); break; } } |