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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <stdlib.h>
6
7 #include "main.h"
8 #include "testbase.h"
9 #include "utils.h"
10
11
12 namespace glbench {
13
14
15 class TriangleSetupTest : public DrawElementsTestFunc {
16 public:
17 TriangleSetupTest() {}
18 virtual ~TriangleSetupTest() {}
19 virtual bool Run();
20
21 private:
22 DISALLOW_COPY_AND_ASSIGN(TriangleSetupTest);
23 };
24
25
26 bool TriangleSetupTest::Run() {
27 glViewport(-g_width, -g_height, g_width*2, g_height*2);
28
29 // Larger meshes make this test too slow for devices that do 1 mtri/sec.
30 GLint width = 64;
31 GLint height = 64;
32
33 GLfloat *vertices = NULL;
34 GLsizeiptr vertex_buffer_size = 0;
35 CreateLattice(&vertices, &vertex_buffer_size, 1.f / g_width, 1.f / g_height,
36 width, height);
37 GLuint vertex_buffer = SetupVBO(GL_ARRAY_BUFFER,
38 vertex_buffer_size, vertices);
39 glVertexPointer(2, GL_FLOAT, 0, 0);
40 glEnableClientState(GL_VERTEX_ARRAY);
41
42 GLuint *indices = NULL;
43 GLuint index_buffer = 0;
44 GLsizeiptr index_buffer_size = 0;
45
46 {
47 count_ = CreateMesh(&indices, &index_buffer_size, width, height, 0);
48
49 index_buffer = SetupVBO(GL_ELEMENT_ARRAY_BUFFER,
50 index_buffer_size, indices);
51 RunTest(this, "mtri_sec_triangle_setup", count_ / 3, true);
52 glEnable(GL_CULL_FACE);
53 RunTest(this, "mtri_sec_triangle_setup_all_culled", count_ / 3, true);
54 glDisable(GL_CULL_FACE);
55
56 glDeleteBuffers(1, &index_buffer);
57 delete[] indices;
58 }
59
60 {
61 glColor4f(0.f, 1.f, 1.f, 1.f);
62 count_ = CreateMesh(&indices, &index_buffer_size, width, height,
63 RAND_MAX / 2);
64
65 index_buffer = SetupVBO(GL_ELEMENT_ARRAY_BUFFER,
66 index_buffer_size, indices);
67 glEnable(GL_CULL_FACE);
68 RunTest(this, "mtri_sec_triangle_setup_half_culled", count_ / 3, true);
69
70 glDeleteBuffers(1, &index_buffer);
71 delete[] indices;
72 }
73
74 glDeleteBuffers(1, &vertex_buffer);
75 delete[] vertices;
76 return true;
77 }
78
79
80 TestBase* GetTriangleSetupTest() {
81 return new TriangleSetupTest;
82 }
83
84
85 } // namespace glbench
OLDNEW
« 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