13c827367444ee418f129b2c238299f49d3264554Jarkko Poyry/*------------------------------------------------------------------------- 23c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * drawElements Quality Program OpenGL ES 3.0 Module 33c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * ------------------------------------------------- 43c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 53c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Copyright 2014 The Android Open Source Project 63c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 73c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Licensed under the Apache License, Version 2.0 (the "License"); 83c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * you may not use this file except in compliance with the License. 93c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * You may obtain a copy of the License at 103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * http://www.apache.org/licenses/LICENSE-2.0 123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * Unless required by applicable law or agreed to in writing, software 143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * distributed under the License is distributed on an "AS IS" BASIS, 153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * See the License for the specific language governing permissions and 173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * limitations under the License. 183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * 193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*! 203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \file 213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry * \brief Negative GL State API tests. 223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry *//*--------------------------------------------------------------------*/ 233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "es31fNegativeStateApiTests.hpp" 253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluCallLogWrapper.hpp" 273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "gluShaderProgram.hpp" 283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwDefs.hpp" 303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "glwEnums.hpp" 313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry#include "deMemory.h" 333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 343c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace deqp 353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 363c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace gles31 373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 383c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace Functional 393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 403c827367444ee418f129b2c238299f49d3264554Jarkko Poyrynamespace NegativeTestShared 413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 433c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing tcu::TestLog; 443c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing glu::CallLogWrapper; 453c827367444ee418f129b2c238299f49d3264554Jarkko Poyryusing namespace glw; 463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 473c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const char* uniformTestVertSource = "#version 300 es\n" 483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "uniform mediump vec4 vUnif_vec4;\n" 493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "in mediump vec4 attr;" 503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "layout(shared) uniform Block { mediump vec4 blockVar; };\n" 513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "void main (void)\n" 523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "{\n" 533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry " gl_Position = vUnif_vec4 + blockVar + attr;\n" 543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "}\n\0"; 553c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystatic const char* uniformTestFragSource = "#version 300 es\n" 563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "uniform mediump ivec4 fUnif_ivec4;\n" 573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "uniform mediump uvec4 fUnif_uvec4;\n" 583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "layout(location = 0) out mediump vec4 fragColor;" 593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "void main (void)\n" 603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "{\n" 613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry " fragColor = vec4(vec4(fUnif_ivec4) + vec4(fUnif_uvec4));\n" 623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry "}\n\0"; 633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Enabling & disabling states 653c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid enable (NegativeTestContext& ctx) 663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values."); 683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glEnable(-1); 693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid disable (NegativeTestContext& ctx) 743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if cap is not one of the allowed values."); 763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDisable(-1); 773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Simple state queries 823c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_booleanv (NegativeTestContext& ctx) 833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values."); 853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLboolean params = GL_FALSE; 863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBooleanv(-1, ¶ms); 873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_floatv (NegativeTestContext& ctx) 923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values."); 943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLfloat params = 0.0f; 953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFloatv(-1, ¶ms); 963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1003c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_integerv (NegativeTestContext& ctx) 1013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values."); 1033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params = -1; 1043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegerv(-1, ¶ms); 1053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1093c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_integer64v (NegativeTestContext& ctx) 1103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the allowed values."); 1123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint64 params = -1; 1133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetInteger64v(-1, ¶ms); 1143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1183c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_integeri_v (NegativeTestContext& ctx) 1193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint data = -1; 1213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint maxUniformBufferBindings; 1223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value."); 1243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegeri_v(-1, 0, &data); 1253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target."); 1293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings); 1303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_NO_ERROR); 1313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegeri_v(GL_UNIFORM_BUFFER_BINDING, maxUniformBufferBindings, &data); 1323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1363c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_integer64i_v (NegativeTestContext& ctx) 1373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint64 data = (GLint64)-1;; 1393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint maxUniformBufferBindings; 1403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value."); 1423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetInteger64i_v(-1, 0, &data); 1433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if index is outside of the valid range for the indexed state target."); 1473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegerv(GL_MAX_UNIFORM_BUFFER_BINDINGS, &maxUniformBufferBindings); 1483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_NO_ERROR); 1493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetInteger64i_v(GL_UNIFORM_BUFFER_START, maxUniformBufferBindings, &data); 1503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1543c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_string (NegativeTestContext& ctx) 1553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value."); 1573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetString(-1); 1583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1623c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_stringi (NegativeTestContext& ctx) 1633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint numExtensions; 1653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if name is not an accepted value."); 1673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetStringi(-1, 0); 1683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 1693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if index is outside the valid range for indexed state name."); 1723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions); 1733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetStringi(GL_EXTENSIONS, numExtensions); 1743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 1773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Enumerated state queries: Shaders 1793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1803c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_attached_shaders (NegativeTestContext& ctx) 1813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 1823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shaders[1]; 1833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shaderObject = ctx.glCreateShader(GL_VERTEX_SHADER); 1843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint program = ctx.glCreateProgram(); 1853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLsizei count[1]; 1863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); 1883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetAttachedShaders(-1, 1, &count[0], &shaders[0]); 1893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 1903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object."); 1933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetAttachedShaders(shaderObject, 1, &count[0], &shaders[0]); 1943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 1953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 1963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 1973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if maxCount is less than 0."); 1983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetAttachedShaders(program, -1, &count[0], &shaders[0]); 1993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shaderObject); 2033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteProgram(program); 2043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2063c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_shaderiv (NegativeTestContext& ctx) 2073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLboolean shaderCompilerSupported; 2093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBooleanv(GL_SHADER_COMPILER, &shaderCompilerSupported); 2103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_SHADER_COMPILER = " << (shaderCompilerSupported ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; 2113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 2133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint program = ctx.glCreateProgram(); 2143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint param[1] = { -1 }; 2153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); 2173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderiv(shader, -1, ¶m[0]); 2183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 2193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL."); 2223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderiv(-1, GL_SHADER_TYPE, ¶m[0]); 2233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if shader does not refer to a shader object."); 2273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderiv(program, GL_SHADER_TYPE, ¶m[0]); 2283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 2293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 2323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteProgram(program); 2333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_shader_info_log (NegativeTestContext& ctx) 2363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 2383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint program = ctx.glCreateProgram(); 2393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLsizei length[1] = { -1 }; 2403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry char infoLog[128] = { 0 }; 2413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL."); 2433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderInfoLog(-1, 128, &length[0], &infoLog[0]); 2443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object."); 2483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderInfoLog(program, 128, &length[0], &infoLog[0]); 2493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 2503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if maxLength is less than 0."); 2533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderInfoLog(shader, -1, &length[0], &infoLog[0]); 2543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 2583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteProgram(program); 2593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2613c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_shader_precision_format (NegativeTestContext& ctx) 2623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLboolean shaderCompilerSupported; 2643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBooleanv(GL_SHADER_COMPILER, &shaderCompilerSupported); 2653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_SHADER_COMPILER = " << (shaderCompilerSupported ? "GL_TRUE" : "GL_FALSE") << TestLog::EndMessage; 2663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint range[2]; 2683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint precision[1]; 2693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemset(&range[0], 0xcd, sizeof(range)); 2713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemset(&precision[0], 0xcd, sizeof(precision)); 2723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if shaderType or precisionType is not an accepted value."); 2743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderPrecisionFormat (-1, GL_MEDIUM_FLOAT, &range[0], &precision[0]); 2753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 2763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderPrecisionFormat (GL_VERTEX_SHADER, -1, &range[0], &precision[0]); 2773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 2783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderPrecisionFormat (-1, -1, &range[0], &precision[0]); 2793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 2803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 2823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_shader_source (NegativeTestContext& ctx) 2843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 2853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLsizei length[1]; 2863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry char source[1]; 2873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint program = ctx.glCreateProgram(); 2883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 2893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL."); 2913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderSource(-1, 1, &length[0], &source[0]); 2923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 2933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 2953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if shader is not a shader object."); 2963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderSource(program, 1, &length[0], &source[0]); 2973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 2983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 2993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0."); 3013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetShaderSource(shader, -1, &length[0], &source[0]); 3023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteProgram(program); 3063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 3073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Enumerated state queries: Programs 3103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3113c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_programiv (NegativeTestContext& ctx) 3123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint program = ctx.glCreateProgram(); 3143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 3153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params[1] = { -1 }; 3163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); 3183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramiv(program, -1, ¶ms[0]); 3193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 3203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); 3233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramiv(-1, GL_LINK_STATUS, ¶ms[0]); 3243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program does not refer to a program object."); 3283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramiv(shader, GL_LINK_STATUS, ¶ms[0]); 3293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 3303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteProgram(program); 3333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 3343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3363c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_program_info_log (NegativeTestContext& ctx) 3373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint program = ctx.glCreateProgram(); 3393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 3403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLsizei length[1]; 3413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry char infoLog[1]; 3423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); 3443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramInfoLog (-1, 1, &length[0], &infoLog[0]); 3453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object."); 3493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramInfoLog (shader, 1, &length[0], &infoLog[0]); 3503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 3513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if maxLength is less than 0."); 3543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramInfoLog (program, -1, &length[0], &infoLog[0]); 3553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 3563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteProgram(program); 3593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 3603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Enumerated state queries: Shader variables 3633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3643c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_tex_parameterfv (NegativeTestContext& ctx) 3653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLfloat params[1]; 3673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value."); 3693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetTexParameterfv (-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]); 3703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 3713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetTexParameterfv (GL_TEXTURE_2D, -1, ¶ms[0]); 3723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 3733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetTexParameterfv (-1, -1, ¶ms[0]); 3743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 3753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3783c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_tex_parameteriv (NegativeTestContext& ctx) 3793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params[1]; 3813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value."); 3833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetTexParameteriv (-1, GL_TEXTURE_MAG_FILTER, ¶ms[0]); 3843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 3853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetTexParameteriv (GL_TEXTURE_2D, -1, ¶ms[0]); 3863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 3873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetTexParameteriv (-1, -1, ¶ms[0]); 3883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 3893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 3903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 3913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3923c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_uniformfv (NegativeTestContext& ctx) 3933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 3943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource)); 3953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(program.getProgram()); 3963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 3973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint unif = ctx.glGetUniformLocation(program.getProgram(), "vUnif_vec4"); // vec4 3983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (unif == -1) 3993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.fail("Failed to retrieve uniform location"); 4003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 4023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint programEmpty = ctx.glCreateProgram(); 4033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLfloat params[4]; 4043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); 4063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformfv (-1, unif, ¶ms[0]); 4073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object."); 4113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformfv (shader, unif, ¶ms[0]); 4123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 4133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked."); 4163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformfv (programEmpty, unif, ¶ms[0]); 4173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 4183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object."); 4213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformfv (program.getProgram(), -1, ¶ms[0]); 4223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 4233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 4263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteProgram(programEmpty); 4273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4293c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_uniformiv (NegativeTestContext& ctx) 4303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource)); 4323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(program.getProgram()); 4333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_ivec4"); // ivec4 4353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (unif == -1) 4363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.fail("Failed to retrieve uniform location"); 4373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 4393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint programEmpty = ctx.glCreateProgram(); 4403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params[4]; 4413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); 4433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformiv (-1, unif, ¶ms[0]); 4443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object."); 4483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformiv (shader, unif, ¶ms[0]); 4493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 4503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked."); 4533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformiv (programEmpty, unif, ¶ms[0]); 4543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 4553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object."); 4583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformiv (program.getProgram(), -1, ¶ms[0]); 4593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 4603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 4633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteProgram(programEmpty); 4643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 4653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4663c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_uniformuiv (NegativeTestContext& ctx) 4673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 4683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource)); 4693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(program.getProgram()); 4703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint unif = ctx.glGetUniformLocation(program.getProgram(), "fUnif_uvec4"); // uvec4 4723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry if (unif == -1) 4733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.fail("Failed to retrieve uniform location"); 4743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 4763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint programEmpty = ctx.glCreateProgram(); 4773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint params[4]; 4783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); 4803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformuiv (-1, unif, ¶ms[0]); 4813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 4823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object."); 4853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformuiv (shader, unif, ¶ms[0]); 4863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 4873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked."); 4903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformuiv (programEmpty, unif, ¶ms[0]); 4913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 4923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if location does not correspond to a valid uniform variable location for the specified program object."); 4953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformuiv (program.getProgram(), -1, ¶ms[0]); 4963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 4973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 4983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 4993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 5003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteProgram(programEmpty); 5013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5033c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_active_uniform (NegativeTestContext& ctx) 5043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 5063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource)); 5073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint numActiveUniforms = -1; 5083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms); 5103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = " << numActiveUniforms << " (expected 4)." << TestLog::EndMessage; 5113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); 5133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniform(-1, 0, 0, 0, 0, 0, 0); 5143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object."); 5183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniform(shader, 0, 0, 0, 0, 0, 0); 5193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 5203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to the number of active uniform variables in program."); 5233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(program.getProgram()); 5243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniform(program.getProgram(), numActiveUniforms, 0, 0, 0, 0, 0); 5253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0."); 5293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniform(program.getProgram(), 0, -1, 0, 0, 0, 0); 5303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(0); 5343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 5353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5373c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_active_uniformsiv (NegativeTestContext& ctx) 5383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 5403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource)); 5413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint dummyUniformIndex = 1; 5423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint dummyParamDst = -1; 5433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint numActiveUniforms = -1; 5443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(program.getProgram()); 5463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORMS, &numActiveUniforms); 5483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORMS = " << numActiveUniforms << " (expected 4)." << TestLog::EndMessage; 5493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); 5513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniformsiv(-1, 1, &dummyUniformIndex, GL_UNIFORM_TYPE, &dummyParamDst); 5523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object."); 5563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniformsiv(shader, 1, &dummyUniformIndex, GL_UNIFORM_TYPE, &dummyParamDst); 5573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 5583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if any value in uniformIndices is greater than or equal to the value of GL_ACTIVE_UNIFORMS for program."); 5613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry for (int excess = 0; excess <= 2; excess++) 5623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 5633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<GLuint> invalidUniformIndices; 5643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry invalidUniformIndices.push_back(1); 5653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry invalidUniformIndices.push_back(numActiveUniforms-1+excess); 5663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry invalidUniformIndices.push_back(1); 5673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry std::vector<GLint> dummyParamsDst(invalidUniformIndices.size()); 5693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniformsiv(program.getProgram(), (GLsizei)invalidUniformIndices.size(), &invalidUniformIndices[0], GL_UNIFORM_TYPE, &dummyParamsDst[0]); 5703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(excess == 0 ? GL_NO_ERROR : GL_INVALID_VALUE); 5713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry } 5723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted token."); 5753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniformsiv(program.getProgram(), 1, &dummyUniformIndex, -1, &dummyParamDst); 5763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 5773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(0); 5803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 5813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 5823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5833c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_active_uniform_blockiv (NegativeTestContext& ctx) 5843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 5853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource)); 5863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params = -1; 5873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint numActiveBlocks = -1; 5883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks); 5903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << " (expected 1)." << TestLog::EndMessage; 5913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 5923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 5933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockIndex is greater than or equal to the value of GL_ACTIVE_UNIFORM_BLOCKS or is not the index of an active uniform block in program."); 5943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(program.getProgram()); 5953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_NO_ERROR); 5963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniformBlockiv(program.getProgram(), numActiveBlocks, GL_UNIFORM_BLOCK_BINDING, ¶ms); 5973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 5983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 5993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens."); 6013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniformBlockiv(program.getProgram(), 0, -1, ¶ms); 6023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 6033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(0); 6063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6083c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_active_uniform_block_name (NegativeTestContext& ctx) 6093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource)); 6113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLsizei length = -1; 6123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint numActiveBlocks = -1; 6133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLchar uniformBlockName[128]; 6143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemset(&uniformBlockName[0], 0, sizeof(uniformBlockName)); 6163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks); 6183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << " (expected 1)." << TestLog::EndMessage; 6193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 6203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if uniformBlockIndex is greater than or equal to the value of GL_ACTIVE_UNIFORM_BLOCKS or is not the index of an active uniform block in program."); 6223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(program.getProgram()); 6233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_NO_ERROR); 6243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveUniformBlockName(program.getProgram(), numActiveBlocks, (int)sizeof(uniformBlockName), &length, &uniformBlockName[0]); 6253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(0); 6293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_active_attrib (NegativeTestContext& ctx) 6323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 6343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource)); 6353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint numActiveAttributes = -1; 6363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLsizei length = -1; 6383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint size = -1; 6393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLenum type = -1; 6403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLchar name[32]; 6413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemset(&name[0], 0, sizeof(name)); 6433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_ATTRIBUTES, &numActiveAttributes); 6453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_ACTIVE_ATTRIBUTES = " << numActiveAttributes << " (expected 1)." << TestLog::EndMessage; 6463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(program.getProgram()); 6483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL."); 6503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveAttrib(-1, 0, 32, &length, &size, &type, &name[0]); 6513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object."); 6553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveAttrib(shader, 0, 32, &length, &size, &type, &name[0]); 6563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 6573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_ACTIVE_ATTRIBUTES."); 6603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveAttrib(program.getProgram(), numActiveAttributes, (int)sizeof(name), &length, &size, &type, &name[0]); 6613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is less than 0."); 6653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetActiveAttrib(program.getProgram(), 0, -1, &length, &size, &type, &name[0]); 6663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(0); 6703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 6713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6733c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_uniform_indices (NegativeTestContext& ctx) 6743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 6753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 6763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(uniformTestVertSource, uniformTestFragSource)); 6773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint numActiveBlocks = -1; 6783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry const GLchar* uniformName = "Block.blockVar"; 6793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint uniformIndices = -1; 6803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetProgramiv (program.getProgram(), GL_ACTIVE_UNIFORM_BLOCKS, &numActiveBlocks); 6823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// GL_ACTIVE_UNIFORM_BLOCKS = " << numActiveBlocks << TestLog::EndMessage; 6833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 6843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program is a name of shader object."); 6863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformIndices(shader, 1, &uniformName, &uniformIndices); 6873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 6883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if program is not name of program or shader object."); 6913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint invalid = -1; 6923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetUniformIndices(invalid, 1, &uniformName, &uniformIndices); 6933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 6943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 6953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 6963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glUseProgram(0); 6973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 6983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 6993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7003c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_vertex_attribfv (NegativeTestContext& ctx) 7013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLfloat params = 0.0f; 7033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); 7053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetVertexAttribfv(0, -1, ¶ms); 7063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 7073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS."); 7103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint maxVertexAttribs; 7113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs); 7123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetVertexAttribfv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms); 7133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7173c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_vertex_attribiv (NegativeTestContext& ctx) 7183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params = -1; 7203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); 7223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetVertexAttribiv(0, -1, ¶ms); 7233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 7243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS."); 7273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint maxVertexAttribs; 7283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs); 7293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetVertexAttribiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms); 7303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7343c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_vertex_attribi_iv (NegativeTestContext& ctx) 7353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params = -1; 7373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); 7393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetVertexAttribIiv(0, -1, ¶ms); 7403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 7413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS."); 7443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint maxVertexAttribs; 7453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs); 7463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetVertexAttribIiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms); 7473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7513c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_vertex_attribi_uiv (NegativeTestContext& ctx) 7523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint params = (GLuint)-1; 7543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); 7563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetVertexAttribIuiv(0, -1, ¶ms); 7573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 7583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS."); 7613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint maxVertexAttribs; 7623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs); 7633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetVertexAttribIuiv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_ENABLED, ¶ms); 7643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7683c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_vertex_attrib_pointerv (NegativeTestContext& ctx) 7693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLvoid* ptr[1] = { DE_NULL }; 7713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); 7733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetVertexAttribPointerv(0, -1, &ptr[0]); 7743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 7753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS."); 7783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint maxVertexAttribs; 7793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &maxVertexAttribs); 7803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetVertexAttribPointerv(maxVertexAttribs, GL_VERTEX_ATTRIB_ARRAY_POINTER, &ptr[0]); 7813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_VALUE); 7823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 7843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7853c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_frag_data_location (NegativeTestContext& ctx) 7863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 7873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER); 7883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint program = ctx.glCreateProgram(); 7893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object."); 7913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFragDataLocation(shader, "gl_FragColor"); 7923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 7933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 7953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been linked."); 7963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFragDataLocation(program, "gl_FragColor"); 7973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 7983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 7993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteProgram(program); 8013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteShader(shader); 8023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Enumerated state queries: Buffers 8053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8063c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_buffer_parameteriv (NegativeTestContext& ctx) 8073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params = -1; 8093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint buf; 8103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers(1, &buf); 8113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer(GL_ARRAY_BUFFER, buf); 8123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or value is not an accepted value."); 8143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferParameteriv(-1, GL_BUFFER_SIZE, ¶ms); 8153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 8163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferParameteriv(GL_ARRAY_BUFFER, -1, ¶ms); 8173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 8183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferParameteriv(-1, -1, ¶ms); 8193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 8203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target."); 8233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer(GL_ARRAY_BUFFER, 0); 8243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferParameteriv(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, ¶ms); 8253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 8263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers(1, &buf); 8293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8313c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_buffer_parameteri64v (NegativeTestContext& ctx) 8323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint64 params = -1; 8343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint buf; 8353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers(1, &buf); 8363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer(GL_ARRAY_BUFFER, buf); 8373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or value is not an accepted value."); 8393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferParameteri64v(-1, GL_BUFFER_SIZE, ¶ms); 8403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 8413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferParameteri64v(GL_ARRAY_BUFFER , -1, ¶ms); 8423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 8433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferParameteri64v(-1, -1, ¶ms); 8443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 8453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target."); 8483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer(GL_ARRAY_BUFFER, 0); 8493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferParameteri64v(GL_ARRAY_BUFFER, GL_BUFFER_SIZE, ¶ms); 8503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 8513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers(1, &buf); 8543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8563c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_buffer_pointerv (NegativeTestContext& ctx) 8573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLvoid* params = DE_NULL; 8593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint buf; 8603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenBuffers(1, &buf); 8613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer(GL_ARRAY_BUFFER, buf); 8623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value."); 8643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferPointerv(GL_ARRAY_BUFFER, -1, ¶ms); 8653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 8663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferPointerv(-1, GL_BUFFER_MAP_POINTER, ¶ms); 8673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 8683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the reserved buffer object name 0 is bound to target."); 8713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindBuffer(GL_ARRAY_BUFFER, 0); 8723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetBufferPointerv(GL_ARRAY_BUFFER, GL_BUFFER_MAP_POINTER, ¶ms); 8733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 8743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 8753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteBuffers(1, &buf); 8773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 8783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8793c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_framebuffer_attachment_parameteriv (NegativeTestContext& ctx) 8803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 8813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params[1] = { -1 }; 8823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint fbo; 8833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint rbo[2]; 8843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenFramebuffers (1, &fbo); 8863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenRenderbuffers (2, rbo); 8873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindFramebuffer (GL_FRAMEBUFFER, fbo); 8893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindRenderbuffer (GL_RENDERBUFFER, rbo[0]); 8903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glRenderbufferStorage (GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, 16, 16); 8913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rbo[0]); 8923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindRenderbuffer (GL_RENDERBUFFER, rbo[1]); 8933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glRenderbufferStorage (GL_RENDERBUFFER, GL_STENCIL_INDEX8, 16, 16); 8943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glFramebufferRenderbuffer (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, rbo[1]); 8953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glCheckFramebufferStatus (GL_FRAMEBUFFER); 8963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 8973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 8983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is not one of the accepted tokens."); 8993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFramebufferAttachmentParameteriv(-1, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, ¶ms[0]); // TYPE is GL_RENDERBUFFER 9003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 9013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not valid for the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE."); 9043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, ¶ms[0]); // TYPE is GL_RENDERBUFFER 9053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 9063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0); 9073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // TYPE is GL_FRAMEBUFFER_DEFAULT 9083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 9093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindFramebuffer(GL_FRAMEBUFFER, fbo); 9103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if attachment is GL_DEPTH_STENCIL_ATTACHMENT and different objects are bound to the depth and stencil attachment points of target."); 9133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); 9143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 9153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if the value of GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is GL_NONE and pname is not GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME."); 9183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // TYPE is GL_NONE 9193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_NO_ERROR); 9203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE, ¶ms[0]); // TYPE is GL_NONE 9213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION); 9223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION or GL_INVALID_ENUM is generated if attachment is not one of the accepted values for the current binding of target."); 9253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_BACK, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // A FBO is bound so GL_BACK is invalid 9263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION, GL_INVALID_ENUM); 9273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindFramebuffer(GL_FRAMEBUFFER, 0); 9283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetFramebufferAttachmentParameteriv(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, ¶ms[0]); // Default framebuffer is bound so GL_COLOR_ATTACHMENT0 is invalid 9293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_OPERATION, GL_INVALID_ENUM); 9303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteFramebuffers(1, &fbo); 9333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 9343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9353c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_renderbuffer_parameteriv (NegativeTestContext& ctx) 9363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params[1] = { -1 }; 9383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint rbo; 9393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenRenderbuffers(1, &rbo); 9403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindRenderbuffer(GL_RENDERBUFFER, rbo); 9413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER."); 9433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetRenderbufferParameteriv(-1, GL_RENDERBUFFER_WIDTH, ¶ms[0]); 9443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 9453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens."); 9483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetRenderbufferParameteriv(GL_RENDERBUFFER, -1, ¶ms[0]); 9493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 9503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteRenderbuffers(1, &rbo); 9533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBindRenderbuffer(GL_RENDERBUFFER, 0); 9543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 9553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9563c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_internalformativ (NegativeTestContext& ctx) 9573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params[16]; 9593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9603c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemset(¶ms[0], 0xcd, sizeof(params)); 9613c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if bufSize is negative."); 9633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, -1, ¶ms[0]); 9643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 9653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9663c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not GL_SAMPLES or GL_NUM_SAMPLE_COUNTS."); 9683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RGBA8, -1, 16, ¶ms[0]); 9693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 9703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if internalformat is not color-, depth-, or stencil-renderable."); 9733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_RG8_SNORM, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); 9743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 9753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetInternalformativ (GL_RENDERBUFFER, GL_COMPRESSED_RGB8_ETC2, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); 9763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 9773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9783c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target is not GL_RENDERBUFFER."); 9803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetInternalformativ (-1, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); 9813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 9823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetInternalformativ (GL_FRAMEBUFFER, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); 9833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 9843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetInternalformativ (GL_TEXTURE_2D, GL_RGBA8, GL_NUM_SAMPLE_COUNTS, 16, ¶ms[0]); 9853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 9863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 9873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 9883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Query object queries 9903c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9913c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_queryiv (NegativeTestContext& ctx) 9923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 9933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint params = -1; 9943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 9953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if target or pname is not an accepted value."); 9963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetQueryiv (GL_ANY_SAMPLES_PASSED, -1, ¶ms); 9973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 9983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetQueryiv (-1, GL_CURRENT_QUERY, ¶ms); 9993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 10003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetQueryiv (-1, -1, ¶ms); 10013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 10023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10053c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_query_objectuiv (NegativeTestContext& ctx) 10063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 10073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint params = -1; 10083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLuint id; 10093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGenQueries (1, &id); 10103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if id is not the name of a query object."); 10123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetQueryObjectuiv (-1, GL_QUERY_RESULT_AVAILABLE, ¶ms); 10133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 10143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.getLog() << TestLog::Message << "// Note: " << id << " is not a query object yet, since it hasn't been used by glBeginQuery" << TestLog::EndMessage; 10153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetQueryObjectuiv (id, GL_QUERY_RESULT_AVAILABLE, ¶ms); 10163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 10173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBeginQuery (GL_ANY_SAMPLES_PASSED, id); 10203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glEndQuery (GL_ANY_SAMPLES_PASSED); 10213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not an accepted value."); 10233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetQueryObjectuiv (id, -1, ¶ms); 10243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 10253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_OPERATION is generated if id is the name of a currently active query object."); 10283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glBeginQuery (GL_ANY_SAMPLES_PASSED, id); 10293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 10303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetQueryObjectuiv (id, GL_QUERY_RESULT_AVAILABLE, ¶ms); 10313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_OPERATION); 10323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glEndQuery (GL_ANY_SAMPLES_PASSED); 10333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 10343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glDeleteQueries (1, &id); 10373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Sync object queries 10403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10413c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid get_synciv (NegativeTestContext& ctx) 10423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 10433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLsizei length = -1; 10443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLint values[32]; 10453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry GLsync sync; 10463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry deMemset(&values[0], 0xcd, sizeof(values)); 10483c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10493c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_VALUE is generated if sync is not the name of a sync object."); 10503c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetSynciv (0, GL_OBJECT_TYPE, 32, &length, &values[0]); 10513c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_VALUE); 10523c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10533c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10543c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if pname is not one of the accepted tokens."); 10553c827367444ee418f129b2c238299f49d3264554Jarkko Poyry sync = ctx.glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); 10563c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_NO_ERROR); 10573c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glGetSynciv (sync, -1, 32, &length, &values[0]); 10583c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError (GL_INVALID_ENUM); 10593c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 106095b0f7bcca126483f7a336a16763b00e6ab8a7d1Pyry Haulos 106195b0f7bcca126483f7a336a16763b00e6ab8a7d1Pyry Haulos ctx.glDeleteSync(sync); 10623c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10633c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10643c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Enumerated boolean state queries 10653c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10663c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid is_enabled (NegativeTestContext& ctx) 10673c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 10683c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if cap is not an accepted value."); 10693c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glIsEnabled(-1); 10703c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 10713c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glIsEnabled(GL_TRIANGLES); 10723c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 10733c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10743c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10753c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10763c827367444ee418f129b2c238299f49d3264554Jarkko Poyry// Hints 10773c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10783c827367444ee418f129b2c238299f49d3264554Jarkko Poyryvoid hint (NegativeTestContext& ctx) 10793c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 10803c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.beginSection("GL_INVALID_ENUM is generated if either target or mode is not an accepted value."); 10813c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glHint(GL_GENERATE_MIPMAP_HINT, -1); 10823c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 10833c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glHint(-1, GL_FASTEST); 10843c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 10853c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.glHint(-1, -1); 10863c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.expectError(GL_INVALID_ENUM); 10873c827367444ee418f129b2c238299f49d3264554Jarkko Poyry ctx.endSection(); 10883c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 10893c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 10903c827367444ee418f129b2c238299f49d3264554Jarkko Poyrystd::vector<FunctionContainer> getNegativeStateApiTestFunctions () 10913c827367444ee418f129b2c238299f49d3264554Jarkko Poyry{ 10923c827367444ee418f129b2c238299f49d3264554Jarkko Poyry FunctionContainer funcs[] = 10933c827367444ee418f129b2c238299f49d3264554Jarkko Poyry { 10943c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {enable, "enable", "Invalid glEnable() usage" }, 10953c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {disable, "disable", "Invalid glDisable() usage" }, 10963c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_booleanv, "get_booleanv", "Invalid glGetBooleanv() usage" }, 10973c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_floatv, "get_floatv", "Invalid glGetFloatv() usage" }, 10983c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_integerv, "get_integerv", "Invalid glGetIntegerv() usage" }, 10993c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_integer64v, "get_integer64v", "Invalid glGetInteger64v() usage" }, 11003c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_integeri_v, "get_integeri_v", "Invalid glGetIntegeri_v() usage" }, 11013c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_integer64i_v, "get_integer64i_v", "Invalid glGetInteger64i_v() usage" }, 11023c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_string, "get_string", "Invalid glGetString() usage" }, 11033c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_stringi, "get_stringi", "Invalid glGetStringi() usage" }, 11043c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_attached_shaders, "get_attached_shaders", "Invalid glGetAttachedShaders() usage" }, 11053c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_shaderiv, "get_shaderiv", "Invalid glGetShaderiv() usage" }, 11063c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_shader_info_log, "get_shader_info_log", "Invalid glGetShaderInfoLog() usage" }, 11073c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_shader_precision_format, "get_shader_precision_format", "Invalid glGetShaderPrecisionFormat() usage" }, 11083c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_shader_source, "get_shader_source", "Invalid glGetShaderSource() usage" }, 11093c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_programiv, "get_programiv", "Invalid glGetProgramiv() usage" }, 11103c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_program_info_log, "get_program_info_log", "Invalid glGetProgramInfoLog() usage" }, 11113c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_tex_parameterfv, "get_tex_parameterfv", "Invalid glGetTexParameterfv() usage" }, 11123c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_tex_parameteriv, "get_tex_parameteriv", "Invalid glGetTexParameteriv() usage" }, 11133c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_uniformfv, "get_uniformfv", "Invalid glGetUniformfv() usage" }, 11143c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_uniformiv, "get_uniformiv", "Invalid glGetUniformiv() usage" }, 11153c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_uniformuiv, "get_uniformuiv", "Invalid glGetUniformuiv() usage" }, 11163c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_active_uniform, "get_active_uniform", "Invalid glGetActiveUniform() usage" }, 11173c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_active_uniformsiv, "get_active_uniformsiv", "Invalid glGetActiveUniformsiv() usage" }, 11183c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_active_uniform_blockiv, "get_active_uniform_blockiv", "Invalid glGetActiveUniformBlockiv() usage" }, 11193c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_active_uniform_block_name, "get_active_uniform_block_name", "Invalid glGetActiveUniformBlockName() usage" }, 11203c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_active_attrib, "get_active_attrib", "Invalid glGetActiveAttrib() usage" }, 11213c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_uniform_indices, "get_uniform_indices", "Invalid glGetUniformIndices() usage" }, 11223c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_vertex_attribfv, "get_vertex_attribfv", "Invalid glGetVertexAttribfv() usage" }, 11233c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_vertex_attribiv, "get_vertex_attribiv", "Invalid glGetVertexAttribiv() usage" }, 11243c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_vertex_attribi_iv, "get_vertex_attribi_iv", "Invalid glGetVertexAttribIiv() usage" }, 11253c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_vertex_attribi_uiv, "get_vertex_attribi_uiv", "Invalid glGetVertexAttribIuiv() usage" }, 11263c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_vertex_attrib_pointerv, "get_vertex_attrib_pointerv", "Invalid glGetVertexAttribPointerv() usage" }, 11273c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_frag_data_location, "get_frag_data_location", "Invalid glGetFragDataLocation() usage" }, 11283c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_buffer_parameteriv, "get_buffer_parameteriv", "Invalid glGetBufferParameteriv() usage" }, 11293c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_buffer_parameteri64v, "get_buffer_parameteri64v", "Invalid glGetBufferParameteri64v() usage" }, 11303c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_buffer_pointerv, "get_buffer_pointerv", "Invalid glGetBufferPointerv() usage" }, 11313c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_framebuffer_attachment_parameteriv, "get_framebuffer_attachment_parameteriv", "Invalid glGetFramebufferAttachmentParameteriv() usage"}, 11323c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_renderbuffer_parameteriv, "get_renderbuffer_parameteriv", "Invalid glGetRenderbufferParameteriv() usage" }, 11333c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_internalformativ, "get_internalformativ", "Invalid glGetInternalformativ() usage" }, 11343c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_queryiv, "get_queryiv", "Invalid glGetQueryiv() usage" }, 11353c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_query_objectuiv, "get_query_objectuiv", "Invalid glGetQueryObjectuiv() usage" }, 11363c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {get_synciv, "get_synciv", "Invalid glGetSynciv() usage" }, 11373c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {is_enabled, "is_enabled", "Invalid glIsEnabled() usage" }, 11383c827367444ee418f129b2c238299f49d3264554Jarkko Poyry {hint, "hint", "Invalid glHint() usage" }, 11393c827367444ee418f129b2c238299f49d3264554Jarkko Poyry }; 11403c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11413c827367444ee418f129b2c238299f49d3264554Jarkko Poyry return std::vector<FunctionContainer>(DE_ARRAY_BEGIN(funcs), DE_ARRAY_END(funcs)); 11423c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} 11433c827367444ee418f129b2c238299f49d3264554Jarkko Poyry 11443c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // NegativeTestShared 11453c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // Functional 11463c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // gles3 11473c827367444ee418f129b2c238299f49d3264554Jarkko Poyry} // deqp 1148