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

Commit fdd33e01 authored by Xia Wang's avatar Xia Wang Committed by Android (Google) Code Review
Browse files

Merge "Fix issues in Opengl Benchmark tests: - fix live wallpaper drawing,...

Merge "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."
parents 71c77aa8 8596457b
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -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();
+16 −6
Original line number Diff line number Diff line
@@ -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;
    }
}