Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(638)

Unified Diff: client/deps/glbench/src/trianglesetuptest.cc

Issue 2123013: Split tests into individual files. Got rid of globals by converting them to classes. (Closed) Base URL: ssh://git@chromiumos-git//autotest.git
Patch Set: addressed comments Created 10 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « client/deps/glbench/src/testbase.cc ('k') | client/deps/glbench/src/utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/deps/glbench/src/trianglesetuptest.cc
diff --git a/client/deps/glbench/src/trianglesetuptest.cc b/client/deps/glbench/src/trianglesetuptest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6610eed68de107aa030fc200ae30b52c8fc128c7
--- /dev/null
+++ b/client/deps/glbench/src/trianglesetuptest.cc
@@ -0,0 +1,85 @@
+// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdlib.h>
+
+#include "main.h"
+#include "testbase.h"
+#include "utils.h"
+
+
+namespace glbench {
+
+
+class TriangleSetupTest : public DrawElementsTestFunc {
+ public:
+ TriangleSetupTest() {}
+ virtual ~TriangleSetupTest() {}
+ virtual bool Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TriangleSetupTest);
+};
+
+
+bool TriangleSetupTest::Run() {
+ glViewport(-g_width, -g_height, g_width*2, g_height*2);
+
+ // Larger meshes make this test too slow for devices that do 1 mtri/sec.
+ GLint width = 64;
+ GLint height = 64;
+
+ GLfloat *vertices = NULL;
+ GLsizeiptr vertex_buffer_size = 0;
+ CreateLattice(&vertices, &vertex_buffer_size, 1.f / g_width, 1.f / g_height,
+ width, height);
+ GLuint vertex_buffer = SetupVBO(GL_ARRAY_BUFFER,
+ vertex_buffer_size, vertices);
+ glVertexPointer(2, GL_FLOAT, 0, 0);
+ glEnableClientState(GL_VERTEX_ARRAY);
+
+ GLuint *indices = NULL;
+ GLuint index_buffer = 0;
+ GLsizeiptr index_buffer_size = 0;
+
+ {
+ count_ = CreateMesh(&indices, &index_buffer_size, width, height, 0);
+
+ index_buffer = SetupVBO(GL_ELEMENT_ARRAY_BUFFER,
+ index_buffer_size, indices);
+ RunTest(this, "mtri_sec_triangle_setup", count_ / 3, true);
+ glEnable(GL_CULL_FACE);
+ RunTest(this, "mtri_sec_triangle_setup_all_culled", count_ / 3, true);
+ glDisable(GL_CULL_FACE);
+
+ glDeleteBuffers(1, &index_buffer);
+ delete[] indices;
+ }
+
+ {
+ glColor4f(0.f, 1.f, 1.f, 1.f);
+ count_ = CreateMesh(&indices, &index_buffer_size, width, height,
+ RAND_MAX / 2);
+
+ index_buffer = SetupVBO(GL_ELEMENT_ARRAY_BUFFER,
+ index_buffer_size, indices);
+ glEnable(GL_CULL_FACE);
+ RunTest(this, "mtri_sec_triangle_setup_half_culled", count_ / 3, true);
+
+ glDeleteBuffers(1, &index_buffer);
+ delete[] indices;
+ }
+
+ glDeleteBuffers(1, &vertex_buffer);
+ delete[] vertices;
+ return true;
+}
+
+
+TestBase* GetTriangleSetupTest() {
+ return new TriangleSetupTest;
+}
+
+
+} // namespace glbench
« no previous file with comments | « client/deps/glbench/src/testbase.cc ('k') | client/deps/glbench/src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698