[Piglit] [PATCH 4/4] egl_khr_create_context_profile: Verify that the profile is ignored pre-3.2

Chad Versace chad.versace at linux.intel.com
Wed Oct 10 11:04:18 PDT 2012


On 10/08/2012 04:57 PM, Matt Turner wrote:
> ---
>  tests/all_egl.tests                                |    1 +
>  .../spec/egl_khr_create_context/CMakeLists.gl.txt  |    1 +
>  .../spec/egl_khr_create_context/pre-GL3-profile.c  |  115 ++++++++++++++++++++

I think "pre-GL32-profile" would be a better name for this test. The name
"pre-GL3-profile" is misleading.

>  3 files changed, 117 insertions(+), 0 deletions(-)
>  create mode 100644 tests/egl/spec/egl_khr_create_context/pre-GL3-profile.c
> 
> diff --git a/tests/all_egl.tests b/tests/all_egl.tests
> index cd8a596..655c697 100644
> --- a/tests/all_egl.tests
> +++ b/tests/all_egl.tests
> @@ -36,3 +36,4 @@ create_context['invalid flag GL'] = plain_test('egl-create-context-invalid-flag-
>  create_context['valid forward-compatible flag GL'] = plain_test('egl-create-context-valid-flag-forward-compatible-gl')
>  create_context['invalid profile'] = plain_test('egl-create-context-invalid-profile')
>  create_context['3.2 core profile required'] = plain_test('egl-create-context-core-profile')
> +create_context['pre-GL3 profile'] = plain_test('egl-create-context-pre-GL3-profile')
> diff --git a/tests/egl/spec/egl_khr_create_context/CMakeLists.gl.txt b/tests/egl/spec/egl_khr_create_context/CMakeLists.gl.txt
> index 656291c..7759546 100644
> --- a/tests/egl/spec/egl_khr_create_context/CMakeLists.gl.txt
> +++ b/tests/egl/spec/egl_khr_create_context/CMakeLists.gl.txt
> @@ -25,6 +25,7 @@ piglit_add_executable (egl-create-context-invalid-attribute-gl invalid-attribute
>  piglit_add_executable (egl-create-context-invalid-flag-gles invalid-flag-gles.c common.c)
>  piglit_add_executable (egl-create-context-invalid-flag-gl invalid-flag-gl.c common.c)
>  piglit_add_executable (egl-create-context-invalid-profile invalid-profile.c common.c)
> +piglit_add_executable (egl-create-context-pre-GL3-profile pre-GL3-profile.c common.c)
>  piglit_add_executable (egl-create-context-valid-flag-forward-compatible-gl valid-flag-forward-compatible-gl.c common.c)
>  piglit_add_executable (egl-create-context-core-profile core-profile.c common.c)
>  
> diff --git a/tests/egl/spec/egl_khr_create_context/pre-GL3-profile.c b/tests/egl/spec/egl_khr_create_context/pre-GL3-profile.c
> new file mode 100644
> index 0000000..afea2b3
> --- /dev/null
> +++ b/tests/egl/spec/egl_khr_create_context/pre-GL3-profile.c
> @@ -0,0 +1,115 @@

Again, like patch 2/4, the test needs some brief documentation here at the top
of the file that explains what the test is attempting to verify and how it goes
about it. I suggest something along these lines:

"""
This test verifies that the context profile bit is ignored for GL versions less
than 3.2.

The test iterates over several OpenGL versions less than 3.2. For each version,
the test tries to create a context with no profile specified. If context
creation succeeds, it then verifies that context creation also succeeds with a
core profile specified. If context creation succeeds with the core profile
specified, then the test assumes that the profile bit as correctly ignored
because there exists no core profile for GL versions less then 3.2.

>From the EGL_KHR_create_context spec:

    When the current rendering API is EGL_OPENGL_API, the value of
    EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR requests an OpenGL context
    supporting the corresponding profile... If the requested OpenGL
    version is less than 3.2, EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR is
    ignored and the functionality of the context is determined solely
    by the requested version.
""""

> +#include "piglit-util-gl-common.h"
> +#include "common.h"
> +
> +static bool try_version(int major, int minor)
> +{
> +	EGLContext ctx;
> +
> +	const EGLint attribs_with_profile[] = {
> +		EGL_CONTEXT_MAJOR_VERSION_KHR,
> +		major,
> +
> +		EGL_CONTEXT_MINOR_VERSION_KHR,
> +		minor,
> +
> +		EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR,
> +		EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,
> +
> +		EGL_NONE
> +	};
> +
> +	const EGLint attribs_without_profile[] = {
> +		EGL_CONTEXT_MAJOR_VERSION_KHR,
> +		major,
> +
> +		EGL_CONTEXT_MINOR_VERSION_KHR,
> +		minor,
> +
> +		EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR,
> +		EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR,

Copy-and-paste error. There should be no profile in this array.

> +
> +		EGL_NONE
> +	};
> +



More information about the Piglit mailing list