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 16extern double g_initial_temperature; 17 18void SetBasePathFromArgv0(const char* argv0, const char* relative); 19void *MmapFile(const char *name, size_t *length); 20const base::FilePath& GetBasePath(); 21 22// Returns temperature of system before testing started. It is used as a 23// reference for keeping the machine cool. 24const double GetInitialMachineTemperature(); 25// For thermal monitoring of system. 26double 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. 29double WaitForCoolMachine(double cold_temperature, double timeout, 30 double *temperature); 31 32namespace glbench { 33 34GLuint SetupTexture(GLsizei size_log2); 35GLuint SetupVBO(GLenum target, GLsizeiptr size, const GLvoid *data); 36void CreateLattice(GLfloat **vertices, GLsizeiptr *size, 37 GLfloat size_x, GLfloat size_y, int width, int height); 38int CreateMesh(GLushort **indices, GLsizeiptr *size, 39 int width, int height, int culled_ratio); 40GLuint InitShaderProgram(const char *vertex_src, const char *fragment_src); 41GLuint InitShaderProgramWithHeader(const char* header, 42 const char* vertex_src, 43 const char* fragment_src); 44GLuint InitShaderProgramWithHeaders(const char** headers, 45 int count, 46 const char* vertex_src, 47 const char* fragment_src); 48void ClearBuffers(); 49 50} // namespace glbench 51 52#endif // BENCH_GL_UTILS_H_ 53