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