Commit 1e60f149 authored by Alejandro Piñeiro's avatar Alejandro Piñeiro

arb_internalformat_query2: test new ARB_ES3_compatibility internalformats

ARB_ES_compatibility add several compressed (and specific)
internalformats. Those become part of 4.3.

We try to be smart and only try them if the extension is available. In
order to do that we differentiate the base (list of internalformats
available when the extension was defined) and es3_compatibility
formats, and concatenate to test them all only if needed.
Reviewed-by: Antía Puentes's avatarAntia Puentes <apuentes@igalia.com>
parent 2658ae77
......@@ -1064,3 +1064,32 @@ test_data_get_params_size(test_data *data)
{
return data->params_size;
}
void
initialize_valid_internalformats()
{
if (piglit_get_gl_version() == 43 ||
piglit_is_extension_supported("GL_ARB_ES3_compatibility")) {
unsigned i, j;
num_valid_internalformats = ARRAY_SIZE(base_valid_internalformats) +
ARRAY_SIZE(arb_es3_compatibility_valid_internalformats);
valid_internalformats = malloc(sizeof(GLenum) *
num_valid_internalformats);
for (i = 0; i < ARRAY_SIZE(base_valid_internalformats); i++) {
valid_internalformats[i] = base_valid_internalformats[i];
}
for (i = ARRAY_SIZE(base_valid_internalformats), j = 0;
i < num_valid_internalformats; i++, j++) {
valid_internalformats[i] =
arb_es3_compatibility_valid_internalformats[j];
}
} else {
num_valid_internalformats = ARRAY_SIZE(base_valid_internalformats);
valid_internalformats = (GLenum *) base_valid_internalformats;
}
}
......@@ -168,7 +168,11 @@ static const GLenum invalid_pnames[] = {
GL_TEXTURE_COMPONENTS,
};
/* From spec:
/*
* The following are the valid internalformats defined when the spec
* was written (at 4.2).
*
* From spec:
*
* "INTERNALFORMAT_SUPPORTED:
* <skip>
......@@ -184,7 +188,7 @@ static const GLenum invalid_pnames[] = {
* - unsized or base internal format, if the implementation accepts
* it for texture or image specification."
*/
static const GLenum valid_internalformats[] = {
static const GLenum base_valid_internalformats[] = {
/* Base/unsized internal format (from Table 3.11) */
GL_DEPTH_COMPONENT,
GL_DEPTH_STENCIL,
......@@ -279,6 +283,27 @@ static const GLenum valid_internalformats[] = {
GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT,
};
/*
* Below the new internalformats added by ARB_ES3_compatibility, core
* since 4.3. You can find those internalformats at Spec 4.3 Table
* 8.14
*/
static const GLenum arb_es3_compatibility_valid_internalformats[] = {
GL_COMPRESSED_RGB8_ETC2,
GL_COMPRESSED_SRGB8_ETC2,
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
GL_COMPRESSED_RGBA8_ETC2_EAC,
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
GL_COMPRESSED_R11_EAC,
GL_COMPRESSED_SIGNED_R11_EAC,
GL_COMPRESSED_RG11_EAC,
GL_COMPRESSED_SIGNED_RG11_EAC,
};
GLenum *valid_internalformats;
unsigned num_valid_internalformats;
typedef struct _test_data test_data;
test_data* test_data_new(int testing64,
......@@ -360,3 +385,5 @@ bool create_texture(const GLenum target,
const GLenum internalformat,
GLuint *tex_out,
GLuint *buffer_out);
void initialize_valid_internalformats();
......@@ -218,7 +218,7 @@ check_filter()
for (testing64 = 0; testing64 <= 1; testing64++) {
test_data_set_testing64(data, testing64);
pass = try_local(valid_targets, ARRAY_SIZE(valid_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
GL_FILTER, data)
&& pass;
}
......
......@@ -139,6 +139,16 @@ is_color_format(GLenum internalformat)
case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
case GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT:
case GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT:
case GL_COMPRESSED_RGB8_ETC2:
case GL_COMPRESSED_SRGB8_ETC2:
case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
case GL_COMPRESSED_RGBA8_ETC2_EAC:
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
case GL_COMPRESSED_R11_EAC:
case GL_COMPRESSED_SIGNED_R11_EAC:
case GL_COMPRESSED_RG11_EAC:
case GL_COMPRESSED_SIGNED_RG11_EAC:
return GL_TRUE;
default:
return GL_FALSE;
......@@ -252,7 +262,7 @@ check_format_components(void)
test_data_set_testing64(data, testing64);
pass = try(valid_targets, ARRAY_SIZE(valid_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
pnames[i], data)
&& pass;
}
......@@ -274,6 +284,7 @@ piglit_init(int argc, char **argv)
bool pass = true;
piglit_require_extension("GL_ARB_internalformat_query2");
initialize_valid_internalformats();
pass = check_format_components()
&& pass;
......
......@@ -263,7 +263,7 @@ check_basic(const GLenum *pnames, unsigned num_pnames,
test_data_set_testing64(data, testing64);
pass = try_basic(valid_targets, ARRAY_SIZE(valid_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
pnames[i],
possible_values, num_possible_values,
data)
......@@ -288,6 +288,7 @@ piglit_init(int argc, char **argv)
GLenum pname;
piglit_require_extension("GL_ARB_internalformat_query2");
initialize_valid_internalformats();
pname = GL_INTERNALFORMAT_PREFERRED;
pass = check_basic(&pname, 1, NULL, 0) && pass;
......
......@@ -165,7 +165,7 @@ check_format_compatibility_type(void)
test_data_set_testing64(data, testing64);
pass = try_local(valid_targets, ARRAY_SIZE(valid_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
GL_IMAGE_FORMAT_COMPATIBILITY_TYPE,
data)
&& pass;
......@@ -185,6 +185,7 @@ piglit_init(int argc, char **argv)
bool pass = true;
piglit_require_extension("GL_ARB_internalformat_query2");
initialize_valid_internalformats();
pass = check_format_compatibility_type() && pass;
......
......@@ -148,7 +148,7 @@ check_textures_size(void)
test_data_set_testing64(data, testing64);
pass = try_textures_size(texture_targets, ARRAY_SIZE(texture_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
pnames[i],
data)
&& pass;
......@@ -170,6 +170,7 @@ piglit_init(int argc, char **argv)
bool pass = true;
piglit_require_extension("GL_ARB_internalformat_query2");
initialize_valid_internalformats();
pass = check_textures_size()
&& pass;
......
......@@ -166,7 +166,7 @@ check_textures_type(void)
test_data_set_testing64(data, testing64);
pass = try_textures_type(texture_targets, ARRAY_SIZE(texture_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
pnames[i],
data)
&& pass;
......@@ -188,6 +188,7 @@ piglit_init(int argc, char **argv)
bool pass = true;
piglit_require_extension("GL_ARB_internalformat_query2");
initialize_valid_internalformats();
pass = check_textures_type()
&& pass;
......
......@@ -347,7 +347,7 @@ check_max_dimension(const GLenum pname,
test_data_set_testing64(data, testing64);
pass = try(valid_targets, ARRAY_SIZE(valid_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
pname, min_dimensions, data)
&& pass;
}
......@@ -509,7 +509,7 @@ check_max_layers()
test_data_set_testing64(data, testing64);
pass = try_max_layers(valid_targets, ARRAY_SIZE(valid_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
data)
&& pass;
}
......@@ -668,7 +668,7 @@ check_max_combined_dimensions()
test_data_set_testing64(data, testing64);
pass = try_max_combined_dimensions(valid_targets, ARRAY_SIZE(valid_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
data)
&& pass;
}
......@@ -685,6 +685,7 @@ piglit_init(int argc, char **argv)
bool pass = true;
piglit_require_extension("GL_ARB_internalformat_query2");
initialize_valid_internalformats();
pass = check_max_dimension(GL_MAX_WIDTH, 1) && pass;
pass = check_max_dimension(GL_MAX_HEIGHT, 2) && pass;
......
......@@ -291,6 +291,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_framebuffer_object");
piglit_require_extension("GL_ARB_internalformat_query2");
initialize_valid_internalformats();
/* Need GL 3 or extensions to support the valid_formats[] above */
if (piglit_get_gl_version() < 30) {
......
......@@ -238,7 +238,7 @@ check_num_sample_counts(void)
* returned.
*/
pass = try(without_multisample_targets, ARRAY_SIZE(without_multisample_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
GL_NUM_SAMPLE_COUNTS, data)
&& pass;
}
......@@ -296,7 +296,7 @@ check_samples(void)
*/
pass = try(without_multisample_targets, ARRAY_SIZE(without_multisample_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
GL_SAMPLES, data)
&& pass;
}
......@@ -316,6 +316,7 @@ piglit_init(int argc, char **argv)
piglit_require_extension("GL_ARB_framebuffer_object");
piglit_require_extension("GL_ARB_internalformat_query2");
initialize_valid_internalformats();
pass = check_num_sample_counts() && pass;
pass = check_samples() && pass;
......
......@@ -173,7 +173,7 @@ check_texture_compressed_block(const GLenum *pnames, unsigned num_pnames)
for (testing64 = 0; testing64 <= 1; testing64++) {
test_data_set_testing64(data, testing64);
pass = try_local(valid_targets, ARRAY_SIZE(valid_targets),
valid_internalformats, ARRAY_SIZE(valid_internalformats),
valid_internalformats, num_valid_internalformats,
pnames[i], data)
&& pass;
}
......@@ -195,6 +195,7 @@ piglit_init(int argc, char **argv)
bool pass = true;
piglit_require_extension("GL_ARB_internalformat_query2");
initialize_valid_internalformats();
pass = check_texture_compressed_block(pnames, ARRAY_SIZE(pnames))
&& pass;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment