[Piglit] [PATCH] GL 3.2: Test that GetTexLevelParameterfv() generates an error when passed TEXTURE_BORDER

Ian Romanick idr at freedesktop.org
Tue Oct 1 10:56:16 PDT 2013


On 09/30/2013 04:13 PM, Chad Versace wrote:
> On 09/27/2013 03:07 PM, Nicholas Mack wrote:
>> ---
>>   tests/spec/gl-3.2/CMakeLists.gl.txt           |  1 +
>>   tests/spec/gl-3.2/texture-border-deprecated.c | 63
>> +++++++++++++++++++++++++++
>>   2 files changed, 64 insertions(+)
>>   create mode 100644 tests/spec/gl-3.2/texture-border-deprecated.c
> 
> 
> This needs to get added to all.tests.
> 
> 
> 
>> +
>> +/**
>> + * Test that GetTexLevelParameterfv() generates an error if passed
>> + * TEXTURE_BORDER.
>> + *
>> + * In GL 3.2 core spec section 6.1.3 (Enumerated Queries),
>> TEXTURE_BORDER is not
>> + * included in the list of acceptable targets for
>> GetTexLevelParameterfv()
>> + *
>> + */
> 
> The above comment needs a Doxygen \file command. Like this:
> 
>     /**
>      * \file
>      * Test that blah blah.
>      *
>      * In GL 3.2 there is stuff.
>      */
> 
> Otherwise, Doxygen applies this comment to first following symbol rather
> than
> to the file itself.
> 
>> +
>> +#include "piglit-util-gl-common.h"
>> +
>> +PIGLIT_GL_TEST_CONFIG_BEGIN
>> +
>> +    config.supports_gl_core_version = 32;
>> +    config.supports_gl_compat_version = 32;
> 
> This test verifies behavior that is present *only* in the Core profile. The
> test is invalid for the compatibility profile. So, set
> `support_gl_compat_version = 0`.
> 
>> +
>> +PIGLIT_GL_TEST_CONFIG_END
>> +
>> +enum piglit_result
>> +piglit_display(void)
>> +{
>> +    /* UNREACHED */
>> +    return PIGLIT_FAIL;
>> +}

In cases where this is empty, Paul has suggested that we put it at the
end.  I like that suggestion.

>> +
>> +void
>> +piglit_init(int argc, char **argv)
>> +{
>> +    bool pass = true;
>> +    GLfloat data = -1;
>> +
>> +    glGetTexLevelParameterfv(GL_TEXTURE_2D, 0, GL_TEXTURE_BORDER,
>> &data);
> 
> I don't think it's legal to call this unless a texture is actually bound to
> GL_TEXTURE_2D. But I could be wrong. That is, I think you need this first:
> 
> glGenTextures(1, &tex);
> glBindTexture(GL_TEXTURE_2D, tex);

Correct.

>> +
>> +    if(piglit_check_gl_error(GL_NO_ERROR)) {
>> +        printf("Expected an error but did not recieve any.\n");
>> +        pass = false;
>> +    }
> 
> The specific error expected is GL_INVALID_ENUM.

Yeah, this should be


	if (!piglit_check_gl_error(GL_INVALID_ENUM))
		pass = false;

piglit_check_gl_error will already log a message if a different error is
received.  Also note the space after "if". :)

>> +
>> +    piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
>> +}
>>
> 
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/piglit
> 



More information about the Piglit mailing list