1*35238bceSAndroid Build Coastguard Worker /*-------------------------------------------------------------------------
2*35238bceSAndroid Build Coastguard Worker * drawElements Quality Program OpenGL ES 3.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 "es3fNegativeFragmentApiTests.hpp"
25*35238bceSAndroid Build Coastguard Worker #include "es3fApiCase.hpp"
26*35238bceSAndroid Build Coastguard Worker
27*35238bceSAndroid Build Coastguard Worker #include "gluContextInfo.hpp"
28*35238bceSAndroid Build Coastguard Worker #include "glwDefs.hpp"
29*35238bceSAndroid Build Coastguard Worker #include "glwEnums.hpp"
30*35238bceSAndroid Build Coastguard Worker
31*35238bceSAndroid Build Coastguard Worker using namespace glw; // GL types
32*35238bceSAndroid Build Coastguard Worker
33*35238bceSAndroid Build Coastguard Worker namespace deqp
34*35238bceSAndroid Build Coastguard Worker {
35*35238bceSAndroid Build Coastguard Worker namespace gles3
36*35238bceSAndroid Build Coastguard Worker {
37*35238bceSAndroid Build Coastguard Worker namespace Functional
38*35238bceSAndroid Build Coastguard Worker {
39*35238bceSAndroid Build Coastguard Worker
40*35238bceSAndroid Build Coastguard Worker using tcu::TestLog;
41*35238bceSAndroid Build Coastguard Worker
checkDrawBuffersIndexedSupport(Context & ctx)42*35238bceSAndroid Build Coastguard Worker static bool checkDrawBuffersIndexedSupport(Context &ctx)
43*35238bceSAndroid Build Coastguard Worker {
44*35238bceSAndroid Build Coastguard Worker return contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2)) ||
45*35238bceSAndroid Build Coastguard Worker contextSupports(ctx.getRenderContext().getType(), glu::ApiType::core(4, 5)) ||
46*35238bceSAndroid Build Coastguard Worker ctx.getContextInfo().isExtensionSupported("GL_EXT_draw_buffers_indexed");
47*35238bceSAndroid Build Coastguard Worker }
48*35238bceSAndroid Build Coastguard Worker
NegativeFragmentApiTests(Context & context)49*35238bceSAndroid Build Coastguard Worker NegativeFragmentApiTests::NegativeFragmentApiTests(Context &context)
50*35238bceSAndroid Build Coastguard Worker : TestCaseGroup(context, "fragment", "Negative Fragment API Cases")
51*35238bceSAndroid Build Coastguard Worker {
52*35238bceSAndroid Build Coastguard Worker }
53*35238bceSAndroid Build Coastguard Worker
~NegativeFragmentApiTests(void)54*35238bceSAndroid Build Coastguard Worker NegativeFragmentApiTests::~NegativeFragmentApiTests(void)
55*35238bceSAndroid Build Coastguard Worker {
56*35238bceSAndroid Build Coastguard Worker }
57*35238bceSAndroid Build Coastguard Worker
init(void)58*35238bceSAndroid Build Coastguard Worker void NegativeFragmentApiTests::init(void)
59*35238bceSAndroid Build Coastguard Worker {
60*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(scissor, "Invalid glScissor() usage", {
61*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if either width or height is negative.");
62*35238bceSAndroid Build Coastguard Worker glScissor(0, 0, -1, 0);
63*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
64*35238bceSAndroid Build Coastguard Worker glScissor(0, 0, 0, -1);
65*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
66*35238bceSAndroid Build Coastguard Worker glScissor(0, 0, -1, -1);
67*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
68*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
69*35238bceSAndroid Build Coastguard Worker });
70*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(depth_func, "Invalid glDepthFunc() usage", {
71*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if func is not an accepted value.");
72*35238bceSAndroid Build Coastguard Worker glDepthFunc(-1);
73*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
74*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
75*35238bceSAndroid Build Coastguard Worker });
76*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(viewport, "Invalid glViewport() usage", {
77*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if either width or height is negative.");
78*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, -1, 1);
79*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
80*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, 1, -1);
81*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
82*35238bceSAndroid Build Coastguard Worker glViewport(0, 0, -1, -1);
83*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
84*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
85*35238bceSAndroid Build Coastguard Worker });
86*35238bceSAndroid Build Coastguard Worker
87*35238bceSAndroid Build Coastguard Worker // Stencil functions
88*35238bceSAndroid Build Coastguard Worker
89*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(stencil_func, "Invalid glStencilFunc() usage", {
90*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if func is not one of the eight accepted values.");
91*35238bceSAndroid Build Coastguard Worker glStencilFunc(-1, 0, 1);
92*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
93*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
94*35238bceSAndroid Build Coastguard Worker });
95*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(stencil_func_separate, "Invalid glStencilFuncSeparate() usage", {
96*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
97*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_ENUM is generated if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
98*35238bceSAndroid Build Coastguard Worker glStencilFuncSeparate(-1, GL_NEVER, 0, 1);
99*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
100*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
101*35238bceSAndroid Build Coastguard Worker
102*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if func is not one of the eight accepted values.");
103*35238bceSAndroid Build Coastguard Worker glStencilFuncSeparate(GL_FRONT, -1, 0, 1);
104*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
105*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
106*35238bceSAndroid Build Coastguard Worker });
107*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(stencil_op, "Invalid glStencilOp() usage", {
108*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other "
109*35238bceSAndroid Build Coastguard Worker "than the defined symbolic constant values.");
110*35238bceSAndroid Build Coastguard Worker glStencilOp(-1, GL_ZERO, GL_REPLACE);
111*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
112*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, -1, GL_REPLACE);
113*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
114*35238bceSAndroid Build Coastguard Worker glStencilOp(GL_KEEP, GL_ZERO, -1);
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 ES3F_ADD_API_CASE(stencil_op_separate, "Invalid glStencilOpSeparate() usage", {
119*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
120*35238bceSAndroid Build Coastguard Worker "",
121*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.");
122*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(-1, GL_KEEP, GL_ZERO, GL_REPLACE);
123*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
124*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
125*35238bceSAndroid Build Coastguard Worker
126*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if sfail, dpfail, or dppass is any value other "
127*35238bceSAndroid Build Coastguard Worker "than the eight defined symbolic constant values.");
128*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(GL_FRONT, -1, GL_ZERO, GL_REPLACE);
129*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
130*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(GL_FRONT, GL_KEEP, -1, GL_REPLACE);
131*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
132*35238bceSAndroid Build Coastguard Worker glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_ZERO, -1);
133*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
134*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
135*35238bceSAndroid Build Coastguard Worker });
136*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(stencil_mask_separate, "Invalid glStencilMaskSeparate() usage", {
137*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
138*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_ENUM is generated if face is not GL_FRONT, GL_BACK, or GL_FRONT_AND_BACK.");
139*35238bceSAndroid Build Coastguard Worker glStencilMaskSeparate(-1, 0);
140*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
141*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
142*35238bceSAndroid Build Coastguard Worker });
143*35238bceSAndroid Build Coastguard Worker
144*35238bceSAndroid Build Coastguard Worker // Blend functions
145*35238bceSAndroid Build Coastguard Worker
146*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(blend_equation, "Invalid glBlendEquation() usage", {
147*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
148*35238bceSAndroid Build Coastguard Worker "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
149*35238bceSAndroid Build Coastguard Worker glBlendEquation(-1);
150*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
151*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
152*35238bceSAndroid Build Coastguard Worker });
153*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(blend_equation_separate, "Invalid glBlendEquationSeparate() usage", {
154*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if modeRGB is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
155*35238bceSAndroid Build Coastguard Worker "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
156*35238bceSAndroid Build Coastguard Worker glBlendEquationSeparate(-1, GL_FUNC_ADD);
157*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
158*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
159*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if modeAlpha is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
160*35238bceSAndroid Build Coastguard Worker "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
161*35238bceSAndroid Build Coastguard Worker glBlendEquationSeparate(GL_FUNC_ADD, -1);
162*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
163*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
164*35238bceSAndroid Build Coastguard Worker });
165*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(blend_func, "Invalid glBlendFunc() usage", {
166*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
167*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.");
168*35238bceSAndroid Build Coastguard Worker glBlendFunc(-1, GL_ONE);
169*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
170*35238bceSAndroid Build Coastguard Worker glBlendFunc(GL_ONE, -1);
171*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
172*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
173*35238bceSAndroid Build Coastguard Worker });
174*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(blend_func_separate, "Invalid glBlendFuncSeparate() usage", {
175*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
176*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_ENUM is generated if srcRGB, dstRGB, srcAlpha, or dstAlpha is not an accepted value.");
177*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(-1, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
178*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
179*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(GL_ZERO, -1, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
180*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
181*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(GL_ZERO, GL_ONE, -1, GL_ONE_MINUS_SRC_COLOR);
182*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
183*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_SRC_COLOR, -1);
184*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
185*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
186*35238bceSAndroid Build Coastguard Worker });
187*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(blend_equationi, "Invalid glBlendEquationi() usage", {
188*35238bceSAndroid Build Coastguard Worker glw::GLint maxDrawBuffers = -1;
189*35238bceSAndroid Build Coastguard Worker glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
190*35238bceSAndroid Build Coastguard Worker if (!checkDrawBuffersIndexedSupport(m_context))
191*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
192*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
193*35238bceSAndroid Build Coastguard Worker "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
194*35238bceSAndroid Build Coastguard Worker glBlendEquationi(0, -1);
195*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
196*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
197*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if buf is not in the range zero to the value of "
198*35238bceSAndroid Build Coastguard Worker "MAX_DRAW_BUFFERS minus one.");
199*35238bceSAndroid Build Coastguard Worker glBlendEquationi(-1, GL_FUNC_ADD);
200*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
201*35238bceSAndroid Build Coastguard Worker glBlendEquationi(maxDrawBuffers, GL_FUNC_ADD);
202*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
203*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
204*35238bceSAndroid Build Coastguard Worker });
205*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(blend_equation_separatei, "Invalid glBlendEquationSeparatei() usage", {
206*35238bceSAndroid Build Coastguard Worker glw::GLint maxDrawBuffers = -1;
207*35238bceSAndroid Build Coastguard Worker glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
208*35238bceSAndroid Build Coastguard Worker if (!checkDrawBuffersIndexedSupport(m_context))
209*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
210*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if modeRGB is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
211*35238bceSAndroid Build Coastguard Worker "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
212*35238bceSAndroid Build Coastguard Worker glBlendEquationSeparatei(0, -1, GL_FUNC_ADD);
213*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
214*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
215*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if modeAlpha is not GL_FUNC_ADD, GL_FUNC_SUBTRACT, "
216*35238bceSAndroid Build Coastguard Worker "GL_FUNC_REVERSE_SUBTRACT, GL_MAX or GL_MIN.");
217*35238bceSAndroid Build Coastguard Worker glBlendEquationSeparatei(0, GL_FUNC_ADD, -1);
218*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
219*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
220*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if buf is not in the range zero to the value of "
221*35238bceSAndroid Build Coastguard Worker "MAX_DRAW_BUFFERS minus one.");
222*35238bceSAndroid Build Coastguard Worker glBlendEquationSeparatei(-1, GL_FUNC_ADD, GL_FUNC_ADD);
223*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
224*35238bceSAndroid Build Coastguard Worker glBlendEquationSeparatei(maxDrawBuffers, GL_FUNC_ADD, GL_FUNC_ADD);
225*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
226*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
227*35238bceSAndroid Build Coastguard Worker });
228*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(blend_funci, "Invalid glBlendFunci() usage", {
229*35238bceSAndroid Build Coastguard Worker glw::GLint maxDrawBuffers = -1;
230*35238bceSAndroid Build Coastguard Worker glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
231*35238bceSAndroid Build Coastguard Worker if (!checkDrawBuffersIndexedSupport(m_context))
232*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
233*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
234*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_ENUM is generated if either sfactor or dfactor is not an accepted value.");
235*35238bceSAndroid Build Coastguard Worker glBlendFunci(0, -1, GL_ONE);
236*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
237*35238bceSAndroid Build Coastguard Worker glBlendFunci(0, GL_ONE, -1);
238*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
239*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
240*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if buf is not in the range zero to the value of "
241*35238bceSAndroid Build Coastguard Worker "MAX_DRAW_BUFFERS minus one.");
242*35238bceSAndroid Build Coastguard Worker glBlendFunci(-1, GL_ONE, GL_ONE);
243*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
244*35238bceSAndroid Build Coastguard Worker glBlendFunci(maxDrawBuffers, GL_ONE, GL_ONE);
245*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
246*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
247*35238bceSAndroid Build Coastguard Worker });
248*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(blend_func_separatei, "Invalid glBlendFuncSeparatei() usage", {
249*35238bceSAndroid Build Coastguard Worker glw::GLint maxDrawBuffers = -1;
250*35238bceSAndroid Build Coastguard Worker glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxDrawBuffers);
251*35238bceSAndroid Build Coastguard Worker if (!checkDrawBuffersIndexedSupport(m_context))
252*35238bceSAndroid Build Coastguard Worker throw tcu::NotSupportedError("GL_EXT_draw_buffers_indexed is not supported", DE_NULL, __FILE__, __LINE__);
253*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
254*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_ENUM is generated if srcRGB, dstRGB, srcAlpha, or dstAlpha is not an accepted value.");
255*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparatei(0, -1, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
256*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
257*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparatei(0, GL_ZERO, -1, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
258*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
259*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparatei(0, GL_ZERO, GL_ONE, -1, GL_ONE_MINUS_SRC_COLOR);
260*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
261*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparatei(0, GL_ZERO, GL_ONE, GL_SRC_COLOR, -1);
262*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
263*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
264*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if buf is not in the range zero to the value of "
265*35238bceSAndroid Build Coastguard Worker "MAX_DRAW_BUFFERS minus one.");
266*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparatei(-1, GL_ONE, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
267*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
268*35238bceSAndroid Build Coastguard Worker glBlendFuncSeparatei(maxDrawBuffers, GL_ONE, GL_ONE, GL_SRC_COLOR, GL_ONE_MINUS_SRC_COLOR);
269*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
270*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
271*35238bceSAndroid Build Coastguard Worker });
272*35238bceSAndroid Build Coastguard Worker
273*35238bceSAndroid Build Coastguard Worker // Rasterization API functions
274*35238bceSAndroid Build Coastguard Worker
275*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(cull_face, "Invalid glCullFace() usage", {
276*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
277*35238bceSAndroid Build Coastguard Worker glCullFace(-1);
278*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
279*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
280*35238bceSAndroid Build Coastguard Worker });
281*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(front_face, "Invalid glFrontFace() usage", {
282*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if mode is not an accepted value.");
283*35238bceSAndroid Build Coastguard Worker glFrontFace(-1);
284*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
285*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
286*35238bceSAndroid Build Coastguard Worker });
287*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(line_width, "Invalid glLineWidth() usage", {
288*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if width is less than or equal to 0.");
289*35238bceSAndroid Build Coastguard Worker glLineWidth(0);
290*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
291*35238bceSAndroid Build Coastguard Worker glLineWidth(-1);
292*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
293*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
294*35238bceSAndroid Build Coastguard Worker });
295*35238bceSAndroid Build Coastguard Worker
296*35238bceSAndroid Build Coastguard Worker // Asynchronous queries
297*35238bceSAndroid Build Coastguard Worker
298*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(gen_queries, "Invalid glGenQueries() usage", {
299*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
300*35238bceSAndroid Build Coastguard Worker GLuint ids;
301*35238bceSAndroid Build Coastguard Worker glGenQueries(-1, &ids);
302*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
303*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
304*35238bceSAndroid Build Coastguard Worker });
305*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(begin_query, "Invalid glBeginQuery() usage", {
306*35238bceSAndroid Build Coastguard Worker GLuint ids[3];
307*35238bceSAndroid Build Coastguard Worker glGenQueries(3, ids);
308*35238bceSAndroid Build Coastguard Worker
309*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
310*35238bceSAndroid Build Coastguard Worker glBeginQuery(-1, ids[0]);
311*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
312*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
313*35238bceSAndroid Build Coastguard Worker
314*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if glBeginQuery is executed while a query "
315*35238bceSAndroid Build Coastguard Worker "object of the same target is already active.");
316*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_ANY_SAMPLES_PASSED, ids[0]);
317*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
318*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_ANY_SAMPLES_PASSED, ids[1]);
319*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_OPERATION);
320*35238bceSAndroid Build Coastguard Worker // \note GL_ANY_SAMPLES_PASSED and GL_ANY_SAMPLES_PASSED_CONSERVATIVE alias to the same target for the purposes of this error.
321*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_ANY_SAMPLES_PASSED_CONSERVATIVE, ids[1]);
322*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_OPERATION);
323*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[1]);
324*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
325*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[2]);
326*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_OPERATION);
327*35238bceSAndroid Build Coastguard Worker glEndQuery(GL_ANY_SAMPLES_PASSED);
328*35238bceSAndroid Build Coastguard Worker glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
329*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
330*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
331*35238bceSAndroid Build Coastguard Worker
332*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if id is 0.");
333*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_ANY_SAMPLES_PASSED, 0);
334*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_OPERATION);
335*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
336*35238bceSAndroid Build Coastguard Worker
337*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("",
338*35238bceSAndroid Build Coastguard Worker "GL_INVALID_OPERATION is generated if id not a name returned from a previous call to "
339*35238bceSAndroid Build Coastguard Worker "glGenQueries, or if such a name has since been deleted with glDeleteQueries.");
340*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_ANY_SAMPLES_PASSED, -1);
341*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_OPERATION);
342*35238bceSAndroid Build Coastguard Worker glDeleteQueries(1, &ids[2]);
343*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
344*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_ANY_SAMPLES_PASSED, ids[2]);
345*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_OPERATION);
346*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
347*35238bceSAndroid Build Coastguard Worker
348*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
349*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_OPERATION is generated if id is the name of an already active query object.");
350*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_ANY_SAMPLES_PASSED, ids[0]);
351*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
352*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[0]);
353*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_OPERATION);
354*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
355*35238bceSAndroid Build Coastguard Worker
356*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if id refers to an existing query object "
357*35238bceSAndroid Build Coastguard Worker "whose type does not does not match target.");
358*35238bceSAndroid Build Coastguard Worker glEndQuery(GL_ANY_SAMPLES_PASSED);
359*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
360*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, ids[0]);
361*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_OPERATION);
362*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
363*35238bceSAndroid Build Coastguard Worker
364*35238bceSAndroid Build Coastguard Worker glDeleteQueries(2, &ids[0]);
365*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
366*35238bceSAndroid Build Coastguard Worker });
367*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(end_query, "Invalid glEndQuery() usage", {
368*35238bceSAndroid Build Coastguard Worker GLuint id;
369*35238bceSAndroid Build Coastguard Worker glGenQueries(1, &id);
370*35238bceSAndroid Build Coastguard Worker
371*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_ENUM is generated if target is not one of the accepted tokens.");
372*35238bceSAndroid Build Coastguard Worker glEndQuery(-1);
373*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
374*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
375*35238bceSAndroid Build Coastguard Worker
376*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_OPERATION is generated if glEndQuery is executed when a query object "
377*35238bceSAndroid Build Coastguard Worker "of the same target is not active.");
378*35238bceSAndroid Build Coastguard Worker glEndQuery(GL_ANY_SAMPLES_PASSED);
379*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_OPERATION);
380*35238bceSAndroid Build Coastguard Worker glBeginQuery(GL_ANY_SAMPLES_PASSED, id);
381*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
382*35238bceSAndroid Build Coastguard Worker glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
383*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_OPERATION);
384*35238bceSAndroid Build Coastguard Worker glEndQuery(GL_ANY_SAMPLES_PASSED);
385*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
386*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
387*35238bceSAndroid Build Coastguard Worker
388*35238bceSAndroid Build Coastguard Worker glDeleteQueries(1, &id);
389*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
390*35238bceSAndroid Build Coastguard Worker });
391*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(delete_queries, "Invalid glDeleteQueries() usage", {
392*35238bceSAndroid Build Coastguard Worker GLuint id;
393*35238bceSAndroid Build Coastguard Worker glGenQueries(1, &id);
394*35238bceSAndroid Build Coastguard Worker
395*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if n is negative.");
396*35238bceSAndroid Build Coastguard Worker glDeleteQueries(-1, &id);
397*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
398*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
399*35238bceSAndroid Build Coastguard Worker
400*35238bceSAndroid Build Coastguard Worker glDeleteQueries(1, &id);
401*35238bceSAndroid Build Coastguard Worker });
402*35238bceSAndroid Build Coastguard Worker
403*35238bceSAndroid Build Coastguard Worker // Sync objects
404*35238bceSAndroid Build Coastguard Worker
405*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(fence_sync, "Invalid glFenceSync() usage", {
406*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("",
407*35238bceSAndroid Build Coastguard Worker "GL_INVALID_ENUM is generated if condition is not GL_SYNC_GPU_COMMANDS_COMPLETE.");
408*35238bceSAndroid Build Coastguard Worker glFenceSync(-1, 0);
409*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_ENUM);
410*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
411*35238bceSAndroid Build Coastguard Worker
412*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if flags is not zero.");
413*35238bceSAndroid Build Coastguard Worker glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0x0010);
414*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
415*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
416*35238bceSAndroid Build Coastguard Worker });
417*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(wait_sync, "Invalid glWaitSync() usage", {
418*35238bceSAndroid Build Coastguard Worker GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
419*35238bceSAndroid Build Coastguard Worker
420*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if sync is not the name of a sync object.");
421*35238bceSAndroid Build Coastguard Worker glWaitSync(0, 0, GL_TIMEOUT_IGNORED);
422*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
423*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
424*35238bceSAndroid Build Coastguard Worker
425*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if flags is not zero.");
426*35238bceSAndroid Build Coastguard Worker glWaitSync(sync, 0x0010, GL_TIMEOUT_IGNORED);
427*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
428*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
429*35238bceSAndroid Build Coastguard Worker
430*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if timeout is not GL_TIMEOUT_IGNORED.");
431*35238bceSAndroid Build Coastguard Worker glWaitSync(sync, 0, 0);
432*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
433*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
434*35238bceSAndroid Build Coastguard Worker
435*35238bceSAndroid Build Coastguard Worker glDeleteSync(sync);
436*35238bceSAndroid Build Coastguard Worker });
437*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(client_wait_sync, "Invalid glClientWaitSync() usage", {
438*35238bceSAndroid Build Coastguard Worker GLsync sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
439*35238bceSAndroid Build Coastguard Worker
440*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("",
441*35238bceSAndroid Build Coastguard Worker "GL_INVALID_VALUE is generated if sync is not the name of an existing sync object.");
442*35238bceSAndroid Build Coastguard Worker glClientWaitSync(0, 0, 10000);
443*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
444*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
445*35238bceSAndroid Build Coastguard Worker
446*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section("", "GL_INVALID_VALUE is generated if flags contains any unsupported flag.");
447*35238bceSAndroid Build Coastguard Worker glClientWaitSync(sync, 0x00000004, 10000);
448*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
449*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
450*35238bceSAndroid Build Coastguard Worker
451*35238bceSAndroid Build Coastguard Worker glDeleteSync(sync);
452*35238bceSAndroid Build Coastguard Worker });
453*35238bceSAndroid Build Coastguard Worker ES3F_ADD_API_CASE(delete_sync, "Invalid glDeleteSync() usage", {
454*35238bceSAndroid Build Coastguard Worker m_log << TestLog::Section(
455*35238bceSAndroid Build Coastguard Worker "", "GL_INVALID_VALUE is generated if sync is neither zero or the name of a sync object.");
456*35238bceSAndroid Build Coastguard Worker glDeleteSync((GLsync)1);
457*35238bceSAndroid Build Coastguard Worker expectError(GL_INVALID_VALUE);
458*35238bceSAndroid Build Coastguard Worker glDeleteSync(0);
459*35238bceSAndroid Build Coastguard Worker expectError(GL_NO_ERROR);
460*35238bceSAndroid Build Coastguard Worker m_log << TestLog::EndSection;
461*35238bceSAndroid Build Coastguard Worker });
462*35238bceSAndroid Build Coastguard Worker }
463*35238bceSAndroid Build Coastguard Worker
464*35238bceSAndroid Build Coastguard Worker } // namespace Functional
465*35238bceSAndroid Build Coastguard Worker } // namespace gles3
466*35238bceSAndroid Build Coastguard Worker } // namespace deqp
467