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