Lines Matching defs:ctx
78 int getResourceLimit (NegativeTestContext& ctx, GLenum resource)
81 ctx.glGetIntegerv(resource, &limit);
86 void verifyLinkError (NegativeTestContext& ctx, const glu::ShaderProgram& program)
90 tcu::TestLog& log = ctx.getLog();
99 ctx.fail(message);
103 void verifyCompileError (NegativeTestContext& ctx, const glu::ShaderProgram& program, glu::ShaderType shaderType)
107 tcu::TestLog& log = ctx.getLog();
116 ctx.fail(message);
120 string generateComputeShader (NegativeTestContext& ctx, const string& shaderDeclarations, const string& shaderBody)
122 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
184 void exceed_uniform_block_limit (NegativeTestContext& ctx)
192 << "} block[" << getResourceLimit(ctx, GL_MAX_COMPUTE_UNIFORM_BLOCKS) + 1 << "];\n";
194 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources()
195 << glu::ComputeSource(generateComputeShader(ctx, shaderDecl.str(), shaderBody.str())));
197 ctx.beginSection("Link error is generated if a compute shader exceeds GL_MAX_COMPUTE_UNIFORM_BLOCKS.");
198 verifyLinkError(ctx, program);
199 ctx.endSection();
202 void exceed_shader_storage_block_limit (NegativeTestContext& ctx)
210 << "} block[" << getResourceLimit(ctx, GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS) + 1 << "];\n";
212 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources()
213 << glu::ComputeSource(generateComputeShader(ctx, shaderDecl.str(), shaderBody.str())));
215 ctx.beginSection("Link error is generated if compute shader exceeds GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS.");
216 verifyLinkError(ctx, program);
217 ctx.endSection();
220 void exceed_texture_image_units_limit (NegativeTestContext& ctx)
222 const int limit = getResourceLimit(ctx, GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS) + 1;
236 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources()
237 << glu::ComputeSource(generateComputeShader(ctx, shaderDecl.str(), shaderBody.str())));
239 tcu::TestLog& log = ctx.getLog();
246 ctx.glUseProgram(program.getProgram());
247 ctx.expectError(GL_NO_ERROR);
249 ctx.beginSection("GL_INVALID_OPERATION error is generated if the sum of the number of active samplers for each active program exceeds the maximum number of texture image units allowed");
250 ctx.glDispatchCompute(1, 1, 1);
251 ctx.expectError(GL_INVALID_OPERATION);
252 ctx.endSection();
256 void exceed_image_uniforms_limit (NegativeTestContext& ctx)
258 const int limit = getResourceLimit(ctx, GL_MAX_COMPUTE_IMAGE_UNIFORMS);
272 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources()
273 << glu::ComputeSource(generateComputeShader(ctx, shaderDecl.str(), shaderBody.str())));
275 ctx.beginSection("Link error is generated if compute shader exceeds GL_MAX_COMPUTE_IMAGE_UNIFORMS.");
276 verifyLinkError(ctx, program);
277 ctx.endSection();
280 void exceed_shared_memory_size_limit (NegativeTestContext& ctx)
282 const int limit = getResourceLimit(ctx, GL_MAX_COMPUTE_SHARED_MEMORY_SIZE);
295 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources()
296 << glu::ComputeSource(generateComputeShader(ctx, shaderDecl.str(), shaderBody.str())));
298 ctx.beginSection("Link error is generated if compute shader exceeds GL_MAX_COMPUTE_SHARED_MEMORY_SIZE.");
299 verifyLinkError(ctx, program);
300 ctx.endSection();
303 void exceed_uniform_components_limit (NegativeTestContext& ctx)
305 const int limit = getResourceLimit(ctx, GL_MAX_COMPUTE_UNIFORM_COMPONENTS);
318 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources()
319 << glu::ComputeSource(generateComputeShader(ctx, shaderDecl.str(), shaderBody.str())));
321 ctx.beginSection("Link error is generated if compute shader exceeds GL_MAX_COMPUTE_UNIFORM_COMPONENTS.");
322 verifyLinkError(ctx, program);
323 ctx.endSection();
326 void exceed_atomic_counter_buffer_limit (NegativeTestContext& ctx)
328 const int limit = getResourceLimit(ctx, GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS);
350 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources()
351 << glu::ComputeSource(generateComputeShader(ctx, shaderDecl.str(), shaderBody.str())));
353 ctx.beginSection("Link error is generated if compute shader exceeds GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS.");
354 verifyLinkError(ctx, program);
355 ctx.endSection();
358 void exceed_atomic_counters_limit (NegativeTestContext& ctx)
364 << "layout(binding = " << sizeof(GLuint) * getResourceLimit(ctx, GL_MAX_COMPUTE_ATOMIC_COUNTERS) << ", offset = 0) uniform atomic_uint u_atomic1;\n"
375 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources()
376 << glu::ComputeSource(generateComputeShader(ctx, shaderDecl.str(), shaderBody.str())));
378 ctx.beginSection("Link error is generated if compute shader exceeds GL_MAX_COMPUTE_ATOMIC_COUNTERS.");
379 verifyLinkError(ctx, program);
380 ctx.endSection();
383 void program_not_active (NegativeTestContext& ctx)
385 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
392 glu::ProgramPipeline pipeline(ctx.getRenderContext());
394 glu::ShaderProgram vertProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << vertSource);
395 glu::ShaderProgram fragProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << fragSource);
397 tcu::TestLog& log = ctx.getLog();
403 ctx.glBindProgramPipeline(pipeline.getPipeline());
404 ctx.expectError(GL_NO_ERROR);
406 ctx.beginSection("Program not set at all");
408 ctx.beginSection("GL_INVALID_OPERATION is generated by glDispatchCompute if there is no active program for the compute shader stage.");
409 ctx.glDispatchCompute(1, 1, 1);
410 ctx.expectError(GL_INVALID_OPERATION);
411 ctx.endSection();
413 ctx.beginSection("GL_INVALID_OPERATION is generated by glDispatchComputeIndirect if there is no active program for the compute shader stage.");
415 ctx.glDispatchComputeIndirect(indirect);
416 ctx.expectError(GL_INVALID_OPERATION);
417 ctx.endSection();
419 ctx.endSection();
421 ctx.beginSection("Program contains graphic pipeline stages");
423 ctx.glUseProgramStages(pipeline.getPipeline(), GL_VERTEX_SHADER_BIT, vertProgram.getProgram());
424 ctx.glUseProgramStages(pipeline.getPipeline(), GL_FRAGMENT_SHADER_BIT, fragProgram.getProgram());
425 ctx.expectError(GL_NO_ERROR);
427 ctx.beginSection("GL_INVALID_OPERATION is generated by glDispatchCompute if there is no active program for the compute shader stage.");
428 ctx.glDispatchCompute(1, 1, 1);
429 ctx.expectError(GL_INVALID_OPERATION);
430 ctx.endSection();
432 ctx.beginSection("GL_INVALID_OPERATION is generated by glDispatchComputeIndirect if there is no active program for the compute shader stage.");
434 ctx.glDispatchComputeIndirect(indirect);
435 ctx.expectError(GL_INVALID_OPERATION);
436 ctx.endSection();
438 ctx.endSection();
440 ctx.glBindProgramPipeline(0);
441 ctx.expectError(GL_NO_ERROR);
444 void invalid_program_query (NegativeTestContext& ctx)
446 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
452 ctx.beginSection("Compute shader that does not link");
455 glu::ShaderProgram invalidComputeProgram (ctx.getRenderContext(), glu::ProgramSources() << compSource);
457 tcu::TestLog& log = ctx.getLog();
463 ctx.beginSection("GL_INVALID_OPERATION is generated if GL_COMPUTE_WORK_GROUP_SIZE is queried for a program which has not been linked properly.");
464 ctx.glGetProgramiv(invalidComputeProgram.getProgram(), GL_COMPUTE_WORK_GROUP_SIZE, &data[0]);
465 ctx.expectError(GL_INVALID_OPERATION);
466 ctx.endSection();
468 ctx.glUseProgram(0);
470 ctx.endSection();
472 ctx.beginSection("Compute shader not present");
476 glu::ShaderProgram graphicsPipelineProgram (ctx.getRenderContext(), glu::ProgramSources() << vertSource << fragSource);
478 tcu::TestLog& log = ctx.getLog();
484 ctx.beginSection("GL_INVALID_OPERATION is generated if GL_COMPUTE_WORK_GROUP_SIZE is queried for a program which has not been linked properly.");
485 ctx.glGetProgramiv(graphicsPipelineProgram.getProgram(), GL_COMPUTE_WORK_GROUP_SIZE, &data[0]);
486 ctx.expectError(GL_INVALID_OPERATION);
487 ctx.endSection();
489 ctx.glUseProgram(0);
491 ctx.endSection();
494 void invalid_dispatch_compute_indirect (NegativeTestContext& ctx)
496 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
501 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources() << compSource);
503 tcu::TestLog& log = ctx.getLog();
509 ctx.glUseProgram(program.getProgram());
510 ctx.expectError(GL_NO_ERROR);
521 ctx.glGenBuffers(1, &buffer);
522 ctx.glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, 0);
523 ctx.expectError(GL_NO_ERROR);
525 ctx.beginSection("GL_INVALID_OPERATION is generated by glDispatchComputeIndirect if zero is bound to GL_DISPATCH_INDIRECT_BUFFER.");
527 ctx.glDispatchComputeIndirect(indirect);
528 ctx.expectError(GL_INVALID_OPERATION);
529 ctx.endSection();
531 ctx.glDeleteBuffers(1, &buffer);
536 ctx.glGenBuffers(1, &buffer);
537 ctx.expectError(GL_NO_ERROR);
539 ctx.glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, buffer);
540 ctx.expectError(GL_NO_ERROR);
542 ctx.glBufferData(GL_DISPATCH_INDIRECT_BUFFER, sizeof(data), &data, GL_STATIC_DRAW);
543 ctx.expectError(GL_NO_ERROR);
545 ctx.beginSection("GL_INVALID_OPERATION is generated by glDispatchComputeIndirect if data is sourced beyond the end of the buffer object.");
547 ctx.glDispatchComputeIndirect(indirect);
548 ctx.expectError(GL_INVALID_OPERATION);
549 ctx.endSection();
551 ctx.glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, 0);
552 ctx.glDeleteBuffers(1, &buffer);
556 ctx.beginSection("GL_INVALID_VALUE is generated by glDispatchComputeIndirect if the value of indirect is less than zero.");
558 ctx.glDispatchComputeIndirect(indirect);
559 ctx.expectError(GL_INVALID_VALUE);
560 ctx.endSection();
565 ctx.glGenBuffers(1, &buffer);
566 ctx.expectError(GL_NO_ERROR);
568 ctx.glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, buffer);
569 ctx.expectError(GL_NO_ERROR);
571 ctx.glBufferData(GL_DISPATCH_INDIRECT_BUFFER, sizeof(data), &data, GL_STATIC_DRAW);
572 ctx.expectError(GL_NO_ERROR);
574 ctx.beginSection("GL_INVALID_VALUE is generated by glDispatchComputeIndirect if indirect is not a multiple of the size, in basic machine units, of uint.");
576 ctx.glDispatchComputeIndirect(indirect);
577 ctx.expectError(GL_INVALID_VALUE);
578 ctx.endSection();
580 ctx.glBindBuffer(GL_DISPATCH_INDIRECT_BUFFER, 0);
581 ctx.glDeleteBuffers(1, &buffer);
585 void invalid_maximum_work_group_counts (NegativeTestContext& ctx)
587 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
592 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources() << compSource);
594 tcu::TestLog& log = ctx.getLog();
600 ctx.glUseProgram(program.getProgram());
601 ctx.expectError(GL_NO_ERROR);
604 ctx.glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, (GLuint)0, &workGroupCountX);
605 ctx.expectError(GL_NO_ERROR);
607 ctx.beginSection("GL_INVALID_VALUE is generated by glDispatchCompute if <numGroupsX> array is larger than the maximum work group count for the x dimension.");
608 ctx.glDispatchCompute(workGroupCountX+1, 1, 1);
609 ctx.expectError(GL_INVALID_VALUE);
610 ctx.endSection();
613 ctx.glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, (GLuint)1, &workGroupCountY);
614 ctx.expectError(GL_NO_ERROR);
616 ctx.beginSection("GL_INVALID_VALUE is generated by glDispatchCompute if <numGroupsY> array is larger than the maximum work group count for the y dimension.");
617 ctx.glDispatchCompute(1, workGroupCountY+1, 1);
618 ctx.expectError(GL_INVALID_VALUE);
619 ctx.endSection();
622 ctx.glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, (GLuint)2, &workGroupCountZ);
623 ctx.expectError(GL_NO_ERROR);
625 ctx.beginSection("GL_INVALID_VALUE is generated by glDispatchCompute if <numGroupsZ> array is larger than the maximum work group count for the z dimension.");
626 ctx.glDispatchCompute(1, 1, workGroupCountZ+1);
627 ctx.expectError(GL_INVALID_VALUE);
628 ctx.endSection();
631 void invalid_maximum_work_group_sizes (NegativeTestContext& ctx)
634 ctx.glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, (GLuint)0, &maxWorkGroupSizeX);
635 ctx.expectError(GL_NO_ERROR);
638 ctx.glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, (GLuint)1, &maxWorkGroupSizeY);
639 ctx.expectError(GL_NO_ERROR);
642 ctx.glGetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, (GLuint)2, &maxWorkGroupSizeZ);
643 ctx.expectError(GL_NO_ERROR);
646 ctx.glGetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS, &maxWorkGroupInvocations);
647 ctx.expectError(GL_NO_ERROR);
651 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
680 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources() << compSource);
685 ctx.beginSection("A compile time or link error is generated if the maximum number of invocations in a single local work group (product of the three dimensions) is greater than GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS.");
687 ctx.getLog() << program;
693 ctx.getLog() << tcu::TestLog::Message << message << tcu::TestLog::EndMessage;
694 ctx.fail(message);
699 ctx.beginSection("A compile time error is generated if the fixed local group size of the shader in any dimension is greater than the maximum supported.");
700 verifyCompileError(ctx, program, glu::SHADERTYPE_COMPUTE);
703 ctx.endSection();
707 void invalid_layout_qualifiers (NegativeTestContext& ctx)
709 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
722 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources() << compSource);
724 ctx.beginSection("A link error is generated if the compute shader program does not contain an input layout qualifier specifying a fixed local group size.");
725 verifyLinkError(ctx, program);
726 ctx.endSection();
739 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources() << compSource);
741 ctx.beginSection("A compile-time error is generated if a local work group size qualifier is declared more than once in the same shader.");
742 verifyCompileError(ctx, program, glu::SHADERTYPE_COMPUTE);
743 ctx.endSection();
757 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources() << compSource);
759 ctx.beginSection("A compile-time error is generated if a user defined output variable is declared in a compute shader.");
760 verifyCompileError(ctx, program, glu::SHADERTYPE_COMPUTE);
761 ctx.endSection();
764 if (glu::isContextTypeES(ctx.getRenderContext().getType())) // for GL4.5 program will compile and link
781 glu::ShaderProgram program(ctx.getRenderContext(), glu::ProgramSources() << compSource);
783 ctx.beginSection("A compile time or link error is generated if compute shader built-in variables are redeclared.");
786 tcu::TestLog& log = ctx.getLog();
795 ctx.fail(message);
798 ctx.endSection();
802 void invalid_write_built_in_constants (NegativeTestContext& ctx)
804 if (glu::isContextTypeES(ctx.getRenderContext().getType()))
806 if((!ctx.isExtensionSupported("GL_EXT_tessellation_shader") && !ctx.isExtensionSupported("GL_OES_tessellation_shader")) ||
807 (!ctx.isExtensionSupported("GL_EXT_geometry_shader") && !ctx.isExtensionSupported("GL_OES_geometry_shader")))
811 const bool isES32 = glu::contextSupports(ctx.getRenderContext().getType(), glu::ApiType::es(3, 2));
832 glu::ShaderProgram vertProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << vertSource);
833 glu::ShaderProgram fragProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << fragSource);
834 glu::ShaderProgram tessCtrlProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << tessCtrlSource);
835 glu::ShaderProgram tessEvalProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << tessEvalSource);
836 glu::ShaderProgram geometryProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << geometrySource);
837 glu::ShaderProgram computeProgram (ctx.getRenderContext(), glu::ProgramSources() << glu::ProgramSeparable(true) << computeSource);
839 ctx.beginSection("A compile time is generated if compute built-in constants provided in all shaders are written to.");
840 verifyCompileError(ctx, vertProgram, glu::SHADERTYPE_VERTEX);
841 verifyCompileError(ctx, fragProgram, glu::SHADERTYPE_FRAGMENT);
842 verifyCompileError(ctx, tessCtrlProgram, glu::SHADERTYPE_TESSELLATION_CONTROL);
843 verifyCompileError(ctx, tessEvalProgram, glu::SHADERTYPE_TESSELLATION_EVALUATION);
844 verifyCompileError(ctx, geometryProgram, glu::SHADERTYPE_GEOMETRY);
845 verifyCompileError(ctx, computeProgram, glu::SHADERTYPE_COMPUTE);
846 ctx.endSection();