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