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

Commit bae7b394 authored by Mathias Agopian's avatar Mathias Agopian Committed by Android Git Automerger
Browse files

am fec5d38b: Merge "option to enable multisampling" into gingerbread

Merge commit 'fec5d38baf4487d8ab0143451a3f2c39edeeb5b2' into gingerbread-plus-aosp

* commit 'fec5d38baf4487d8ab0143451a3f2c39edeeb5b2':
  option to enable multisampling
parents 837d66f4 55f31ddf
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;