/* 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; }
/* * Returns if @target/@internalformat is supported using * INTERNALFORMAT_SUPPORTED for @target and @internalformat. * * @data is only used to known if we are testing the 32-bit or the * 64-bit query, so the content of @data will not be modified due this * call. */ bool test_data_check_supported(const test_data *data, const GLenum target, const GLenum internalformat) { bool result; test_data *local_data = test_data_new(data->testing64, 1); test_data_execute(local_data, target, internalformat, GL_INTERNALFORMAT_SUPPORTED); if (!piglit_check_gl_error(GL_NO_ERROR)) result = false; else result = test_data_value_at_index(local_data, 0) == GL_TRUE; test_data_clear(&local_data); return result; }
static bool real_try(GLenum target, GLenum format, GLint max_samples, const char *max_samples_name, test_data *data_counts, test_data *data_samples) { bool pass = true; int buffer_size_in_elements = 0; unsigned i; GLint previous; test_data_set_params_size(data_counts, 1); test_data_execute(data_counts, target, format, GL_NUM_SAMPLE_COUNTS); buffer_size_in_elements = test_data_value_at_index(data_counts, 0); pass = piglit_check_gl_error(0) && pass; /* The GL_ARB_internalformat_query spec says: * * "Add new table 6.X Internalformat-specific * Implementation Dependent Values after 6.52" * * Minimum * Get Value Type Get Command Value * --------- ---- ----------- ------- * SAMPLES 0*xZ+ GetInternalformativ fn1 * NUM_SAMPLE_COUNTS Z+ GetInternalformativ 1 * * fn1: see section 6.X." */ if (buffer_size_in_elements < 1) { ERROR_HEADER(data_counts); fprintf(stderr, "GL_NUM_SAMPLE_COUNTS is %d for %s/%s\n", buffer_size_in_elements, piglit_get_gl_enum_name(target), piglit_get_gl_enum_name(format)); return false; } test_data_set_params_size(data_samples, buffer_size_in_elements); /* Try GL_SAMPLES */ test_data_execute(data_samples, target, format, GL_SAMPLES); pass = piglit_check_gl_error(0) && pass; /* The GL_ARB_internalformat_query spec says: * * "- SAMPLES: The sample counts supported for this * <format> and <target> are written into <params>, in * descending order. Only positive values are * returned." * * We take "positive" to mean greater than zero. Zero isn't a * valid sample count for multisampling. It's the special * value used to request non-multisampling. */ previous = INT_MAX; for (i = 0; i < test_data_get_params_size(data_samples); i++) { if (test_data_value_at_index(data_samples, i) <= 0) { ERROR_HEADER(data_samples); fprintf(stderr, "Invalid sample count [%u] = %" PRIi64 " returned " "for %s/%s (num sample counts = %i)\n", i, test_data_value_at_index(data_samples, i), piglit_get_gl_enum_name(target), piglit_get_gl_enum_name(format), buffer_size_in_elements); pass = false; } if (previous == test_data_value_at_index(data_samples, i)) { ERROR_HEADER(data_samples); fprintf(stderr, "Duplicate values [%u] = [%u] = %" PRIi64 " returned " "for %s/%s (num sample counts = %i)\n", i - 1, i, test_data_value_at_index(data_samples, i), piglit_get_gl_enum_name(target), piglit_get_gl_enum_name(format), buffer_size_in_elements); pass = false; } if (previous < test_data_value_at_index(data_samples, i)) { ERROR_HEADER(data_samples); fprintf(stderr, "Values not in descending order " "([%u] = %d) < ([%u] = %" PRIi64 ") returned " "for %s/%s (num sample counts = %i)\n", i - 1, previous, i, test_data_value_at_index(data_samples, i), piglit_get_gl_enum_name(target), piglit_get_gl_enum_name(format), buffer_size_in_elements); pass = false; } previous = test_data_value_at_index(data_samples, i); } /* The GL_ARB_internalformat_query spec says: * * "The maximum value in SAMPLES is guaranteed to be at * least the lowest of the following: * * - The value of GetIntegerv(MAX_INTEGER_SAMPLES), if * <internalformat> is a signed or unsigned integer format. * - The value of GetIntegerv(MAX_DEPTH_TEXTURE_SAMPLES), if * <internalformat> is a depth/stencil-renderable format and * <target> is TEXTURE_2D_MULTISAMPLE or * TEXTURE_2D_MULTISAMPLE_ARRAY. * - The value of GetIntegerv(MAX_COLOR_TEXTURE_SAMPLES), if * <internalformat> is a color-renderable format and <target> * is TEXTURE_2D_MULTISAMPLE or TEXTURE_2D_MULTISAMPLE_ARRAY. * - The value of GetIntegerv(MAX_SAMPLES)." * * Separate tests will verify the values for GL_MAX_*_SAMPLES. */ if (test_data_value_at_index(data_samples, 0) < max_samples) { ERROR_HEADER(data_samples); fprintf(stderr, "GL_SAMPLES (%" PRIi64 ") smaller than %s (%d) " "for %s/%s\n", test_data_value_at_index(data_samples, 0), max_samples_name, max_samples, piglit_get_gl_enum_name(target), piglit_get_gl_enum_name(format)); pass = false; } return pass; }