static bool is_resource_supported(const test_data *data, const GLenum pname, const GLenum target, const GLenum internalformat) { GLuint tex; GLuint buffer; if (!check_query2_dependencies(pname, target)) return false; if (!test_data_check_supported(data, target, internalformat)) return false; if (target == GL_RENDERBUFFER) return is_supported_renderbuffer(target, internalformat); if (!create_texture(target, internalformat, &tex, &buffer)) return false; glDeleteTextures(1, &tex); glDeleteBuffers(1, &buffer); return true; }
/* * Prints the info of a failing case. If expected_value is smaller * that 0, it is not printed. */ void print_failing_case_full(const GLenum target, const GLenum internalformat, const GLenum pname, GLint64 expected_value, test_data *data) { /* Knowing if it is supported is interesting in order to know * if the test is being too restrictive */ bool supported = test_data_check_supported(data, target, internalformat); GLint64 current_value = test_data_value_at_index(data, 0); if (data->testing64) { fprintf(stderr, " 64 bit failing case: "); } else { fprintf(stderr, " 32 bit failing case: "); } fprintf(stderr, "pname = %s, " "target = %s, internalformat = %s, ", piglit_get_gl_enum_name(pname), piglit_get_gl_enum_name(target), piglit_get_gl_enum_name(internalformat)); if (expected_value >= 0) fprintf(stderr, "expected value = (%" PRIi64 "), ", expected_value); fprintf(stderr, "params[0] = (%" PRIi64 ",%s), " "supported=%i\n", current_value, piglit_get_gl_enum_name(current_value), supported); }
/* Equivalent to common:try_basic, but also checking that the * well-known cases that doesn't support multi-texel filtering is not * supported.*/ bool try_local(const GLenum *targets, unsigned num_targets, const GLenum *internalformats, unsigned num_internalformats, const GLenum pname, test_data *data) { bool pass = true; unsigned i; unsigned j; static const GLint possible_values[] = { GL_NONE, GL_CAVEAT_SUPPORT, GL_FULL_SUPPORT, }; for (i = 0; i < num_targets; i++) { for (j = 0; j < num_internalformats; j++) { bool error_test; bool value_test = true; bool supported; supported = check_query2_dependencies(pname, targets[i]) && test_data_check_supported(data, targets[i], internalformats[j]); test_data_execute(data, targets[i], internalformats[j], pname); error_test = piglit_check_gl_error(GL_NO_ERROR); if (!supported || !is_multi_texel_filtering_supported(targets[i], internalformats[j])) { value_test = test_data_is_unsupported_response(data, pname); } else { value_test = test_data_check_possible_values(data, possible_values, ARRAY_SIZE(possible_values)); } if (error_test && value_test) continue; /* If we are here, the test is failing */ print_failing_case(targets[i], internalformats[j], pname, data); if (!value_test) print_failing_details(targets[i], internalformats[j]); pass = false; } } return pass; }
/* From the spec: * * "- IMAGE_FORMAT_COMPATIBILITY_TYPE: The matching criteria use for * the resource when used as an image textures is returned in * <params>. This is equivalent to calling GetTexParameter with * <value> set to IMAGE_FORMAT_COMPATIBILITY_TYPE. Possible values * are IMAGE_FORMAT_COMPATIBILITY_BY_SIZE or * IMAGE_FORMAT_COMPATIBILITY_BY_CLASS. If the resource is not * supported for image textures, or if image textures are not * supported, NONE is returned." * * So try_local is equivalent to try_basic, except that instead of * checking against a list of possible value, we test against the * value returned by GetTexParameter, or against GL_NONE if not * supported of if it is not a texture. */ bool try_local(const GLenum *targets, unsigned num_targets, const GLenum *internalformats, unsigned num_internalformats, const GLenum pname, test_data *data) { bool pass = true; unsigned i; unsigned j; GLint param; for (i = 0; i < num_targets; i++) { for (j = 0; j < num_internalformats; j++) { bool error_test; bool value_test; bool supported; bool is_texture; supported = check_query2_dependencies(pname, targets[i]) && test_data_check_supported(data, targets[i], internalformats[j]); test_data_execute(data, targets[i], internalformats[j], pname); error_test = piglit_check_gl_error(GL_NO_ERROR); is_texture = value_on_set((const GLint*)texture_targets, ARRAY_SIZE(texture_targets), (GLint) targets[i]); if (is_texture && supported) { param = get_tex_parameter_value(targets[i], internalformats[j]); error_test = error_test && piglit_check_gl_error(GL_NO_ERROR); value_test = test_data_value_at_index(data, 0) == param; } else { value_test = test_data_is_unsupported_response(data, pname); } if (error_test && value_test) continue; print_failing_case(targets[i], internalformats[j], pname, data); pass = false; } } return pass; }
/* * From spec: * * - INTERNALFORMAT_{X}_TYPE * * For uncompressed internal formats, queries for these values return * the data type used to store the component. * For compressed internal formats the types returned specify how * components are interpreted after decompression. * For textures this query returns the same information as querying * GetTexLevelParameter{if}v for TEXTURE_*TYPE would return. Possible * values return include, NONE, SIGNED_NORMALIZED, * UNSIGNED_NORMALIZED, FLOAT, INT, UNSIGNED_INT, representing * missing, signed normalized fixed point, unsigned normalized fixed * point, floating-point, signed unnormalized integer and unsigned * unnormalized integer components. NONE is returned for all component * types if the format is unsupported. * * So try_textures_size check if it is 0 when not supported, and that * the returned value is on that list of possible values and the same * that the one returned by GetTextLevelParameter when supported. */ static bool try_textures_type(const GLenum *targets, unsigned num_targets, const GLenum *internalformats, unsigned num_internalformats, const GLenum pname, const GLenum equivalent_pname, test_data *data) { bool pass = true; unsigned i; unsigned j; for (i = 0; i < num_targets; i++) { for (j = 0; j < num_internalformats; j++) { bool error_test; bool value_test; bool supported; supported = check_query2_dependencies(pname, targets[i]) && test_data_check_supported(data, targets[i], internalformats[j]); test_data_execute(data, targets[i], internalformats[j], pname); error_test = piglit_check_gl_error(GL_NO_ERROR); if (!supported) { value_test = test_data_is_unsupported_response(data, pname); } else { value_test = test_data_check_possible_values(data, possible_values, ARRAY_SIZE(possible_values)); value_test = value_test && test_data_check_against_get_tex_level_parameter(data, targets[i], equivalent_pname, internalformats[j]); } if (error_test && value_test) continue; print_failing_case(targets[i], internalformats[j], pname, data); pass = false; } } return pass; }
/* * The most basic condition. From spec, a lot of pnames has a * condition like this: * * "Possible values returned are <set>. If the resource is not * supported, or if the operation is not supported, NONE is * returned." * * So this method, calls the callback defined at @data (that should be * GetInternalformativ or GetInternalformati64v) using @pname, for all * @num_targets at @targets, and all @num_internalformats at * @internalformats, and checks the following conditions: * * * If @pname is not supported (calling INTERNALFORMAT_SUPPORTED), * checks that the value returned is always the same. * * If @pname is supported, checks that the returned value is among * one of the values defined at @possible_values * * @possible_values,@num_possible_values is allowed to be NULL,0, for * the cases where the set of returned values is not specified in * detail by the spec (like INTERNALFORMAT_PREFERRED). On that case, * it is not tested the returned value, and just tested that if not * suppported, the returned value is the usupported value defined by * the spec. * */ bool try_basic(const GLenum *targets, unsigned num_targets, const GLenum *internalformats, unsigned num_internalformats, const GLenum pname, const GLint *possible_values, unsigned num_possible_values, test_data *data) { bool pass = true; unsigned i; unsigned j; for (i = 0; i < num_targets; i++) { for (j = 0; j < num_internalformats; j++) { bool error_test; bool value_test; bool supported; supported = check_query2_dependencies(pname, targets[i]) && test_data_check_supported(data, targets[i], internalformats[j]); test_data_execute(data, targets[i], internalformats[j], pname); if (supported && num_possible_values == 0) continue; error_test = piglit_check_gl_error(GL_NO_ERROR); value_test = supported ? test_data_check_possible_values(data, possible_values, num_possible_values) : test_data_is_unsupported_response(data, pname); if (error_test && value_test) continue; print_failing_case(targets[i], internalformats[j], pname, data); pass = false; } } return pass; }