[Piglit] [PATCH 1/2] arb_internalformat_query2: avoid bogus error spam about unsupported pnames
Alejandro Piñeiro
apinheiro at igalia.com
Sat Jan 27 09:47:43 UTC 2018
On 27/01/18 02:20, Roland Scheidegger wrote:
> Am 27.01.2018 um 02:00 schrieb sroland at vmware.com:
>> From: Roland Scheidegger <sroland at vmware.com>
>>
>> The test fed the equivalent_pname into the get_unsupported_response()
>> function, which led to nonsense logged errors as this only recognizes
>> the original pnames.
>> Refactor pname/equivalent_pname translation so always the original pnames
>> are fed into that function.
>> ---
>> tests/spec/arb_internalformat_query2/common.c | 34 +++++++++++++++++++++-
>> .../internalformat-size-checks.c | 23 ++-------------
>> .../internalformat-type-checks.c | 21 ++-----------
>> .../arb_transform_feedback_overflow_query/basic.c | 22 ++++++++++++++
> Err, that last bit obviously doesn't belong in here. Just ignore it...
>
> Roland
As far as only the changes at common.c get included on the patch:
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
>
>
>
>> 4 files changed, 59 insertions(+), 41 deletions(-)
>>
>> diff --git a/tests/spec/arb_internalformat_query2/common.c b/tests/spec/arb_internalformat_query2/common.c
>> index 9fa5fa9d1..5fc4c833b 100644
>> --- a/tests/spec/arb_internalformat_query2/common.c
>> +++ b/tests/spec/arb_internalformat_query2/common.c
>> @@ -496,6 +496,37 @@ create_texture(const GLenum target,
>> }
>> return result;
>> }
>> +
>> +
>> +static GLenum
>> +translate_pname(const GLenum pname)
>> +{
>> + switch (pname) {
>> + case GL_INTERNALFORMAT_RED_TYPE:
>> + case GL_INTERNALFORMAT_GREEN_TYPE:
>> + case GL_INTERNALFORMAT_BLUE_TYPE:
>> + case GL_INTERNALFORMAT_ALPHA_TYPE:
>> + return pname - GL_INTERNALFORMAT_RED_TYPE + GL_TEXTURE_RED_TYPE;
>> + case GL_INTERNALFORMAT_DEPTH_TYPE:
>> + /* case GL_INTERNALFORMAT_STENCIL_TYPE, */
>> + return GL_TEXTURE_DEPTH_TYPE;
>> + case GL_INTERNALFORMAT_RED_SIZE:
>> + case GL_INTERNALFORMAT_GREEN_SIZE:
>> + case GL_INTERNALFORMAT_BLUE_SIZE:
>> + case GL_INTERNALFORMAT_ALPHA_SIZE:
>> + return pname - GL_INTERNALFORMAT_RED_SIZE + GL_TEXTURE_RED_SIZE;
>> + case GL_INTERNALFORMAT_DEPTH_SIZE:
>> + return GL_TEXTURE_DEPTH_SIZE;
>> + case GL_INTERNALFORMAT_STENCIL_SIZE:
>> + return GL_TEXTURE_STENCIL_SIZE;
>> + case GL_INTERNALFORMAT_SHARED_SIZE:
>> + return GL_TEXTURE_SHARED_SIZE;
>> + default:
>> + assert(!"incorrect pname");
>> + return 0;
>> + }
>> +}
>> +
>> /*
>> * Builds a a texture using @target and @internalformat, and compares
>> * the result of calling GetTexLevelParameter using @pname with the
>> @@ -520,6 +551,7 @@ test_data_check_against_get_tex_level_parameter(test_data *data,
>> GLuint tex;
>> GLuint buffer;
>> GLenum real_target = target;
>> + GLenum pname_equiv = translate_pname(pname);
>>
>> result = create_texture(target, internalformat, &tex, &buffer);
>> if (!result)
>> @@ -530,7 +562,7 @@ test_data_check_against_get_tex_level_parameter(test_data *data,
>> if (target == GL_TEXTURE_CUBE_MAP) {
>> real_target = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
>> }
>> - glGetTexLevelParameteriv(real_target, 0, pname, ¶m);
>> + glGetTexLevelParameteriv(real_target, 0, pname_equiv, ¶m);
>> if (!piglit_check_gl_error(GL_NO_ERROR)) {
>> result = false;
>> fprintf(stderr, "\tError calling glGetTexLevelParameter\n");
>> diff --git a/tests/spec/arb_internalformat_query2/internalformat-size-checks.c b/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
>> index bbccbd6d1..928133133 100644
>> --- a/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
>> +++ b/tests/spec/arb_internalformat_query2/internalformat-size-checks.c
>> @@ -53,24 +53,6 @@ static const GLenum pnames[] = {
>> GL_INTERNALFORMAT_SHARED_SIZE,
>> };
>>
>> -/* From spec:
>> - *
>> - * "For textures this query will return the same information
>> - * as querying GetTexLevelParameter{if}v for TEXTURE_*_SIZE
>> - * would return."
>> - *
>> - * The following are the pnames we would need to use when
>> - * calling GetTexLevelParameter (so equivalent to pnames)
>> - */
>> -static const GLenum equivalent_pnames[] = {
>> - GL_TEXTURE_RED_SIZE,
>> - GL_TEXTURE_GREEN_SIZE,
>> - GL_TEXTURE_BLUE_SIZE,
>> - GL_TEXTURE_ALPHA_SIZE,
>> - GL_TEXTURE_DEPTH_SIZE,
>> - GL_TEXTURE_STENCIL_SIZE,
>> - GL_TEXTURE_SHARED_SIZE,
>> -};
>>
>> enum piglit_result
>> piglit_display(void)
>> @@ -102,7 +84,6 @@ static bool
>> try_textures_size(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;
>> @@ -128,7 +109,7 @@ try_textures_size(const GLenum *targets, unsigned num_targets,
>> value_test = supported ?
>> test_data_check_against_get_tex_level_parameter(data,
>> targets[i],
>> - equivalent_pname,
>> + pname,
>> internalformats[j]) :
>> test_data_is_unsupported_response(data, pname);
>>
>> @@ -168,7 +149,7 @@ check_textures_size(void)
>>
>> pass = try_textures_size(texture_targets, ARRAY_SIZE(texture_targets),
>> valid_internalformats, ARRAY_SIZE(valid_internalformats),
>> - pnames[i], equivalent_pnames[i],
>> + pnames[i],
>> data)
>> && pass;
>> }
>> diff --git a/tests/spec/arb_internalformat_query2/internalformat-type-checks.c b/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
>> index e2d739424..c6e46f504 100644
>> --- a/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
>> +++ b/tests/spec/arb_internalformat_query2/internalformat-type-checks.c
>> @@ -53,22 +53,6 @@ static const GLenum pnames[] = {
>> /* GL_INTERNALFORMAT_STENCIL_TYPE, */
>> };
>>
>> -/* From spec:
>> - *
>> - * "For textures this query will return the same information
>> - * as querying GetTexLevelParameter{if}v for TEXTURE_*_TYPE
>> - * would return."
>> - *
>> - * The following are the pnames we would need to use when
>> - * calling GetTexLevelParameter (so equivalent to pnames)
>> - */
>> -static const GLenum equivalent_pnames[] = {
>> - GL_TEXTURE_RED_TYPE,
>> - GL_TEXTURE_GREEN_TYPE,
>> - GL_TEXTURE_BLUE_TYPE,
>> - GL_TEXTURE_ALPHA_TYPE,
>> - GL_TEXTURE_DEPTH_TYPE,
>> -};
>>
>> /* From spec:
>> *
>> @@ -120,7 +104,6 @@ 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;
>> @@ -151,7 +134,7 @@ try_textures_type(const GLenum *targets, unsigned num_targets,
>> value_test = value_test &&
>> test_data_check_against_get_tex_level_parameter(data,
>> targets[i],
>> - equivalent_pname,
>> + pname,
>> internalformats[j]);
>> }
>>
>> @@ -184,7 +167,7 @@ check_textures_type(void)
>>
>> pass = try_textures_type(texture_targets, ARRAY_SIZE(texture_targets),
>> valid_internalformats, ARRAY_SIZE(valid_internalformats),
>> - pnames[i], equivalent_pnames[i],
>> + pnames[i],
>> data)
>> && pass;
>> }
>> diff --git a/tests/spec/arb_transform_feedback_overflow_query/basic.c b/tests/spec/arb_transform_feedback_overflow_query/basic.c
>> index 017335c98..3fdbc34ee 100644
>> --- a/tests/spec/arb_transform_feedback_overflow_query/basic.c
>> +++ b/tests/spec/arb_transform_feedback_overflow_query/basic.c
>> @@ -450,6 +450,22 @@ test_no_overflow_stream_any(void *test_data)
>> test_data);
>> }
>>
>> +/**
>> + * No overflow.
>> + * Query for overflow on any stream.
>> + * inverted = true, expected overflow: false.
>> + */
>> +static enum piglit_result
>> +test_no_overflow_stream_any_inverted(void *test_data)
>> +{
>> + GLuint query_type = GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB;
>> + int array_sizes[] = { 6, 6 };
>> +
>> + return run_subtest(2, array_sizes, 0, query_type, true, false,
>> + test_data);
>> +}
>> +
>> +
>>
>> const struct piglit_subtest overflow_query_subtests[] = {
>> {
>> @@ -555,6 +571,12 @@ const struct piglit_subtest overflow_query_subtests[] = {
>> "conditional_render"
>> },
>> {
>> + "arb_transform_feedback_overflow_query-conditional_render_no_overflow_inverted",
>> + "arb_transform_feedback_overflow_query-conditional_render_no_overflow_inverted",
>> + test_no_overflow_stream_any_inverted,
>> + "conditional_render"
>> + },
>> + {
>> "arb_transform_feedback_overflow_query-buffer_object_0",
>> "arb_transform_feedback_overflow_query-buffer_object_0",
>> test_overflow_stream_0,
>>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
More information about the Piglit
mailing list