void compile_shader (NegativeTestContext& ctx)
{
- // \note Shader compilation must be supported.
+ const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
+ ctx.glDeleteShader(notAShader);
ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
- ctx.glCompileShader(9);
+ ctx.glCompileShader(notAShader);
ctx.expectError(GL_INVALID_VALUE);
ctx.endSection();
void delete_shader (NegativeTestContext& ctx)
{
+ const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
+ ctx.glDeleteShader(notAShader);
+
ctx.beginSection("GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.");
- ctx.glDeleteShader(9);
+ ctx.glDeleteShader(notAShader);
ctx.expectError(GL_INVALID_VALUE);
ctx.endSection();
}
GLuint shader2 = ctx.glCreateShader(GL_VERTEX_SHADER);
GLuint program = ctx.glCreateProgram();
+ const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
+ const GLuint notAProgram = ctx.glCreateProgram();
+
+ ctx.glDeleteShader(notAShader);
+ ctx.glDeleteProgram(notAProgram);
+
ctx.beginSection("GL_INVALID_OPERATION is generated if program is not a program object.");
ctx.glAttachShader(shader1, shader1);
ctx.expectError(GL_INVALID_OPERATION);
ctx.endSection();
ctx.beginSection("GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL.");
- ctx.glAttachShader(program, -1);
+ ctx.glAttachShader(program, notAShader);
ctx.expectError(GL_INVALID_VALUE);
- ctx.glAttachShader(-1, shader1);
+ ctx.glAttachShader(notAProgram, shader1);
ctx.expectError(GL_INVALID_VALUE);
- ctx.glAttachShader(-1, -1);
+ ctx.glAttachShader(notAProgram, notAShader);
ctx.expectError(GL_INVALID_VALUE);
ctx.endSection();
GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
GLuint program = ctx.glCreateProgram();
+ const GLuint notAShader = ctx.glCreateShader(GL_VERTEX_SHADER);
+ const GLuint notAProgram = ctx.glCreateProgram();
+
+ ctx.glDeleteShader(notAShader);
+ ctx.glDeleteProgram(notAProgram);
+
ctx.beginSection("GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL.");
- ctx.glDetachShader(-1, shader);
+ ctx.glDetachShader(notAProgram, shader);
ctx.expectError(GL_INVALID_VALUE);
- ctx.glDetachShader(program, -1);
+ ctx.glDetachShader(program, notAShader);
ctx.expectError(GL_INVALID_VALUE);
- ctx.glDetachShader(-1, -1);
+ ctx.glDetachShader(notAProgram, notAShader);
ctx.expectError(GL_INVALID_VALUE);
ctx.endSection();
{
GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
+ const GLuint notAProgram = ctx.glCreateProgram();
+ ctx.glDeleteProgram(notAProgram);
+
ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
- ctx.glLinkProgram(-1);
+ ctx.glLinkProgram(notAProgram);
ctx.expectError(GL_INVALID_VALUE);
ctx.endSection();
{
GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
+ const GLuint notAProgram = ctx.glCreateProgram();
+ ctx.glDeleteProgram(notAProgram);
+
ctx.beginSection("GL_INVALID_VALUE is generated if program is neither 0 nor a value generated by OpenGL.");
- ctx.glUseProgram(-1);
+ ctx.glUseProgram(notAProgram);
ctx.expectError(GL_INVALID_VALUE);
ctx.endSection();
{
GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
+ const GLuint notAProgram = ctx.glCreateProgram();
+ ctx.glDeleteProgram(notAProgram);
+
ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
- ctx.glDeleteProgram(-1);
+ ctx.glDeleteProgram(notAProgram);
ctx.expectError(GL_INVALID_VALUE);
ctx.endSection();
{
GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
+ const GLuint notAProgram = ctx.glCreateProgram();
+ ctx.glDeleteProgram(notAProgram);
+
ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
- ctx.glValidateProgram(-1);
+ ctx.glValidateProgram(notAProgram);
ctx.expectError(GL_INVALID_VALUE);
ctx.endSection();
GLuint program = ctx.glCreateProgram();
GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
+ const GLuint notAProgram = ctx.glCreateProgram();
+ ctx.glDeleteProgram(notAProgram);
+
ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of an existing program object.");
- ctx.glProgramParameteri(0, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
+ ctx.glProgramParameteri(notAProgram, GL_PROGRAM_BINARY_RETRIEVABLE_HINT, GL_TRUE);
ctx.expectError(GL_INVALID_VALUE);
ctx.endSection();
glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
+ const GLuint notAProgram = ctx.glCreateProgram();
+ ctx.glDeleteProgram(notAProgram);
+
ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
ctx.glBindAttribLocation (programEmpty, 0, "test");
ctx.glGetAttribLocation (programEmpty, "test");
ctx.expectError (GL_NO_ERROR);
ctx.glGetAttribLocation (program.getProgram(), "test");
ctx.expectError (GL_NO_ERROR);
- ctx.glGetAttribLocation (-2, "test");
+ ctx.glGetAttribLocation (notAProgram, "test");
ctx.expectError (GL_INVALID_VALUE);
ctx.endSection();
glu::ShaderProgram program(ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
+ const GLuint notAProgram = ctx.glCreateProgram();
+ ctx.glDeleteProgram(notAProgram);
+
ctx.beginSection("GL_INVALID_OPERATION is generated if program has not been successfully linked.");
ctx.glGetUniformLocation(programEmpty, "test");
ctx.expectError(GL_INVALID_OPERATION);
ctx.beginSection("GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.");
ctx.glUseProgram(program.getProgram());
- ctx.glGetUniformLocation(-2, "test");
+ ctx.glGetUniformLocation(notAProgram, "test");
ctx.expectError(GL_INVALID_VALUE);
ctx.endSection();
GLenum type;
char name[32];
+ const GLuint notAProgram = ctx.glCreateProgram();
+ ctx.glDeleteProgram(notAProgram);
+
ctx.glGenTransformFeedbacks (1, &tfID);
ctx.glTransformFeedbackVaryings (program.getProgram(), 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
ctx.expectError (GL_NO_ERROR);
ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object.");
- ctx.glGetTransformFeedbackVarying (-1, 0, 32, &length, &size, &type, &name[0]);
+ ctx.glGetTransformFeedbackVarying (notAProgram, 0, 32, &length, &size, &type, &name[0]);
ctx.expectError (GL_INVALID_VALUE);
ctx.endSection();
void transform_feedback_varyings (NegativeTestContext& ctx)
{
GLuint tfID = 0;
- GLuint shader = -1;
+ GLuint shader = ctx.glCreateShader(GL_VERTEX_SHADER);
glu::ShaderProgram program (ctx.getRenderContext(), glu::makeVtxFragSources(vertexShaderSource, fragmentShaderSource));
const char* tfVarying = "gl_Position";
GLint maxTransformFeedbackSeparateAttribs = 0;
+ const GLuint notAProgram = ctx.glCreateProgram();
+ ctx.glDeleteProgram(notAProgram);
+
ctx.glGenTransformFeedbacks (1, &tfID);
ctx.expectError (GL_NO_ERROR);
ctx.beginSection("GL_INVALID_VALUE is generated if program is not the name of a program object.");
- ctx.glTransformFeedbackVaryings (0, 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
+ ctx.glTransformFeedbackVaryings (notAProgram, 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
ctx.expectError (GL_INVALID_VALUE);
ctx.endSection();
ctx.beginSection("GL_INVALID_OPERATION is generated if program is the name of a shader object.");
- shader = ctx.glCreateShader(GL_VERTEX_SHADER);
ctx.glTransformFeedbackVaryings(shader, 1, &tfVarying, GL_INTERLEAVED_ATTRIBS);
ctx.expectError(GL_INVALID_OPERATION);
ctx.glDeleteShader(shader);