/** * Ensures the driver supports the required extensions, GL, and GLSL versions. * If it doesn't, report PIGLIT_SKIP and exit the test. */ void require_GL_features(enum shader_target test_stage) { int tex_units; piglit_require_GLSL_version(shader_version); if (swizzling) piglit_require_extension("GL_EXT_texture_swizzle"); switch (sampler.internal_format) { case GL_RGBA32I: case GL_RGBA16I: piglit_require_extension("GL_EXT_texture_integer"); break; case GL_RGBA32UI: case GL_RGBA16UI: if (piglit_is_extension_supported("GL_EXT_gpu_shader4")) piglit_require_gl_version(21); else piglit_require_gl_version(30); break; case GL_RGBA32F: case GL_RGBA16F: piglit_require_extension("GL_ARB_texture_float"); break; } switch (sampler.target) { case GL_TEXTURE_CUBE_MAP_ARRAY: piglit_require_extension("GL_ARB_texture_cube_map_array"); break; case GL_TEXTURE_1D_ARRAY: case GL_TEXTURE_2D_ARRAY: piglit_require_extension("GL_EXT_texture_array"); break; case GL_TEXTURE_CUBE_MAP: if (is_shadow_sampler()) { if (piglit_is_extension_supported("GL_EXT_gpu_shader4")) piglit_require_gl_version(21); else piglit_require_gl_version(30); } break; case GL_TEXTURE_RECTANGLE: piglit_require_extension("GL_ARB_texture_rectangle"); break; case GL_TEXTURE_BUFFER: piglit_require_extension("GL_ARB_texture_buffer_object"); break; case GL_TEXTURE_2D_MULTISAMPLE: case GL_TEXTURE_2D_MULTISAMPLE_ARRAY: piglit_require_extension("GL_ARB_texture_multisample"); } /* If testing in the VS, check for VS texture units */ glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS, &tex_units); if (test_stage == VS && tex_units <= 0) piglit_report_result(PIGLIT_SKIP); }
void piglit_init(int argc, char **argv) { int a,i; piglit_require_gl_version(20); piglit_require_extension("GL_ARB_explicit_attrib_location"); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); snorm_equation_23 = piglit_get_gl_version() >= 42; glClearColor(0.2, 0.2, 0.2, 1.0); for (a = 1; a < argc; a++) { for (i = 0; i < ARRAY_SIZE(test_sets); i++) { if (strcmp(argv[a], test_sets[i].name) == 0) { if (test_sets[i].gl_version) piglit_require_gl_version(test_sets[i].gl_version); if (test_sets[i].extension) piglit_require_extension(test_sets[i].extension); test_set = &test_sets[i]; return; } } } }
void piglit_init(int argc, char **argv) { piglit_require_gl_version(20); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); }
void piglit_init(int argc, char **argv) { int num_samples; if (argc < 2) print_usage_and_exit(argv[0]); { char *endptr = NULL; num_samples = strtol(argv[1], &endptr, 0); if (endptr != argv[1] + strlen(argv[1])) print_usage_and_exit(argv[0]); } piglit_require_gl_version(30); glClear(GL_COLOR_BUFFER_BIT); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; glGetIntegerv(GL_MAX_SAMPLES, &max_samples); if (num_samples > max_samples) piglit_report_result(PIGLIT_SKIP); buffer_to_test = GL_COLOR_BUFFER_BIT; test_pattern = new Lines(); test_pattern->compile(); test_fbo.setup(FboConfig(num_samples, pattern_width, pattern_height)); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE); }
void piglit_init(int argc, char **argv) { GLint vert[3]; GLint prog_a; GLint prog_b; GLint prog_c; GLint prog_d; piglit_require_gl_version(20); vert[0] = piglit_compile_shader(GL_VERTEX_SHADER, "shaders/glsl-link-initializer-01a.vert"); vert[1] = piglit_compile_shader(GL_VERTEX_SHADER, "shaders/glsl-link-initializer-01b.vert"); vert[2] = piglit_compile_shader(GL_VERTEX_SHADER, "shaders/glsl-link-initializer-01c.vert"); prog_a = piglit_link_simple_program(vert[0], vert[1]); prog_b = piglit_link_simple_program(vert[1], vert[0]); prog_c = piglit_link_simple_program(vert[0], vert[2]); prog_d = piglit_link_simple_program(vert[2], vert[0]); /* piglit_link_simple_program() returns 0 on link failure. So * verify that there was no link failure by simply checking * that two programs were returned. */ piglit_report_result((prog_a && prog_b && prog_c && prog_d) ? PIGLIT_PASS : PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { GLint max_attachments; printf("The result should be increasing lengths of rows of green\n" "boxes as the test increases the number of drawbuffers \n" "targets used.\n"); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); piglit_require_gl_version(20); piglit_require_extension("GL_EXT_framebuffer_object"); piglit_require_extension("GL_ARB_draw_buffers"); glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_targets); if (max_targets < 2) piglit_report_result(PIGLIT_SKIP); glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_attachments); if (max_targets > max_attachments) max_targets = max_attachments; if (max_targets > 16) max_targets = 16; }
void piglit_init(int argc, char **argv) { GLubyte pixels[TEX_SIZE][TEX_SIZE][4]; GLuint tex; int i, j; piglit_require_gl_version(13); /* solid red texture */ for (i = 0; i < TEX_SIZE; i++) { for (j = 0; j < TEX_SIZE; j++) { pixels[i][j][0] = 255; pixels[i][j][1] = 0; pixels[i][j][2] = 0; pixels[i][j][3] = 255; } } glGenTextures(1, &tex); glBindTexture(GL_TEXTURE_3D, tex); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER); glTexParameterfv(GL_TEXTURE_3D, GL_TEXTURE_BORDER_COLOR, green); glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, TEX_SIZE, TEX_SIZE, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels); glEnable(GL_TEXTURE_3D); }
void piglit_init(int argc, char **argv) { GLuint id; piglit_require_gl_version(15); piglit_require_GLSL(); piglit_require_extension("GL_EXT_transform_feedback"); piglit_require_extension("GL_ARB_transform_feedback2"); glGenTransformFeedbacks(1, &id); if (glIsTransformFeedback(id)) { fprintf(stderr, "id recognized incorrectly as a transform feedback object.\n"); piglit_report_result(PIGLIT_FAIL); } glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id); if (!glIsTransformFeedback(id)) { fprintf(stderr, "id not recognized correctly as a transform feedback object.\n"); piglit_report_result(PIGLIT_FAIL); } piglit_report_result(PIGLIT_PASS); }
void piglit_init(int argc, char **argv) { GLboolean pass = GL_TRUE; GLint count; GLuint prog; GLenum err; piglit_require_gl_version(20); piglit_require_extension("GL_EXT_separate_shader_objects"); prog = glCreateShaderProgramEXT(GL_VERTEX_SHADER, vs_text); err = glGetError(); if (err != 0) { printf("Unexpected OpenGL error state 0x%04x for " "glCreateShaderProgramEXT\n", err); pass = GL_FALSE; } count = -1; glGetProgramiv(prog, GL_ATTACHED_SHADERS, &count); if (count != 0) { printf("Expected attached shader count of 0, got %d.\n", count); pass = GL_FALSE; } piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { GLuint vs, fs; piglit_require_gl_version(20); vs = piglit_compile_shader(GL_VERTEX_SHADER, "shaders/glsl-color-mvp.vert"); fs = piglit_compile_shader(GL_FRAGMENT_SHADER, "shaders/glsl-color.frag"); prog = piglit_link_simple_program(vs, fs); glDeleteShader(vs); glDeleteShader(fs); /* Don't try to render if the program failed to link, and linking * had better succeed! */ if (!piglit_link_check_status(prog)) piglit_report_result(PIGLIT_FAIL); glUseProgram(prog); }
void piglit_init(int argc, char **argv) { if (argc < 2) print_usage_and_exit(argv[0]); { char *endptr = NULL; num_samples = strtol(argv[1], &endptr, 0); if (endptr != argv[1] + strlen(argv[1])) print_usage_and_exit(argv[0]); } piglit_require_gl_version(30); piglit_ortho_projection(pattern_width, pattern_height, GL_TRUE); /* Skip the test if num_samples > GL_MAX_SAMPLES */ GLint max_samples; glGetIntegerv(GL_MAX_SAMPLES, &max_samples); if (num_samples > max_samples) piglit_report_result(PIGLIT_SKIP); ms_fbo.setup(FboConfig(num_samples, pattern_width, pattern_height)); resolve_fbo.setup(FboConfig(0, pattern_width, pattern_height)); buffer_to_test = GL_COLOR_BUFFER_BIT; shader_compile(); glEnable(GL_POLYGON_STIPPLE); glPolygonStipple(stipple_pattern); }
void piglit_init(int argc, char **argv) { GLint ok; GLuint prog; GLuint vs; piglit_require_gl_version(20); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, bad_vs_text); prog = glCreateProgram(); glAttachShader(prog, vs); glLinkProgram(prog); glDeleteShader(vs); ok = piglit_link_check_status_quiet(prog); if (ok) { fprintf(stderr, "Linking with unresolved symbol succeeded when it " "should have failed.\n"); piglit_report_result(PIGLIT_FAIL); } piglit_report_result(PIGLIT_PASS); }
PIGLIT_GL_TEST_CONFIG_END void piglit_init(int argc, char **argv) { piglit_require_gl_version(14); }
void piglit_init(int argc, char *argv[]) { GLuint vs, gs, prog; piglit_require_gl_version(15); piglit_require_GLSL(); do_query_init(queries, ARRAY_SIZE(queries)); prog = glCreateProgram(); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_src); gs = piglit_compile_shader_text(GL_GEOMETRY_SHADER, gs_src); #ifndef DISPLAY glEnable(GL_RASTERIZER_DISCARD); #else glAttachShader(prog, piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_src)); #endif glAttachShader(prog, vs); glAttachShader(prog, gs); glLinkProgram(prog); if (!piglit_link_check_status(prog)) { glDeleteProgram(prog); piglit_report_result(PIGLIT_FAIL); } glUseProgram(prog); }
void piglit_init(int argc, char **argv) { GLint vert; GLint prog; GLboolean ok; piglit_require_gl_version(20); piglit_require_extension("GL_ARB_explicit_attrib_location"); vert = piglit_compile_shader(GL_VERTEX_SHADER, "shaders/glsl-explicit-location-01.vert"); prog = glCreateProgram(); glAttachShader(prog, vert); glLinkProgram(prog); ok = piglit_link_check_status(prog); if (ok) { GLint loc = glGetAttribLocation(prog, "vertex"); if (loc != 0) { fprintf(stderr, "Expected location of 'vertex' to be 0, got " "%d instead.\n", loc); ok = GL_FALSE; } } piglit_report_result(ok ? PIGLIT_PASS : PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { GLuint buf; GLint vertex; piglit_require_gl_version(20); prog = piglit_build_simple_program(vs, fs); if (!prog) { printf("Failed to compile/link program\n"); piglit_report_result(PIGLIT_FAIL); } glUseProgram(prog); attr = glGetAttribLocation(prog, "attr"); vertex = glGetAttribLocation(prog, "vertex"); glGenBuffers(1, &buf); glBindBuffer(GL_ARRAY_BUFFER, buf); glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW); glVertexAttribPointer(vertex, 2, GL_FLOAT, GL_FALSE, 0, 0); glEnableVertexAttribArray(vertex); }
void piglit_init(int argc, char **argv) { GLboolean try_to_render; GLuint vs; GLuint fs; piglit_require_gl_version(20); piglit_require_extension("GL_EXT_separate_shader_objects"); glClearColor(0.3, 0.3, 0.3, 0.0); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vs_text); fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_text); prog[0] = piglit_link_simple_program(vs, 0); prog[1] = piglit_link_simple_program(0, fs); glDeleteShader(vs); glDeleteShader(fs); /* Don't try to render if either program failed to link, and linking * had better succeed! */ try_to_render = piglit_link_check_status(prog[0]); try_to_render = piglit_link_check_status(prog[1]) && try_to_render; if (!try_to_render) piglit_report_result(PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { GLboolean try_to_render; piglit_require_gl_version(20); piglit_require_extension("GL_EXT_separate_shader_objects"); glClearColor(0.3, 0.3, 0.3, 0.0); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); prog[0] = glCreateShaderProgramEXT(GL_VERTEX_SHADER, vs_text); prog[1] = glCreateShaderProgramEXT(GL_FRAGMENT_SHADER, fs_text); /* Don't try to render if either program failed to link. The * GL_EXT_separate_shader_obejcts spec is really vague about whether * or not linking will fail here. */ printf("Checking link result for vertex shader...\n"); try_to_render = piglit_link_check_status_quiet(prog[0]); printf("Checking link result for fragment shader...\n"); try_to_render = piglit_link_check_status_quiet(prog[1]) && try_to_render; if (!try_to_render) piglit_report_result(PIGLIT_PASS); }
void piglit_init(int argc, char **argv) { GLint max_attachments; assert(ARRAY_SIZE(colors) == MAX_TARGETS); printf("Each row tests a different number of drawing buffers.\n"); printf("Each column tests a different color for a different buffer.\n"); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); piglit_require_gl_version(20); piglit_require_extension("GL_EXT_framebuffer_object"); piglit_require_extension("GL_ARB_draw_buffers"); glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &max_targets); printf("GL_MAX_DRAW_BUFFERS_ARB = %d\n", max_targets); if (max_targets < 2) piglit_report_result(PIGLIT_SKIP); if (max_targets > MAX_TARGETS) { printf("Warning: clamping GL_MAX_DRAW_BUFFERS to %d\n", MAX_TARGETS); max_targets = MAX_TARGETS; } glGetIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &max_attachments); printf("GL_MAX_COLOR_ATTACHMENTS_EXT = %d\n", max_attachments); if (max_targets > max_attachments) max_targets = max_attachments; }
void piglit_init(int argc, char **argv) { bool pass = true; ObjectPtrLabel = GET_FUNC(glObjectPtrLabel); GetObjectPtrLabel = GET_FUNC(glGetObjectPtrLabel); ObjectLabel = GET_FUNC(glObjectLabel); GetObjectLabel = GET_FUNC(glGetObjectLabel); #ifdef PIGLIT_USE_OPENGL piglit_require_gl_version(15); #endif piglit_require_extension("GL_KHR_debug"); pass = test_object_label_types() && pass; pass = test_object_label() && pass; pass = test_get_object_label() && pass; /* Test only if is GLES 3.0 or GL 3.2 or has ARB_sync */ if ((piglit_is_gles() && piglit_get_gl_version() >= 30) || piglit_get_gl_version() >= 32 || piglit_is_extension_supported("GL_ARB_sync")) pass = test_object_ptr_label() && pass; piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { GLint max_samples; if (argc < 2) print_usage_and_exit(argv[0]); { char *endptr = NULL; num_samples = strtol(argv[1], &endptr, 0); if (endptr != argv[1] + strlen(argv[1])) print_usage_and_exit(argv[0]); } piglit_require_gl_version(21); piglit_require_extension("GL_ARB_framebuffer_object"); piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ glGetIntegerv(GL_MAX_SAMPLES, &max_samples); if (num_samples > max_samples) { printf("Sample count not supported : %d\n", num_samples); piglit_report_result(PIGLIT_SKIP); } test = create_test(TEST_TYPE_COLOR, num_samples, false /*small*/, true /* combine_depth_stencil */, pattern_width, pattern_height, 16 /* supersample_factor */); }
static enum piglit_result test_version(void) { const GLubyte *version = glGetString(GL_VERSION); GLuint iversion; GLint major, minor, k; piglit_require_gl_version(30); major = version[0] - '0'; minor = version[2] - '0'; iversion = major * 10 + minor; if (iversion < 30) { return PIGLIT_SKIP; } glGetIntegerv(GL_MAJOR_VERSION, &k); if (k != major) { printf("%s: major version mismatch (%d vs. %d)\n", Prog, k, major); return PIGLIT_FAIL; } glGetIntegerv(GL_MINOR_VERSION, &k); if (k != minor) { printf("%s: minor version mismatch (%d vs. %d)\n", Prog, k, minor); return PIGLIT_FAIL; } return PIGLIT_PASS; }
void piglit_init(int argc, char **argv) { GLint vert[2]; GLint prog; GLboolean ok; piglit_require_gl_version(20); piglit_require_extension("GL_ARB_explicit_attrib_location"); vert[0] = piglit_compile_shader(GL_VERTEX_SHADER, "shaders/glsl-explicit-location-03a.vert"); vert[1] = piglit_compile_shader(GL_VERTEX_SHADER, "shaders/glsl-explicit-location-03b.vert"); prog = glCreateProgram(); glAttachShader(prog, vert[0]); glAttachShader(prog, vert[1]); glLinkProgram(prog); ok = piglit_link_check_status_quiet(prog); if (ok) fprintf(stderr, "Linking with conflicting explicit locations " "succeeded when it should have failed.\n"); piglit_report_result(!ok ? PIGLIT_PASS : PIGLIT_FAIL); }
void piglit_init(int argc, char *argv[]) { piglit_require_gl_version(13); init(); }
void piglit_init(int argc, char **argv) { bool pass = true; GLuint tex, bo; piglit_require_gl_version(20); piglit_require_extension("GL_ARB_texture_buffer_object"); glGenTextures(1, &tex); glGenBuffers(1, &bo); pass = expect(GL_TEXTURE_BINDING_BUFFER, 0) && pass; glBindTexture(GL_TEXTURE_BUFFER, tex); pass = expect(GL_TEXTURE_BINDING_BUFFER, tex) && pass; pass = expect(GL_TEXTURE_BUFFER, 0) && pass; glBindBuffer(GL_TEXTURE_BUFFER, bo); pass = expect(GL_TEXTURE_BUFFER, bo) && pass; pass = expect(GL_TEXTURE_BUFFER_FORMAT_ARB, piglit_is_core_profile ? GL_R8 : GL_LUMINANCE8) && pass; glTexBufferARB(GL_TEXTURE_BUFFER, GL_RGBA8, 0); pass = expect(GL_TEXTURE_BUFFER_FORMAT_ARB, GL_RGBA8) && pass; piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { char *endptr; GLuint vs, fs; /* Interpret command line args */ if (argc != 2) print_usage_and_exit(argv[0]); endptr = argv[1]; additional_offset = strtoul(argv[1], &endptr, 0); if (*endptr != '\0') print_usage_and_exit(argv[0]); if (additional_offset > 12 || additional_offset % 4 != 0) print_usage_and_exit(argv[0]); piglit_require_GLSL_version(130); piglit_require_gl_version(30); piglit_require_transform_feedback(); vs = piglit_compile_shader_text(GL_VERTEX_SHADER, vstext); fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fstext); prog = piglit_CreateProgram(); piglit_AttachShader(prog, vs); piglit_AttachShader(prog, fs); piglit_TransformFeedbackVaryings(prog, 5, varyings, GL_INTERLEAVED_ATTRIBS); piglit_LinkProgram(prog); if (!piglit_link_check_status(prog)) piglit_report_result(PIGLIT_FAIL); glGenBuffers(1, &xfb_buf); if (!piglit_check_gl_error(0)) piglit_report_result(PIGLIT_FAIL); }
void piglit_init(int argc, char **argv) { piglit_require_gl_version(20); piglit_require_extension("GL_NV_conditional_render"); }
void piglit_init(int argc, char **argv) { piglit_require_extension("GL_ARB_framebuffer_object"); piglit_require_gl_version(20); Program = piglit_build_simple_program(NULL, fragShaderText); assert(Program); }
void piglit_init(int argc, char **argv) { piglit_automatic = true; piglit_require_gl_version(20); piglit_require_extension("GL_ARB_timer_query"); }
void piglit_init(int argc, char **argv) { GLint max_samples; int i, num_samples; bool small = false; bool combine_depth_stencil = false; if (argc < 3) print_usage_and_exit(argv[0]); { char *endptr = NULL; num_samples = strtol(argv[1], &endptr, 0); if (endptr != argv[1] + strlen(argv[1])) print_usage_and_exit(argv[0]); } for (i = 3; i < argc; ++i) { if (strcmp(argv[i], "small") == 0) { small = true; } else if (strcmp(argv[i], "depthstencil") == 0) { combine_depth_stencil = true; } else { print_usage_and_exit(argv[0]); } } piglit_require_gl_version(21); piglit_require_extension("GL_ARB_framebuffer_object"); piglit_require_extension("GL_ARB_vertex_array_object"); /* Skip the test if num_samples > GL_MAX_SAMPLES */ glGetIntegerv(GL_MAX_SAMPLES, &max_samples); if (num_samples > max_samples) piglit_report_result(PIGLIT_SKIP); test_type_enum test_type; if (strcmp(argv[2], "color") == 0) { test_type = TEST_TYPE_COLOR; } else if (strcmp(argv[2], "srgb") == 0) { test_type = TEST_TYPE_SRGB; } else if (strcmp(argv[2], "stencil_draw") == 0) { test_type = TEST_TYPE_STENCIL_DRAW; } else if (strcmp(argv[2], "stencil_resolve") == 0) { test_type = TEST_TYPE_STENCIL_RESOLVE; } else if (strcmp(argv[2], "depth_draw") == 0) { test_type = TEST_TYPE_DEPTH_DRAW; } else if (strcmp(argv[2], "depth_resolve") == 0) { test_type = TEST_TYPE_DEPTH_RESOLVE; } else { print_usage_and_exit(argv[0]); } test = create_test(test_type, num_samples, small, combine_depth_stencil, pattern_width, pattern_height, supersample_factor); }