1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES 2.0 Module
3*35238bceSAndroid Build Coastguard Worker * -------------------------------------------------
4*35238bceSAndroid Build Coastguard Worker *
5*35238bceSAndroid Build Coastguard Worker * Copyright 2014 The Android Open Source Project
6*35238bceSAndroid Build Coastguard Worker *
7*35238bceSAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License");
8*35238bceSAndroid Build Coastguard Worker * you may not use this file except in compliance with the License.
9*35238bceSAndroid Build Coastguard Worker * You may obtain a copy of the License at
10*35238bceSAndroid Build Coastguard Worker *
11*35238bceSAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0
12*35238bceSAndroid Build Coastguard Worker *
13*35238bceSAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software
14*35238bceSAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS,
15*35238bceSAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16*35238bceSAndroid Build Coastguard Worker * See the License for the specific language governing permissions and
17*35238bceSAndroid Build Coastguard Worker * limitations under the License.
18*35238bceSAndroid Build Coastguard Worker *
19*35238bceSAndroid Build Coastguard Worker *//*!
20*35238bceSAndroid Build Coastguard Worker * \file
21*35238bceSAndroid Build Coastguard Worker * \brief Negative Fragment Pipe API tests.
22*35238bceSAndroid Build Coastguard Worker *//*--------------------------------------------------------------------*/
23*35238bceSAndroid Build Coastguard Worker
24*35238bceSAndroid Build Coastguard Worker #include "es2fNegativeFragmentApiTests.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "es2fApiCase.hpp"
26*35238bceSAndroid Build Coastguard Worker
27*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "glwDefs.hpp"
29*35238bceSAndroid Build Coastguard Worker
30*35238bceSAndroid Build Coastguard Worker using namespace glw; // GL types
31*35238bceSAndroid Build Coastguard Worker
32*35238bceSAndroid Build Coastguard Worker namespace deqp
33*35238bceSAndroid Build Coastguard Worker {
34*35238bceSAndroid Build Coastguard Worker namespace gles2
35*35238bceSAndroid Build Coastguard Worker {
36*35238bceSAndroid Build Coastguard Worker namespace Functional
37*35238bceSAndroid Build Coastguard Worker {
38*35238bceSAndroid Build Coastguard Worker
39*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
40*35238bceSAndroid Build Coastguard Worker
NegativeFragmentApiTests(Context & context)41*35238bceSAndroid Build Coastguard Worker NegativeFragmentApiTests::NegativeFragmentApiTests(Context &context)
42*35238bceSAndroid Build Coastguard Worker : TestCaseGroup(context, "fragment", "Negative Fragment API Cases")
43*35238bceSAndroid Build Coastguard Worker {
44*35238bceSAndroid Build Coastguard Worker }
45*35238bceSAndroid Build Coastguard Worker
~NegativeFragmentApiTests(void)46*35238bceSAndroid Build Coastguard Worker NegativeFragmentApiTests::~NegativeFragmentApiTests(void)
47*35238bceSAndroid Build Coastguard Worker {
48*35238bceSAndroid Build Coastguard Worker }
49*35238bceSAndroid Build Coastguard Worker
init(void)50*35238bceSAndroid Build Coastguard Worker void NegativeFragmentApiTests::init(void)
51*35238bceSAndroid Build Coastguard Worker {
52*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(scissor, "Invalid glScissor() usage", {
53*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if either width or height is negative.");
54*35238bceSAndroid Build Coastguard Worker glScissor(0, 0, -1, 0);
55*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
56*35238bceSAndroid Build Coastguard Worker glScissor(0, 0, 0, -1);
57*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
58*35238bceSAndroid Build Coastguard Worker glScissor(0, 0, -1, -1);
59*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
60*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
61*35238bceSAndroid Build Coastguard Worker });
62*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(depth_func, "Invalid glDepthFunc() usage", {
63*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if func is not an accepted value.");
64*35238bceSAndroid Build Coastguard Worker glDepthFunc(-1);
65*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
66*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
67*35238bceSAndroid Build Coastguard Worker });
68*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(viewport, "Invalid glViewport() usage", {
69*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if either width or height is negative.");
70*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, -1, 1);
71*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
72*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, 1, -1);
73*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
74*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, -1, -1);
75*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
76*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
77*35238bceSAndroid Build Coastguard Worker });
78*35238bceSAndroid Build Coastguard Worker
79*35238bceSAndroid Build Coastguard Worker // Stencil functions
80*35238bceSAndroid Build Coastguard Worker
81*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(stencil_func, "Invalid glStencilFunc() usage", {
82*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if func is not one of the eight accepted values.");
83*35238bceSAndroid Build Coastguard Worker glStencilFunc(-1, 0, 1);
84*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
85*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
86*35238bceSAndroid Build Coastguard Worker });
87*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(stencil_func_separate, "Invalid glStencilFuncSeparate() usage", {
88*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
89*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_ENUM is generated if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
90*35238bceSAndroid Build Coastguard Worker glStencilFuncSeparate(-1, GL_NEVER, 0, 1);
91*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
92*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
93*35238bceSAndroid Build Coastguard Worker
94*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if func is not one of the eight accepted values.");
95*35238bceSAndroid Build Coastguard Worker glStencilFuncSeparate(GL_FRONT, -1, 0, 1);
96*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
97*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
98*35238bceSAndroid Build Coastguard Worker });
99*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(stencil_op, "Invalid glStencilOp() usage", {
100*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other "
101*35238bceSAndroid Build Coastguard Worker "than the eight defined symbolic constant values.");
102*35238bceSAndroid Build Coastguard Worker glStencilOp(-1, GL_ZERO, GL_REPLACE);
103*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
104*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, -1, GL_REPLACE);
105*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
106*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, GL_ZERO, -1);
107*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
108*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
109*35238bceSAndroid Build Coastguard Worker });
110*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(stencil_op_separate, "Invalid glStencilOpSeparate() usage", {
111*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
112*35238bceSAndroid Build Coastguard Worker "",
113*35238bceSAndroid Build Coastguard Worker "GL_INVALID_ENUM is generated if face is any value other than GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
114*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(-1, GL_KEEP, GL_ZERO, GL_REPLACE);
115*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
116*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
117*35238bceSAndroid Build Coastguard Worker
118*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other "
119*35238bceSAndroid Build Coastguard Worker "than the eight defined symbolic constant values.");
120*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(GL_FRONT, -1, GL_ZERO, GL_REPLACE);
121*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
122*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(GL_FRONT, GL_KEEP, -1, GL_REPLACE);
123*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
124*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_ZERO, -1);
125*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
126*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
127*35238bceSAndroid Build Coastguard Worker });
128*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(stencil_mask_separate, "Invalid glStencilMaskSeparate() usage", {
129*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
130*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_ENUM is generated if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
131*35238bceSAndroid Build Coastguard Worker glStencilMaskSeparate(-1, 0);
132*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
133*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
134*35238bceSAndroid Build Coastguard Worker });
135*35238bceSAndroid Build Coastguard Worker
136*35238bceSAndroid Build Coastguard Worker // Blend functions
137*35238bceSAndroid Build Coastguard Worker
138*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(blend_equation, "Invalid glBlendEquation() usage", {
139*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not one of GL_FUNC_ADD, "
140*35238bceSAndroid Build Coastguard Worker "GL_FUNC_SUBTRACT, or GL_FUNC_REVERSE_SUBTRACT.");
141*35238bceSAndroid Build Coastguard Worker glBlendEquation(-1);
142*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
143*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
144*35238bceSAndroid Build Coastguard Worker });
145*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(blend_equation_separate, "Invalid glBlendEquationSeparate() usage", {
146*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if either modeRGB or modeAlpha is not one of "
147*35238bceSAndroid Build Coastguard Worker "GL_FUNC_ADD, GL_FUNC_SUBTRACT, or GL_FUNC_REVERSE_SUBTRACT.");
148*35238bceSAndroid Build Coastguard Worker glBlendEquationSeparate(-1, GL_FUNC_ADD);
149*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
150*35238bceSAndroid Build Coastguard Worker glBlendEquationSeparate(GL_FUNC_ADD, -1);
151*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
152*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
153*35238bceSAndroid Build Coastguard Worker });
154*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(blend_func_separate, "Invalid glBlendFuncSeparate() usage", {
155*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
156*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_ENUM is generated if srcRGB, dstRGB, srcAlpha, or dstAlpha is not an accepted value.");
157*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(-1, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
158*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
159*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(GL_ZERO, -1, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
160*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
161*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(GL_ZERO, GL_ONE, -1, GL_ONE_MINUS_SRC_COLOR);
162*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
163*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_COLOR, -1);
164*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
165*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
166*35238bceSAndroid Build Coastguard Worker });
167*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(blend_func, "Invalid glBlendFunc() usage", {
168*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
169*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.");
170*35238bceSAndroid Build Coastguard Worker glBlendFunc(-1, GL_ONE);
171*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
172*35238bceSAndroid Build Coastguard Worker glBlendFunc(GL_ONE, -1);
173*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
174*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
175*35238bceSAndroid Build Coastguard Worker });
176*35238bceSAndroid Build Coastguard Worker
177*35238bceSAndroid Build Coastguard Worker // Rasterization API functions
178*35238bceSAndroid Build Coastguard Worker
179*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(cull_face, "Invalid glCullFace() usage", {
180*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
181*35238bceSAndroid Build Coastguard Worker glCullFace(-1);
182*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
183*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
184*35238bceSAndroid Build Coastguard Worker });
185*35238bceSAndroid Build Coastguard Worker
186*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(front_face, "Invalid glFrontFace() usage", {
187*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
188*35238bceSAndroid Build Coastguard Worker glFrontFace(-1);
189*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
190*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
191*35238bceSAndroid Build Coastguard Worker });
192*35238bceSAndroid Build Coastguard Worker
193*35238bceSAndroid Build Coastguard Worker ES2F_ADD_API_CASE(line_width, "Invalid glLineWidth() usage", {
194*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width is less than or equal to 0.");
195*35238bceSAndroid Build Coastguard Worker glLineWidth(0);
196*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
197*35238bceSAndroid Build Coastguard Worker glLineWidth(-1);
198*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
199*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
200*35238bceSAndroid Build Coastguard Worker });
201*35238bceSAndroid Build Coastguard Worker }
202*35238bceSAndroid Build Coastguard Worker
203*35238bceSAndroid Build Coastguard Worker } // namespace Functional
204*35238bceSAndroid Build Coastguard Worker } // namespace gles2
205*35238bceSAndroid Build Coastguard Worker } // namespace deqp
206