Use valid context when using glGet*.

Otherwise random numbers are returned as maximum dimensions leading
to intermittent aborts on 64 bit systems. (Somehow 32 bit systems
were passsing with this.)

BUG=None.
TEST=Ran locally on Arrow.

Change-Id: Ifd1479d808df7cc9a69c9dbcb0053ef2759f6079
Reviewed-on: https://gerrit.chromium.org/gerrit/45275
Reviewed-by: Stuart Abercrombie <sabercrombie@chromium.org>
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
Tested-by: Ilja H. Friedel <ihf@chromium.org>
Commit-Queue: Ilja H. Friedel <ihf@chromium.org>
diff --git a/client/deps/glbench/src/main.cc b/client/deps/glbench/src/main.cc
index 173d36a..0c7bbcf 100644
--- a/client/deps/glbench/src/main.cc
+++ b/client/deps/glbench/src/main.cc
@@ -55,6 +55,7 @@
 bool PassesSanityCheck(void) {
   GLint viewport[2];
   glGetIntegerv(GL_MAX_VIEWPORT_DIMS, viewport);
+  printf("# MAX_VIEWPORT_DIMS=(%d, %d)\n", viewport[0], viewport[1]);
   if (viewport[0] < g_width || viewport[1] < g_height) {
     printf("# Error: MAX_VIEWPORT_DIMS=(%d, %d) are too small.\n",
            viewport[0], viewport[1]);
@@ -75,6 +76,8 @@
 
   printf("# board_id: %s - %s\n",
          glGetString(GL_VENDOR), glGetString(GL_RENDERER));
+  if (!PassesSanityCheck())
+    return 1;
   g_main_gl_interface->Cleanup();
 
   if (argc == 1) {
@@ -85,8 +88,6 @@
     printf("\n");
   }
   printDateTime();
-  if (!PassesSanityCheck())
-    return 1;
 
   vector<string> enabled_tests;
   base::SplitString(FLAGS_tests, ':', &enabled_tests);