Home | History | Annotate | Download | only in performance
      1 /*-------------------------------------------------------------------------
      2  * drawElements Quality Program OpenGL ES 3.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 filtering performance tests.
     22  *//*--------------------------------------------------------------------*/
     23 
     24 #include "es3pTextureFilteringTests.hpp"
     25 #include "es3pTextureCases.hpp"
     26 #include "tcuMatrixUtil.hpp"
     27 
     28 #include "glwEnums.hpp"
     29 
     30 using std::string;
     31 
     32 namespace deqp
     33 {
     34 namespace gles3
     35 {
     36 namespace Performance
     37 {
     38 
     39 TextureFilteringTests::TextureFilteringTests (Context& context)
     40 	: TestCaseGroup(context, "filter", "Texture Filtering Performance Tests")
     41 {
     42 }
     43 
     44 TextureFilteringTests::~TextureFilteringTests (void)
     45 {
     46 }
     47 
     48 void TextureFilteringTests::init (void)
     49 {
     50 	static const struct
     51 	{
     52 		const char*	name;
     53 		deUint32	internalFormat;
     54 	} texFormats[] =
     55 	{
     56 		{ "rgb565",		GL_RGB565	},
     57 		{ "rgba8",		GL_RGBA8	},
     58 		{ "rg16f",		GL_RG16F	},
     59 		{ "rgba16f",	GL_RGBA16F	}
     60 	};
     61 	static const struct
     62 	{
     63 		const char*	name;
     64 		deUint32	filter;
     65 		bool		minify;
     66 	} cases[] =
     67 	{
     68 		{ "nearest",				GL_NEAREST,					true	},
     69 		{ "nearest",				GL_NEAREST,					false	},
     70 		{ "linear",					GL_LINEAR,					true	},
     71 		{ "linear",					GL_LINEAR,					false	},
     72 		{ "nearest_mipmap_nearest",	GL_NEAREST_MIPMAP_NEAREST,	true	},
     73 		{ "nearest_mipmap_linear",	GL_NEAREST_MIPMAP_LINEAR,	true	},
     74 		{ "linear_mipmap_nearest",	GL_LINEAR_MIPMAP_NEAREST,	true	},
     75 		{ "linear_mipmap_linear",	GL_LINEAR_MIPMAP_LINEAR,	true	}
     76 	};
     77 
     78 	tcu::Mat3 minTransform	= tcu::translationMatrix(tcu::Vec2(-0.3f, -0.6f)) * tcu::Mat3(tcu::Vec3(1.7f, 2.3f, 1.0f));
     79 	tcu::Mat3 magTransform	= tcu::translationMatrix(tcu::Vec2( 0.3f,  0.4f)) * tcu::Mat3(tcu::Vec3(0.3f, 0.2f, 1.0f));
     80 
     81 	for (int caseNdx = 0; caseNdx < DE_LENGTH_OF_ARRAY(cases); caseNdx++)
     82 	{
     83 		for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(texFormats); formatNdx++)
     84 		{
     85 			deUint32	format		= texFormats[formatNdx].internalFormat;
     86 			deUint32	minFilter	= cases[caseNdx].filter;
     87 			deUint32	magFilter	= (minFilter == GL_NEAREST || minFilter == GL_LINEAR) ? minFilter : GL_LINEAR;
     88 			deUint32	wrapS		= GL_REPEAT;
     89 			deUint32	wrapT		= GL_REPEAT;
     90 			int			numTextures	= 1;
     91 			bool		minify		= cases[caseNdx].minify;
     92 			string		name		= string(cases[caseNdx].name) + (minify ? "_minify_" : "_magnify_") + texFormats[formatNdx].name;
     93 
     94 			addChild(new Texture2DRenderCase(m_context, name.c_str(), "", format, wrapS, wrapT, minFilter, magFilter, minify ? minTransform : magTransform, numTextures, true /* pot */));
     95 		}
     96 	}
     97 }
     98 
     99 } // Performance
    100 } // gles3
    101 } // deqp
    102