Lines Matching defs:ctx
85 static void checkExtensionSupport (NegativeTestContext& ctx, const char* extName)
87 if (!ctx.getContextInfo().isExtensionSupported(extName))
91 static void checkTessellationSupport (NegativeTestContext& ctx)
93 if (glu::isContextTypeES(ctx.getRenderContext().getType()))
94 checkExtensionSupport(ctx, "GL_EXT_tessellation_shader");
113 map<string, string> constructSpecializationMap(NegativeTestContext& ctx)
115 glu::GLSLVersion glslVersion = glu::getContextTypeGLSLVersion(ctx.getRenderContext().getType());
129 void single_tessellation_stage (NegativeTestContext& ctx)
132 if (!glu::isContextTypeES(ctx.getRenderContext().getType()))
135 const bool requireTES = !ctx.getContextInfo().isExtensionSupported("GL_NV_gpu_shader5");
136 map<string, string> args = constructSpecializationMap(ctx);
138 checkTessellationSupport(ctx);
141 glu::ShaderProgram program(ctx.getRenderContext(),
146 tcu::TestLog& log = ctx.getLog();
149 ctx.beginSection("A link error is generated if a non-separable program has a tessellation control shader but no tessellation evaluation shader, unless GL_NV_gpu_shader5 is supported.");
152 ctx.fail("Program was not expected to link");
154 ctx.fail("Program was expected to link");
156 ctx.endSection();
160 glu::ShaderProgram program(ctx.getRenderContext(),
166 tcu::TestLog& log = ctx.getLog();
172 ctx.glUseProgram(program.getProgram());
173 ctx.expectError(GL_NO_ERROR);
175 ctx.beginSection("GL_INVALID_OPERATION is generated if current program state has tessellation control shader but no tessellation evaluation shader, unless GL_NV_gpu_shader5 is supported.");
176 ctx.glDrawArrays(GL_PATCHES, 0, 3);
177 ctx.expectError(requireTES ? GL_INVALID_OPERATION : GL_NO_ERROR);
178 ctx.endSection();
180 ctx.glUseProgram(0);
184 glu::ShaderProgram program(ctx.getRenderContext(),
189 tcu::TestLog& log = ctx.getLog();
192 ctx.beginSection("A link error is generated if a non-separable program has a tessellation evaluation shader but no tessellation control shader.");
195 ctx.fail("Program was not expected to link");
197 ctx.endSection();
201 glu::ShaderProgram program(ctx.getRenderContext(),
207 tcu::TestLog& log = ctx.getLog();
213 ctx.glUseProgram(program.getProgram());
214 ctx.expectError(GL_NO_ERROR);
216 ctx.beginSection("GL_INVALID_OPERATION is generated if current program state has tessellation evaluation shader but no tessellation control shader.");
217 ctx.glDrawArrays(GL_PATCHES, 0, 3);
218 ctx.expectError(GL_INVALID_OPERATION);
219 ctx.endSection();
221 ctx.glUseProgram(0);
226 void invalid_primitive_mode (NegativeTestContext& ctx)
228 checkTessellationSupport(ctx);
230 map<string, string> args = constructSpecializationMap(ctx);
231 glu::ShaderProgram program(ctx.getRenderContext(),
236 tcu::TestLog& log = ctx.getLog();
239 ctx.glUseProgram(program.getProgram());
240 ctx.expectError(GL_NO_ERROR);
242 ctx.beginSection("GL_INVALID_OPERATION is generated if tessellation is active and primitive mode is not GL_PATCHES.");
243 ctx.glDrawArrays(GL_TRIANGLES, 0, 3);
244 ctx.expectError(GL_INVALID_OPERATION);
245 ctx.endSection();
247 ctx.glUseProgram(0);
250 void tessellation_not_active (NegativeTestContext& ctx)
252 checkTessellationSupport(ctx);
254 const glw::GLenum tessErr = ctx.getContextInfo().isExtensionSupported("GL_NV_gpu_shader5") ? GL_NO_ERROR : GL_INVALID_OPERATION;
255 map<string, string> args = constructSpecializationMap(ctx);
256 glu::ShaderProgram program(ctx.getRenderContext(),
261 tcu::TestLog& log = ctx.getLog();
265 if (!glu::isContextTypeES(ctx.getRenderContext().getType()))
267 ctx.glGenVertexArrays(1, &vao);
268 ctx.glBindVertexArray(vao);
271 ctx.glUseProgram(program.getProgram());
272 ctx.expectError(GL_NO_ERROR);
274 ctx.beginSection("GL_INVALID_OPERATION is generated if tessellation is not active and primitive mode is GL_PATCHES, unless GL_NV_gpu_shader5 is supported.");
275 ctx.glDrawArrays(GL_PATCHES, 0, 3);
276 ctx.expectError(tessErr);
277 ctx.endSection();
279 ctx.glUseProgram(0);
282 ctx.glDeleteVertexArrays(1, &vao);
285 void invalid_program_state (NegativeTestContext& ctx)
287 checkTessellationSupport(ctx);
289 const glu::RenderContext& rc = ctx.getRenderContext();
290 map<string, string> args = constructSpecializationMap(ctx);
310 tcu::TestLog& log = ctx.getLog();
316 ctx.glBindProgramPipeline(pipeline.getPipeline());
317 ctx.expectError(GL_NO_ERROR);
319 ctx.glUseProgramStages(pipeline.getPipeline(), GL_FRAGMENT_SHADER_BIT, fragProgram.getProgram());
320 ctx.glUseProgramStages(pipeline.getPipeline(), GL_TESS_CONTROL_SHADER_BIT, tessCtrlProgram.getProgram());
321 ctx.glUseProgramStages(pipeline.getPipeline(), GL_TESS_EVALUATION_SHADER_BIT, tessEvalProgram.getProgram());
322 ctx.expectError(GL_NO_ERROR);
324 ctx.beginSection("GL_INVALID_OPERATION is generated if tessellation is active and vertex shader is missing.");
325 ctx.glDrawArrays(GL_PATCHES, 0, 3);
326 ctx.expectError(GL_INVALID_OPERATION);
327 ctx.endSection();
329 ctx.glBindProgramPipeline(0);
330 ctx.expectError(GL_NO_ERROR);
333 void tessellation_control_invalid_vertex_count (NegativeTestContext& ctx)
335 checkTessellationSupport(ctx);
345 map<string, string> args = constructSpecializationMap(ctx);
348 ctx.beginSection("Output vertex count exceeds GL_MAX_PATCH_VERTICES.");
349 ctx.glGetIntegerv(GL_MAX_PATCH_VERTICES, &maxPatchVertices);
350 ctx.expectError(GL_NO_ERROR);
357 glu::ShaderProgram program(ctx.getRenderContext(),
362 tcu::TestLog& log = ctx.getLog();
368 ctx.fail("Program was not expected to link");
370 ctx.endSection();
373 void invalid_get_programiv (NegativeTestContext& ctx)
375 checkTessellationSupport(ctx);
377 GLuint program = ctx.glCreateProgram();
380 ctx.beginSection("GL_INVALID_OPERATION is generated if GL_TESS_CONTROL_OUTPUT_VERTICES is queried for a program which has not been linked properly.");
381 ctx.glGetProgramiv(program, GL_TESS_CONTROL_OUTPUT_VERTICES, ¶ms[0]);
382 ctx.expectError(GL_INVALID_OPERATION);
383 ctx.endSection();
385 ctx.beginSection("GL_INVALID_OPERATION is generated if GL_TESS_GEN_MODE is queried for a program which has not been linked properly.");
386 ctx.glGetProgramiv(program, GL_TESS_GEN_MODE, ¶ms[0]);
387 ctx.expectError(GL_INVALID_OPERATION);
388 ctx.endSection();
390 ctx.beginSection("GL_INVALID_OPERATION is generated if GL_TESS_GEN_SPACING is queried for a program which has not been linked properly.");
391 ctx.glGetProgramiv(program, GL_TESS_GEN_SPACING, ¶ms[0]);
392 ctx.expectError(GL_INVALID_OPERATION);
393 ctx.endSection();
395 ctx.beginSection("GL_INVALID_OPERATION is generated if GL_TESS_GEN_VERTEX_ORDER is queried for a program which has not been linked properly.");
396 ctx.glGetProgramiv(program, GL_TESS_GEN_VERTEX_ORDER, ¶ms[0]);
397 ctx.expectError(GL_INVALID_OPERATION);
398 ctx.endSection();
400 ctx.beginSection("GL_INVALID_OPERATION is generated if GL_TESS_GEN_POINT_MODE is queried for a program which has not been linked properly.");
401 ctx.glGetProgramiv(program, GL_TESS_GEN_POINT_MODE, ¶ms[0]);
402 ctx.expectError(GL_INVALID_OPERATION);
403 ctx.endSection();
405 ctx.glDeleteProgram(program);
408 void invalid_patch_parameteri (NegativeTestContext& ctx)
410 checkTessellationSupport(ctx);
412 ctx.beginSection("GL_INVALID_ENUM is generated if pname is not GL_PATCH_VERTICES.");
413 ctx.glPatchParameteri(-1, 1);
414 ctx.expectError(GL_INVALID_ENUM);
415 ctx.endSection();
417 ctx.beginSection("GL_INVALID_VALUE is generated if value is less than or equal to zero.");
418 ctx.glPatchParameteri(GL_PATCH_VERTICES, 0);
419 ctx.expectError(GL_INVALID_VALUE);
420 ctx.endSection();
423 ctx.glGetIntegerv(GL_MAX_PATCH_VERTICES, &maxPatchVertices);
424 ctx.expectError(GL_NO_ERROR);
426 ctx.beginSection("GL_INVALID_VALUE is generated if value is greater than GL_MAX_PATCH_VERTICES.");
427 ctx.glPatchParameteri(GL_PATCH_VERTICES, maxPatchVertices + 1);
428 ctx.expectError(GL_INVALID_VALUE);
429 ctx.endSection();