glbench: add ContextTest and GLInterfaceTest base class
Add a test class, ContextTest, to test context switching. This is
similar enough to SwapTest so create a base class GLInterfaceTest that
contains code that is common to both. ContextTest and SwapTest classes
derive from GLInterfaceTest:
GLInterfaceTest
|
+--------+--------+
| |
ContextTest SwapTest
BUG=chromium-os:36746,chromium-os:36750
TEST=emerge autotest-deps-glbench, run: "glbench -tests swap:context"
Change-Id: Ibc5e506c61bdbca75a81e04ee6ca70af310c345c
Signed-off-by: Simon Que <sque@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39886
Reviewed-by: Ilja H. Friedel <ihf@chromium.org>
diff --git a/client/deps/glbench/src/main.cc b/client/deps/glbench/src/main.cc
index cc6a50a..642665d 100644
--- a/client/deps/glbench/src/main.cc
+++ b/client/deps/glbench/src/main.cc
@@ -62,10 +62,9 @@
return 1;
}
- g_main_gl_interface->InitContext();
printf("# board_id: %s - %s\n",
glGetString(GL_VENDOR), glGetString(GL_RENDERER));
- g_main_gl_interface->DestroyContext();
+ g_main_gl_interface->Cleanup();
if (argc == 1) {
printf("# Usage: %s [-save [-outdir=<directory>]] to save images\n", argv[0]);
@@ -80,6 +79,7 @@
base::SplitString(FLAGS_tests, ':', &enabled_tests);
glbench::TestBase* tests[] = {
glbench::GetSwapTest(),
+ glbench::GetContextTest(),
glbench::GetClearTest(),
glbench::GetFillRateTest(),
glbench::GetWindowManagerCompositingTest(false),
@@ -99,13 +99,13 @@
for (unsigned int i = 0; i < arraysize(tests); i++) {
if (!test_is_enabled(tests[i], enabled_tests))
continue;
- if (!g_main_gl_interface->InitContext()) {
- printf("InitContext failed\n");
+ if (!g_main_gl_interface->Init()) {
+ printf("Initialize failed\n");
return 1;
}
glbench::ClearBuffers();
tests[i]->Run();
- g_main_gl_interface->DestroyContext();
+ g_main_gl_interface->Cleanup();
}
} while (GetUTime() < done);