[Piglit] [PATCH 3/3] arb_internalformat_query2: test new ARB_es3_compatibility internalformats

Antia Puentes apuentes at igalia.com
Tue May 8 12:43:28 UTC 2018


On 06/05/18 11:42, Alejandro PiƱeiro wrote:

> ARB_es3_compatibility add several compressed (and specific)
Use the official name of the extension: ARB_ES3_compatibility. Same for 
the subject.
> 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.
> ---
>
> In order to get the tests properly passing, this needs the mesa patch
> that I have sent to mesa-dev:
>
> https://lists.freedesktop.org/archives/mesa-dev/2018-May/194175.html
> "mesa/formatquery: remove online compression check on is_resource_supported"
>
>   tests/spec/arb_internalformat_query2/common.c      | 29 +++++++++++++++++++++
>   tests/spec/arb_internalformat_query2/common.h      | 30 ++++++++++++++++++++--
>   tests/spec/arb_internalformat_query2/filter.c      |  2 +-
>   .../arb_internalformat_query2/format-components.c  | 13 +++++++++-
>   .../generic-pname-checks.c                         |  3 ++-
>   .../image-format-compatibility-type.c              |  3 ++-
>   .../spec/arb_internalformat_query2/image-texture.c |  1 +
>   .../internalformat-size-checks.c                   |  3 ++-
>   .../internalformat-type-checks.c                   |  3 ++-
>   .../arb_internalformat_query2/max-dimensions.c     |  7 ++---
>   tests/spec/arb_internalformat_query2/minmax.c      |  1 +
>   .../arb_internalformat_query2/samples-pnames.c     |  5 ++--
>   .../texture-compressed-block.c                     |  3 ++-
>   13 files changed, 89 insertions(+), 14 deletions(-)
>
> diff --git a/tests/spec/arb_internalformat_query2/common.c b/tests/spec/arb_internalformat_query2/common.c
> index 204149936..8f7fffe81 100644
> --- a/tests/spec/arb_internalformat_query2/common.c
> +++ b/tests/spec/arb_internalformat_query2/common.c
> @@ -1063,3 +1063,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;
> +        }
> +}
> diff --git a/tests/spec/arb_internalformat_query2/common.h b/tests/spec/arb_internalformat_query2/common.h
> index df6858101..d7d5470ed 100644
> --- a/tests/spec/arb_internalformat_query2/common.h
> +++ b/tests/spec/arb_internalformat_query2/common.h
> @@ -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,26 @@ static const GLenum valid_internalformats[] = {
>           GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT,
>   };
>   
> +/*
> + * Below the new internalformats added by ARB_es3_compatibility, core
s/ARB_es3_compatibility/ARB_ES3_compatibility
> + * since 4.3. You can find those format at Spec 4.3 Table 8.14
> + */
s/format/formats
> +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 +384,5 @@ bool create_texture(const GLenum target,
>                       const GLenum internalformat,
>                       GLuint *tex_out,
>                       GLuint *buffer_out);
> +
> +void initialize_valid_internalformats();
> diff --git a/tests/spec/arb_internalformat_query2/filter.c b/tests/spec/arb_internalformat_query2/filter.c
> index 502eea94c..c7b8534d9 100644
> --- a/tests/spec/arb_internalformat_query2/filter.c
> +++ b/tests/spec/arb_internalformat_query2/filter.c
> @@ -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;
>           }
> diff --git a/tests/spec/arb_internalformat_query2/format-components.c b/tests/spec/arb_internalformat_query2/format-components.c
> index a484e01f2..70ba7dc2f 100644
> --- a/tests/spec/arb_internalformat_query2/format-components.c
> +++ b/tests/spec/arb_internalformat_query2/format-components.c
> @@ -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;
> diff --git a/tests/spec/arb_internalformat_query2/generic-pname-checks.c b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
> index e521fac31..bd44da038 100644
> --- a/tests/spec/arb_internalformat_query2/generic-pname-checks.c
> +++ b/tests/spec/arb_internalformat_query2/generic-pname-checks.c
> @@ -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;
> diff --git a/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c b/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c
> index 81a8dc4d0..b02ac15ca 100644
> --- a/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c
> +++ b/tests/spec/arb_internalformat_query2/image-format-compatibility-type.c
> @@ -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 ,
Extra space before the comma.
>                                    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;
>   
> diff --git a/tests/spec/arb_internalformat_query2/image-texture.c b/tests/spec/arb_internalformat_query2/image-texture.c
> index 8bf6429b3..250d37b3b 100644
> --- a/tests/spec/arb_internalformat_query2/image-texture.c
> +++ b/tests/spec/arb_internalformat_query2/image-texture.c
> @@ -262,6 +262,7 @@ piglit_init(int argc, char **argv)
>           bool pass = true;
>   
>           piglit_require_extension("GL_ARB_internalformat_query2");
> +        initialize_valid_internalformats();
Unneeded initialization? I do not see where valid_internalformats is 
being used by this test.
>   
>           pass =  check_image_texture()
>                   && pass;
> diff --git a/tests/spec/arb_internalformat_query2/internalformat-size-checks.c b/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
> index 928133133..ca96287cd 100644
> --- a/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
> +++ b/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
> @@ -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;
> diff --git a/tests/spec/arb_internalformat_query2/internalformat-type-checks.c b/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
> index c6e46f504..038506bca 100644
> --- a/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
> +++ b/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
> @@ -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;
> diff --git a/tests/spec/arb_internalformat_query2/max-dimensions.c b/tests/spec/arb_internalformat_query2/max-dimensions.c
> index 72ec358ba..50190d56d 100644
> --- a/tests/spec/arb_internalformat_query2/max-dimensions.c
> +++ b/tests/spec/arb_internalformat_query2/max-dimensions.c
> @@ -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;
> diff --git a/tests/spec/arb_internalformat_query2/minmax.c b/tests/spec/arb_internalformat_query2/minmax.c
> index 2571e3b21..b07dcb2ea 100644
> --- a/tests/spec/arb_internalformat_query2/minmax.c
> +++ b/tests/spec/arb_internalformat_query2/minmax.c
> @@ -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) {
> diff --git a/tests/spec/arb_internalformat_query2/samples-pnames.c b/tests/spec/arb_internalformat_query2/samples-pnames.c
> index 42c18d9de..3aaae1742 100644
> --- a/tests/spec/arb_internalformat_query2/samples-pnames.c
> +++ b/tests/spec/arb_internalformat_query2/samples-pnames.c
> @@ -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 ,
Unneeded extra space before a comma.
>                              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;
> diff --git a/tests/spec/arb_internalformat_query2/texture-compressed-block.c b/tests/spec/arb_internalformat_query2/texture-compressed-block.c
> index 9a5e96c20..ce46e6ecd 100644
> --- a/tests/spec/arb_internalformat_query2/texture-compressed-block.c
> +++ b/tests/spec/arb_internalformat_query2/texture-compressed-block.c
> @@ -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 ,
Another extra space before a comma.
>                                            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;



More information about the Piglit mailing list