Home | History | Annotate | Download | only in performance
      1 /*-------------------------------------------------------------------------
      2  * drawElements Quality Program OpenGL ES 2.0 Module
      3  * -------------------------------------------------
      4  *
      5  * Copyright 2014 The Android Open Source Project
      6  *
      7  * Licensed under the Apache License, Version 2.0 (the "License");
      8  * you may not use this file except in compliance with the License.
      9  * You may obtain a copy of the License at
     10  *
     11  *      http://www.apache.org/licenses/LICENSE-2.0
     12  *
     13  * Unless required by applicable law or agreed to in writing, software
     14  * distributed under the License is distributed on an "AS IS" BASIS,
     15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16  * See the License for the specific language governing permissions and
     17  * limitations under the License.
     18  *
     19  *//*!
     20  * \file
     21  * \brief Texture format performance tests.
     22  *//*--------------------------------------------------------------------*/
     23 
     24 #include "es2pTextureFormatTests.hpp"
     25 #include "es2pTextureCases.hpp"
     26 #include "gluStrUtil.hpp"
     27 
     28 #include "glwEnums.hpp"
     29 
     30 using std::string;
     31 
     32 namespace deqp
     33 {
     34 namespace gles2
     35 {
     36 namespace Performance
     37 {
     38 
     39 TextureFormatTests::TextureFormatTests (Context& context)
     40 	: TestCaseGroup(context, "format", "Texture Format Performance Tests")
     41 {
     42 }
     43 
     44 TextureFormatTests::~TextureFormatTests (void)
     45 {
     46 }
     47 
     48 void TextureFormatTests::init (void)
     49 {
     50 	static const struct
     51 	{
     52 		const char*	name;
     53 		deUint32	format;
     54 		deUint32	dataType;
     55 	} texFormats[] =
     56 	{
     57 		{ "a8",			GL_ALPHA,			GL_UNSIGNED_BYTE },
     58 		{ "l8",			GL_LUMINANCE,		GL_UNSIGNED_BYTE },
     59 		{ "la88",		GL_LUMINANCE_ALPHA,	GL_UNSIGNED_BYTE },
     60 		{ "rgb565",		GL_RGB,				GL_UNSIGNED_SHORT_5_6_5 },
     61 		{ "rgba4444",	GL_RGBA,			GL_UNSIGNED_SHORT_4_4_4_4 },
     62 		{ "rgba5551",	GL_RGBA,			GL_UNSIGNED_SHORT_5_5_5_1 },
     63 		{ "rgb888",		GL_RGB,				GL_UNSIGNED_BYTE },
     64 		{ "rgba8888",	GL_RGBA,			GL_UNSIGNED_BYTE }
     65 	};
     66 
     67 	for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(texFormats); formatNdx++)
     68 	{
     69 		deUint32	format			= texFormats[formatNdx].format;
     70 		deUint32	dataType		= texFormats[formatNdx].dataType;
     71 		string		nameBase		= texFormats[formatNdx].name;
     72 		deUint32	wrapS			= GL_CLAMP_TO_EDGE;
     73 		deUint32	wrapT			= GL_CLAMP_TO_EDGE;
     74 		deUint32	minFilter		= GL_NEAREST;
     75 		deUint32	magFilter		= GL_NEAREST;
     76 		int			numTextures		= 1;
     77 		string		descriptionBase	= string(glu::getTextureFormatName(format)) + ", " + glu::getTypeName(dataType);
     78 
     79 		addChild(new Texture2DRenderCase(m_context, nameBase.c_str(), descriptionBase.c_str(), format, dataType, wrapS, wrapT, minFilter, magFilter, tcu::Mat3(), numTextures, false /* npot */));
     80 	}
     81 }
     82 
     83 } // Performance
     84 } // gles2
     85 } // deqp
     86