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

Unified Diff: client/deps/glbench/src/fillratetest.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/cleartest.cc ('k') | client/deps/glbench/src/main.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/deps/glbench/src/fillratetest.cc
diff --git a/client/deps/glbench/src/fillratetest.cc b/client/deps/glbench/src/fillratetest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1378e163c9d937674e39fad90d24dd47dcdd1cbe
--- /dev/null
+++ b/client/deps/glbench/src/fillratetest.cc
@@ -0,0 +1,105 @@
+// 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 "base/logging.h"
+#include "main.h"
+#include "testbase.h"
+#include "utils.h"
+
+namespace glbench {
+
+
+class FillRateTest : public DrawArraysTestFunc {
+ public:
+ FillRateTest() {}
+ virtual ~FillRateTest() {}
+ virtual bool Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(FillRateTest);
+};
+
+
+bool FillRateTest::Run() {
+ glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
+ glDisable(GL_DEPTH_TEST);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ GLfloat buffer_vertex[8] = {
+ -1.f, -1.f,
+ 1.f, -1.f,
+ -1.f, 1.f,
+ 1.f, 1.f,
+ };
+ GLfloat buffer_texture[8] = {
+ 0.f, 0.f,
+ 1.f, 0.f,
+ 0.f, 1.f,
+ 1.f, 1.f,
+ };
+ glEnableClientState(GL_VERTEX_ARRAY);
+
+ GLuint vbo_vertex = SetupVBO(GL_ARRAY_BUFFER,
+ sizeof(buffer_vertex), buffer_vertex);
+ glVertexPointer(2, GL_FLOAT, 0, 0);
+
+ GLuint vbo_texture = SetupVBO(GL_ARRAY_BUFFER,
+ sizeof(buffer_texture), buffer_texture);
+ glTexCoordPointer(2, GL_FLOAT, 0, 0);
+
+ glColor4f(1.f, 0.f, 0.f, 1.f);
+ FillRateTestNormal("fill_solid");
+ FillRateTestBlendDepth("fill_solid");
+
+ glColor4f(1.f, 1.f, 1.f, 1.f);
+ glEnableClientState(GL_TEXTURE_COORD_ARRAY);
+ glEnable(GL_TEXTURE_2D);
+
+ GLuint texture = SetupTexture(9);
+ FillRateTestNormal("fill_tex_nearest");
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ FillRateTestNormal("fill_tex_bilinear");
+
+ // lod = 0.5
+ glScalef(0.7071f, 0.7071f, 1.f);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR_MIPMAP_NEAREST);
+ FillRateTestNormalSubWindow("fill_tex_trilinear_nearest_05",
+ 0.7071f * g_width, 0.7071f * g_height);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR_MIPMAP_LINEAR);
+ FillRateTestNormalSubWindow("fill_tex_trilinear_linear_05",
+ 0.7071f * g_width, 0.7071f * g_height);
+
+ // lod = 0.4
+ glLoadIdentity();
+ glScalef(0.758f, 0.758f, 1.f);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR_MIPMAP_LINEAR);
+ FillRateTestNormalSubWindow("fill_tex_trilinear_linear_04",
+ 0.758f * g_width, 0.758f * g_height);
+
+ // lod = 0.1
+ glLoadIdentity();
+ glScalef(0.933f, 0.933f, 1.f);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR_MIPMAP_LINEAR);
+ FillRateTestNormalSubWindow("fill_tex_trilinear_linear_01",
+ 0.933f * g_width, 0.933f * g_height);
+
+ glDeleteBuffers(1, &vbo_vertex);
+ glDeleteBuffers(1, &vbo_texture);
+ glDeleteTextures(1, &texture);
+
+ return true;
+}
+
+TestBase* GetFillRateTest() {
+ return new FillRateTest;
+}
+
+} // namespace glbench
« no previous file with comments | « client/deps/glbench/src/cleartest.cc ('k') | client/deps/glbench/src/main.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698