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

Commit 55f31ddf authored by Mathias Agopian's avatar Mathias Agopian Committed by Android (Google) Code Review
Browse files

Merge "option to enable multisampling" into gingerbread

parents 992c471c 82962211
Loading
Loading
Loading
Loading
+71 −61
Original line number Diff line number Diff line
@@ -118,10 +118,12 @@ static void checkEGLErrors()
        fprintf(stderr, "EGL Error: 0x%04x\n", (int)error);
}

static int initGraphics()
static int initGraphics(unsigned samples)
{
    EGLint configAttribs[] = {
            EGL_DEPTH_SIZE, 16,
            EGL_SAMPLE_BUFFERS, samples ? 1 : 0,
                    EGL_SAMPLES, samples,
                    EGL_NONE
    };

@@ -164,6 +166,11 @@ static int initGraphics()
    sEglSurface = surface;
    sEglContext = context;

    if (samples == 0) {
        // GL_MULTISAMPLE is enabled by default
        glDisable(GL_MULTISAMPLE);
    }

    return EGL_TRUE;
}

@@ -179,11 +186,14 @@ static void deinitGraphics()

int main(int argc, char *argv[])
{
    // not referenced:
    argc = argc;
    argv = argv;
    unsigned samples = 0;
    printf("usage: %s [samples]\n", argv[0]);
    if (argc == 2) {
        samples = atoi( argv[1] );
        printf("Multisample enabled: GL_SAMPLES = %u\n", samples);
    }

    if (!initGraphics())
    if (!initGraphics(samples))
    {
        fprintf(stderr, "Graphics initialization failed.\n");
        return EXIT_FAILURE;