1 // Copyright (c) 2012 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_TEXTURETEST_H_ 6 #define BENCH_GL_TEXTURETEST_H_ 7 8 #include <memory> 9 10 #include "testbase.h" 11 #include "utils.h" 12 13 namespace glbench { 14 15 namespace { 16 17 const int kNumberOfTextures = 8; 18 19 } // namespace 20 21 class TextureTest : public TestBase { 22 public: TextureTest()23 TextureTest() {} ~TextureTest()24 virtual ~TextureTest() {} 25 virtual bool TextureMetaDataInit(); 26 virtual bool TestFunc(uint64_t iterations) = 0; 27 virtual bool Run(); 28 virtual const char* Name() const = 0; Unit()29 virtual const char* Unit() const { return "mtexel_sec"; } IsTextureUploadTest()30 virtual bool IsTextureUploadTest() const { return true; } 31 32 enum UpdateFlavor { TEX_IMAGE, TEX_SUBIMAGE }; 33 34 protected: 35 GLuint width_; 36 GLuint height_; 37 GLuint program_; 38 int texsize_; 39 std::unique_ptr<char[]> pixels_[kNumberOfTextures]; 40 GLuint textures_[kNumberOfTextures]; 41 UpdateFlavor flavor_; 42 GLenum texel_gl_format_; 43 DISALLOW_COPY_AND_ASSIGN(TextureTest); 44 // Textures formats 45 std::vector<GLenum> kTexelFormats; 46 std::map<GLenum, std::string> kTexelFormatNames; 47 std::map<GLenum, unsigned int> kTexelFormatSizes; 48 49 // Texture upload commands 50 std::map<UpdateFlavor, std::string> kFlavors; 51 }; 52 53 } // namespace glbench 54 55 #endif // BENCH_GL_TEXTURETEST_H_ 56