int main(int argc, char **argv) { GLenum internal_format = 0; EGLDisplay dpy; EGLContext ctx; bool ok; /* Strip common piglit args. */ piglit_strip_arg(&argc, argv, "-fbo"); piglit_strip_arg(&argc, argv, "-auto"); if (argc == 2) { if (streq(argv[1], "GL_RGBA")) { internal_format = GL_RGBA; } else if (streq(argv[1], "GL_DEPTH_COMPONENT24")) { internal_format = GL_DEPTH_COMPONENT24; } } if (internal_format == 0) usage_error(); dpy = create_display(); ctx = create_context(dpy); ok = eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, ctx); if (!ok) { piglit_loge("failed to make context current without surface"); piglit_report_result(PIGLIT_FAIL); } piglit_dispatch_default_init(PIGLIT_DISPATCH_ES2); if (!piglit_is_extension_supported("GL_OES_EGL_image")) { piglit_loge("context does not support GL_OES_EGL_image"); piglit_report_result(PIGLIT_SKIP); } switch (internal_format) { case GL_RGBA: test_rgba(dpy, ctx); break; case GL_DEPTH_COMPONENT24: test_depth24(dpy, ctx); break; default: break; } /* unreachable */ abort(); }
enum piglit_result piglit_display(void) { bool pass = true; pass = test_luminance() && pass; pass = test_rgba() && pass; pass = test_fbo_readpixels_lum_as_rgba() && pass; pass = test_fbo_readpixels_rgba_as_lum() && pass; return pass ? PIGLIT_PASS : PIGLIT_FAIL; }