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 #ifndef BENCH_GL_UTILS_H_ 6 #define BENCH_GL_UTILS_H_ 7 8 #if defined(USE_OPENGLES) 9 #include "GLES2/gl2.h" 10 #elif defined(USE_OPENGL) 11 #include "GL/gl.h" 12 #endif 13 14 #include "base/files/file_path.h" 15 16 extern double g_initial_temperature; 17 18 void SetBasePathFromArgv0(const char* argv0, const char* relative); 19 void *MmapFile(const char *name, size_t *length); 20 const base::FilePath& GetBasePath(); 21 22 // Returns temperature of system before testing started. It is used as a 23 // reference for keeping the machine cool. 24 const double GetInitialMachineTemperature(); 25 // For thermal monitoring of system. 26 double GetMachineTemperature(); 27 // Wait for machine to cool with temperature in Celsius and timeout in seconds. 28 // Returns the time spent waiting and sets the last observed temperature. 29 double WaitForCoolMachine(double cold_temperature, double timeout, 30 double *temperature); 31 32 namespace glbench { 33 34 GLuint SetupTexture(GLsizei size_log2); 35 GLuint SetupVBO(GLenum target, GLsizeiptr size, const GLvoid *data); 36 void CreateLattice(GLfloat **vertices, GLsizeiptr *size, 37 GLfloat size_x, GLfloat size_y, int width, int height); 38 int CreateMesh(GLushort **indices, GLsizeiptr *size, 39 int width, int height, int culled_ratio); 40 GLuint InitShaderProgram(const char *vertex_src, const char *fragment_src); 41 GLuint InitShaderProgramWithHeader(const char* header, 42 const char* vertex_src, 43 const char* fragment_src); 44 GLuint InitShaderProgramWithHeaders(const char** headers, 45 int count, 46 const char* vertex_src, 47 const char* fragment_src); 48 void ClearBuffers(); 49 50 } // namespace glbench 51 52 #endif // BENCH_GL_UTILS_H_ 53