Home | History | Annotate | Download | only in functional
      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 GLES2 Scissor tests.
     22  *//*--------------------------------------------------------------------*/
     23 
     24 #include "es2fScissorTests.hpp"
     25 
     26 #include "glsScissorTests.hpp"
     27 
     28 #include "tcuVector.hpp"
     29 
     30 #include "glwEnums.hpp"
     31 
     32 namespace deqp
     33 {
     34 namespace gles2
     35 {
     36 namespace Functional
     37 {
     38 
     39 ScissorTests::ScissorTests (Context& context)
     40 	: TestCaseGroup	(context, "scissor", "Scissor Tests")
     41 {
     42 }
     43 
     44 ScissorTests::~ScissorTests (void)
     45 {
     46 }
     47 
     48 void ScissorTests::init (void)
     49 {
     50 	using tcu::Vec4;
     51 	using namespace gls::Functional::ScissorTestInternal;
     52 
     53 	tcu::TestContext&		tc = m_context.getTestContext();
     54 	glu::RenderContext&		rc = m_context.getRenderContext();
     55 
     56 	const struct
     57 	{
     58 		const char*		name;
     59 		const char*		desc;
     60 		const tcu::Vec4	scissor;
     61 		const tcu::Vec4	render;
     62 		PrimitiveType	type;
     63 		const int		primitives;
     64 	} cases[] =
     65 	{
     66 		{ "contained_tris",			"Triangles fully inside scissor area (single call)",		Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), TRIANGLE,	30 },
     67 		{ "partial_tris",			"Triangles partially inside scissor area (single call)",	Vec4(0.3f, 0.3f, 0.4f, 0.4f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), TRIANGLE,	30 },
     68 		{ "contained_tri",			"Triangle fully inside scissor area",						Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), TRIANGLE,	1  },
     69 		{ "enclosing_tri",			"Triangle fully covering scissor area",						Vec4(0.4f, 0.4f, 0.2f, 0.2f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), TRIANGLE,	1  },
     70 		{ "partial_tri",			"Triangle partially inside scissor area",					Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), TRIANGLE,	1  },
     71 		{ "outside_render_tri",		"Triangle with scissor area outside render target",			Vec4(1.4f, 1.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 0.6f, 0.6f), TRIANGLE,	1  },
     72 		{ "partial_lines",			"Linse partially inside scissor area",						Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), LINE,		30 },
     73 		{ "contained_line",			"Line fully inside scissor area",							Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.2f, 0.2f, 0.6f, 0.6f), LINE,		1  },
     74 		{ "partial_line",			"Line partially inside scissor area",						Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), LINE,		1  },
     75 		{ "outside_render_line",	"Line with scissor area outside render target",				Vec4(1.4f, 1.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 0.6f, 0.6f), LINE,		1  },
     76 		{ "contained_point",		"Point fully inside scissor area",							Vec4(0.1f, 0.1f, 0.8f, 0.8f), Vec4(0.5f, 0.5f, 0.0f, 0.0f), POINT,		1  },
     77 		{ "partial_points",			"Points partially inside scissor area",						Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 1.0f, 1.0f), POINT,		30 },
     78 		{ "outside_point",			"Point fully outside scissor area",							Vec4(0.4f, 0.4f, 0.6f, 0.6f), Vec4(0.0f, 0.0f, 0.0f, 0.0f), POINT,		1  },
     79 		{ "outside_render_point",	"Point with scissor area outside render target",			Vec4(1.4f, 1.4f, 0.6f, 0.6f), Vec4(0.5f, 0.5f, 0.0f, 0.0f),	POINT,		1  }
     80 	};
     81 
     82 	for(int caseNdx = 0; caseNdx < DE_LENGTH_OF_ARRAY(cases); caseNdx++)
     83 	{
     84 		addChild(createPrimitiveTest(tc,
     85 									 rc,
     86 									 cases[caseNdx].name,
     87 									 cases[caseNdx].desc,
     88 									 cases[caseNdx].scissor,
     89 									 cases[caseNdx].render,
     90 									 cases[caseNdx].type,
     91 									 cases[caseNdx].primitives));
     92 	}
     93 
     94 	addChild(createClearTest(tc, rc, "clear_depth",		"Depth buffer clear",	Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_DEPTH_BUFFER_BIT));
     95 	addChild(createClearTest(tc, rc, "clear_stencil",	"Stencil buffer clear",	Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_STENCIL_BUFFER_BIT));
     96 	addChild(createClearTest(tc, rc, "clear_color",		"Color buffer clear",	Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_COLOR_BUFFER_BIT));
     97 }
     98 
     99 } // Functional
    100 } // gles2
    101 } // deqp
    102