OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This tool is used to benchmark the technique of using tiles to render a | 5 // This tool is used to benchmark the technique of using tiles to render a |
6 // large tecture. This tool runs with different tile sizes so that developer | 6 // large tecture. This tool runs with different tile sizes so that developer |
7 // can determine the right dimensions for the tiles. | 7 // can determine the right dimensions for the tiles. |
8 | 8 |
9 #include <iostream> | 9 #include <iostream> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Factor for dividing the size from one step to another. | 29 // Factor for dividing the size from one step to another. |
30 static const int kSizeFactor = 2; | 30 static const int kSizeFactor = 2; |
31 | 31 |
32 // Number of renders before we output. | 32 // Number of renders before we output. |
33 static const int kRenderCount = 1000; | 33 static const int kRenderCount = 1000; |
34 static const int kMaxTextures = kStartSize * kStartSize / kEndSize / kEndSize; | 34 static const int kMaxTextures = kStartSize * kStartSize / kEndSize / kEndSize; |
35 | 35 |
36 Display* g_display = NULL; | 36 Display* g_display = NULL; |
37 Window g_window = 0; | 37 Window g_window = 0; |
38 bool g_running = false; | |
39 GLXContext g_gl_context = NULL; | 38 GLXContext g_gl_context = NULL; |
40 GLuint g_textures[kMaxTextures]; | 39 GLuint g_textures[kMaxTextures]; |
41 scoped_array<uint8> g_image; | 40 scoped_array<uint8> g_image; |
42 | 41 |
43 // Initialize X11. Returns true if successful. This method creates the X11 | 42 // Initialize X11. Returns true if successful. This method creates the X11 |
44 // window. Further initialization is done in X11VideoRenderer. | 43 // window. Further initialization is done in X11VideoRenderer. |
45 bool InitX11() { | 44 bool InitX11() { |
46 g_display = XOpenDisplay(NULL); | 45 g_display = XOpenDisplay(NULL); |
47 if (!g_display) { | 46 if (!g_display) { |
48 std::cout << "Error - cannot open display" << std::endl; | 47 std::cout << "Error - cannot open display" << std::endl; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 235 |
237 // Cleanup GL. | 236 // Cleanup GL. |
238 glXMakeCurrent(g_display, 0, NULL); | 237 glXMakeCurrent(g_display, 0, NULL); |
239 glXDestroyContext(g_display, g_gl_context); | 238 glXDestroyContext(g_display, g_gl_context); |
240 | 239 |
241 // Destroy window and display. | 240 // Destroy window and display. |
242 XDestroyWindow(g_display, g_window); | 241 XDestroyWindow(g_display, g_window); |
243 XCloseDisplay(g_display); | 242 XCloseDisplay(g_display); |
244 return 0; | 243 return 0; |
245 } | 244 } |
OLD | NEW |