static void fill_data_and_copy(test_data *data, test_data *data_copy) { unsigned i; for (i = 0; i < test_data_get_params_size(data); i++) { /* It seems very unlikely that an implementation will * support 0xDEADBEEF samples*/ test_data_set_value_at_index(data, i, 0xDEADBEEF); test_data_set_value_at_index(data_copy, i, 0xDEADBEEF); } }
static bool check_params_unmodified(test_data *data, test_data *data_copy) { unsigned i; bool result; for (i = 0; i < test_data_get_params_size(data); i++) { result = test_data_equal_at_index(data, data_copy, i); if (!result) break; } 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; }