1e5c31af7Sopenharmony_ci/*-------------------------------------------------------------------------
2e5c31af7Sopenharmony_ci * drawElements Quality Program OpenGL ES 3.0 Module
3e5c31af7Sopenharmony_ci * -------------------------------------------------
4e5c31af7Sopenharmony_ci *
5e5c31af7Sopenharmony_ci * Copyright 2014 The Android Open Source Project
6e5c31af7Sopenharmony_ci *
7e5c31af7Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
8e5c31af7Sopenharmony_ci * you may not use this file except in compliance with the License.
9e5c31af7Sopenharmony_ci * You may obtain a copy of the License at
10e5c31af7Sopenharmony_ci *
11e5c31af7Sopenharmony_ci *      http://www.apache.org/licenses/LICENSE-2.0
12e5c31af7Sopenharmony_ci *
13e5c31af7Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
14e5c31af7Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
15e5c31af7Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16e5c31af7Sopenharmony_ci * See the License for the specific language governing permissions and
17e5c31af7Sopenharmony_ci * limitations under the License.
18e5c31af7Sopenharmony_ci *
19e5c31af7Sopenharmony_ci *//*!
20e5c31af7Sopenharmony_ci * \file
21e5c31af7Sopenharmony_ci * \brief GLES3 Scissor tests
22e5c31af7Sopenharmony_ci *//*--------------------------------------------------------------------*/
23e5c31af7Sopenharmony_ci
24e5c31af7Sopenharmony_ci#include "es3fScissorTests.hpp"
25e5c31af7Sopenharmony_ci
26e5c31af7Sopenharmony_ci#include "glsScissorTests.hpp"
27e5c31af7Sopenharmony_ci
28e5c31af7Sopenharmony_ci#include "sglrGLContext.hpp"
29e5c31af7Sopenharmony_ci#include "sglrReferenceContext.hpp"
30e5c31af7Sopenharmony_ci#include "sglrContextUtil.hpp"
31e5c31af7Sopenharmony_ci
32e5c31af7Sopenharmony_ci#include "tcuVector.hpp"
33e5c31af7Sopenharmony_ci#include "tcuRenderTarget.hpp"
34e5c31af7Sopenharmony_ci#include "tcuImageCompare.hpp"
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ci#include "gluStrUtil.hpp"
37e5c31af7Sopenharmony_ci#include "gluDrawUtil.hpp"
38e5c31af7Sopenharmony_ci
39e5c31af7Sopenharmony_ci#include "glwEnums.hpp"
40e5c31af7Sopenharmony_ci#include "deDefs.hpp"
41e5c31af7Sopenharmony_ci
42e5c31af7Sopenharmony_cinamespace deqp
43e5c31af7Sopenharmony_ci{
44e5c31af7Sopenharmony_cinamespace gles3
45e5c31af7Sopenharmony_ci{
46e5c31af7Sopenharmony_cinamespace Functional
47e5c31af7Sopenharmony_ci{
48e5c31af7Sopenharmony_ci
49e5c31af7Sopenharmony_ciScissorTests::ScissorTests (Context& context):
50e5c31af7Sopenharmony_ci	TestCaseGroup	(context, "scissor", "Scissor Tests")
51e5c31af7Sopenharmony_ci{
52e5c31af7Sopenharmony_ci}
53e5c31af7Sopenharmony_ci
54e5c31af7Sopenharmony_ciScissorTests::~ScissorTests (void)
55e5c31af7Sopenharmony_ci{
56e5c31af7Sopenharmony_ci}
57e5c31af7Sopenharmony_ci
58e5c31af7Sopenharmony_civoid ScissorTests::init (void)
59e5c31af7Sopenharmony_ci{
60e5c31af7Sopenharmony_ci	using tcu::Vec4;
61e5c31af7Sopenharmony_ci	using namespace gls::Functional::ScissorTestInternal;
62e5c31af7Sopenharmony_ci
63e5c31af7Sopenharmony_ci	tcu::TestContext&		tc = m_context.getTestContext();
64e5c31af7Sopenharmony_ci	glu::RenderContext&		rc = m_context.getRenderContext();
65e5c31af7Sopenharmony_ci
66e5c31af7Sopenharmony_ci	const struct
67e5c31af7Sopenharmony_ci	{
68e5c31af7Sopenharmony_ci		const char*			name;
69e5c31af7Sopenharmony_ci		const char*			desc;
70e5c31af7Sopenharmony_ci		const tcu::Vec4		scissor;
71e5c31af7Sopenharmony_ci		const tcu::Vec4		render;
72e5c31af7Sopenharmony_ci		const PrimitiveType	type;
73e5c31af7Sopenharmony_ci		const int			primitives;
74e5c31af7Sopenharmony_ci	} cases[] =
75e5c31af7Sopenharmony_ci	{
76e5c31af7Sopenharmony_ci		{ "contained_quads",		"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 },
77e5c31af7Sopenharmony_ci		{ "partial_quads",			"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 },
78e5c31af7Sopenharmony_ci		{ "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  },
79e5c31af7Sopenharmony_ci		{ "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  },
80e5c31af7Sopenharmony_ci		{ "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  },
81e5c31af7Sopenharmony_ci		{ "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  },
82e5c31af7Sopenharmony_ci		{ "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 },
83e5c31af7Sopenharmony_ci		{ "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  },
84e5c31af7Sopenharmony_ci		{ "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  },
85e5c31af7Sopenharmony_ci		{ "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  },
86e5c31af7Sopenharmony_ci		{ "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  },
87e5c31af7Sopenharmony_ci		{ "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 },
88e5c31af7Sopenharmony_ci		{ "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  },
89e5c31af7Sopenharmony_ci		{ "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  }
90e5c31af7Sopenharmony_ci	};
91e5c31af7Sopenharmony_ci
92e5c31af7Sopenharmony_ci	for (int caseNdx = 0; caseNdx < DE_LENGTH_OF_ARRAY(cases); caseNdx++)
93e5c31af7Sopenharmony_ci	{
94e5c31af7Sopenharmony_ci		addChild(createPrimitiveTest(tc,
95e5c31af7Sopenharmony_ci									 rc,
96e5c31af7Sopenharmony_ci									 cases[caseNdx].name,
97e5c31af7Sopenharmony_ci									 cases[caseNdx].desc,
98e5c31af7Sopenharmony_ci									 cases[caseNdx].scissor,
99e5c31af7Sopenharmony_ci									 cases[caseNdx].render,
100e5c31af7Sopenharmony_ci									 cases[caseNdx].type,
101e5c31af7Sopenharmony_ci									 cases[caseNdx].primitives));
102e5c31af7Sopenharmony_ci	}
103e5c31af7Sopenharmony_ci
104e5c31af7Sopenharmony_ci	addChild(createClearTest(tc, rc, "clear_depth",		"Depth buffer clear",	Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_DEPTH_BUFFER_BIT));
105e5c31af7Sopenharmony_ci	addChild(createClearTest(tc, rc, "clear_stencil",	"Stencil buffer clear",	Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_STENCIL_BUFFER_BIT));
106e5c31af7Sopenharmony_ci	addChild(createClearTest(tc, rc, "clear_color",		"Color buffer clear",	Vec4(0.1f, 0.1f, 0.8f, 0.8f), GL_COLOR_BUFFER_BIT));
107e5c31af7Sopenharmony_ci
108e5c31af7Sopenharmony_ci	addChild(createFramebufferClearTest(tc, rc, "clear_fixed_buffer",			"Fixed point color clear",			CLEAR_COLOR_FIXED));
109e5c31af7Sopenharmony_ci	addChild(createFramebufferClearTest(tc, rc, "clear_int_buffer",				"Integer color clear",				CLEAR_COLOR_INT));
110e5c31af7Sopenharmony_ci	addChild(createFramebufferClearTest(tc, rc, "clear_uint_buffer",			"Unsigned integer buffer clear",	CLEAR_COLOR_UINT));
111e5c31af7Sopenharmony_ci	addChild(createFramebufferClearTest(tc, rc, "clear_depth_buffer",			"Depth buffer clear",				CLEAR_DEPTH));
112e5c31af7Sopenharmony_ci	addChild(createFramebufferClearTest(tc, rc, "clear_stencil_buffer",			"Stencil buffer clear",				CLEAR_STENCIL));
113e5c31af7Sopenharmony_ci	addChild(createFramebufferClearTest(tc, rc, "clear_depth_stencil_buffer",	"Fixed point color buffer clear",	CLEAR_DEPTH_STENCIL));
114e5c31af7Sopenharmony_ci
115e5c31af7Sopenharmony_ci	addChild(createFramebufferBlitTest(tc, rc, "framebuffer_blit_center",	"Blit to default framebuffer, scissor away edges",			Vec4(0.1f, 0.1f, 0.8f, 0.8f)));
116e5c31af7Sopenharmony_ci	addChild(createFramebufferBlitTest(tc, rc, "framebuffer_blit_corner",	"Blit to default framebuffer, scissor all but a corner",	Vec4(0.6f, 0.6f, 0.5f, 0.5f)));
117e5c31af7Sopenharmony_ci	addChild(createFramebufferBlitTest(tc, rc, "framebuffer_blit_none",		"Blit to default framebuffer, scissor area outside screen", Vec4(1.6f, 0.6f, 0.5f, 0.5f)));
118e5c31af7Sopenharmony_ci}
119e5c31af7Sopenharmony_ci
120e5c31af7Sopenharmony_ci} // Functional
121e5c31af7Sopenharmony_ci} // gles3
122e5c31af7Sopenharmony_ci} // deqp
123