[2/4] util, shader_runner: random fixes for compatibility profile

Submitted by Marek Olšák on Oct. 21, 2017, 12:55 p.m.

Details

Message ID 1508590505-4715-2-git-send-email-maraeo@gmail.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Piglit

Not browsing as part of any series.

Commit Message

Marek Olšák Oct. 21, 2017, 12:55 p.m.
From: Marek Olšák <marek.olsak@amd.com>

---
 tests/shaders/shader_runner.c                         | 2 +-
 tests/util/piglit-framework-gl/piglit_wfl_framework.c | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 625521c..31bd315 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2786,21 +2786,21 @@  program_must_be_in_use(void)
 	} else if (!prog_in_use) {
 		fprintf(stderr, "Failed to use program: %s\n", prog_err_info);
 		return PIGLIT_FAIL;
 	}
 	return PIGLIT_PASS;
 }
 
 static void
 bind_vao_if_supported()
 {
-	if (vao == 0 && gl_version.num >= 31) {
+	if (vao == 0 && piglit_is_core_profile) {
 		glGenVertexArrays(1, &vao);
 		glBindVertexArray(vao);
 	}
 }
 
 static enum piglit_result
 draw_arrays_common(int first, size_t count)
 {
 	enum piglit_result result = program_must_be_in_use();
 	if (first < 0) {
diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
index 5968459..20b9c45 100644
--- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
@@ -533,21 +533,26 @@  make_context_current(struct piglit_wfl_framework *wfl_fw,
 {
 	bool ok = false;
 
 #if defined(PIGLIT_USE_OPENGL)
 
 	if (test_config->supports_gl_core_version) {
 		ok = make_context_current_singlepass(wfl_fw, test_config,
 		                                     CONTEXT_GL_CORE,
 		                                     partial_config_attrib_list);
 		if (ok) {
-			piglit_is_core_profile = true;
+			/* OpenGL 3.1 is special. It doesn't have
+			 * a compatibility profile, but it can have
+			 * ARB_compatibility.
+			 */
+			piglit_is_core_profile =
+				!piglit_is_extension_supported("GL_ARB_compatibility");
 			return;
 		}
 	}
 
 	piglit_is_core_profile = false;
 
 	if (test_config->supports_gl_core_version &&
 	    test_config->supports_gl_compat_version) {
 		/* The above attempt to create a core context failed. */
 		printf("piglit: info: Falling back to GL %d.%d "

Comments

On Sat, Oct 21, 2017 at 8:55 AM, Marek Olšák <maraeo@gmail.com> wrote:
> From: Marek Olšák <marek.olsak@amd.com>
>
> ---
>  tests/shaders/shader_runner.c                         | 2 +-
>  tests/util/piglit-framework-gl/piglit_wfl_framework.c | 7 ++++++-
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index 625521c..31bd315 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -2786,21 +2786,21 @@ program_must_be_in_use(void)
>         } else if (!prog_in_use) {
>                 fprintf(stderr, "Failed to use program: %s\n", prog_err_info);
>                 return PIGLIT_FAIL;
>         }
>         return PIGLIT_PASS;
>  }
>
>  static void
>  bind_vao_if_supported()
>  {
> -       if (vao == 0 && gl_version.num >= 31) {
> +       if (vao == 0 && piglit_is_core_profile) {
>                 glGenVertexArrays(1, &vao);
>                 glBindVertexArray(vao);
>         }
>  }
>
>  static enum piglit_result
>  draw_arrays_common(int first, size_t count)
>  {
>         enum piglit_result result = program_must_be_in_use();
>         if (first < 0) {
> diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
> index 5968459..20b9c45 100644
> --- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
> +++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
> @@ -533,21 +533,26 @@ make_context_current(struct piglit_wfl_framework *wfl_fw,
>  {
>         bool ok = false;
>
>  #if defined(PIGLIT_USE_OPENGL)
>
>         if (test_config->supports_gl_core_version) {
>                 ok = make_context_current_singlepass(wfl_fw, test_config,
>                                                      CONTEXT_GL_CORE,
>                                                      partial_config_attrib_list);
>                 if (ok) {
> -                       piglit_is_core_profile = true;
> +                       /* OpenGL 3.1 is special. It doesn't have
> +                        * a compatibility profile, but it can have
> +                        * ARB_compatibility.
> +                        */
> +                       piglit_is_core_profile =
> +                               !piglit_is_extension_supported("GL_ARB_compatibility");

Presumably a test that wants a core context wouldn't be happy with GL
3.1 + GL_ARB_compatibility. IMHO only do the return when
piglit_is_core_profile == true.

>                         return;
>                 }
>         }
>
>         piglit_is_core_profile = false;
>
>         if (test_config->supports_gl_core_version &&
>             test_config->supports_gl_compat_version) {
>                 /* The above attempt to create a core context failed. */
>                 printf("piglit: info: Falling back to GL %d.%d "
> --
> 2.7.4
>
> _______________________________________________
> Piglit mailing list
> Piglit@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit
On Sat, Oct 21, 2017 at 7:59 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> On Sat, Oct 21, 2017 at 8:55 AM, Marek Olšák <maraeo@gmail.com> wrote:
>> From: Marek Olšák <marek.olsak@amd.com>
>>
>> ---
>>  tests/shaders/shader_runner.c                         | 2 +-
>>  tests/util/piglit-framework-gl/piglit_wfl_framework.c | 7 ++++++-
>>  2 files changed, 7 insertions(+), 2 deletions(-)
>>
>> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
>> index 625521c..31bd315 100644
>> --- a/tests/shaders/shader_runner.c
>> +++ b/tests/shaders/shader_runner.c
>> @@ -2786,21 +2786,21 @@ program_must_be_in_use(void)
>>         } else if (!prog_in_use) {
>>                 fprintf(stderr, "Failed to use program: %s\n", prog_err_info);
>>                 return PIGLIT_FAIL;
>>         }
>>         return PIGLIT_PASS;
>>  }
>>
>>  static void
>>  bind_vao_if_supported()
>>  {
>> -       if (vao == 0 && gl_version.num >= 31) {
>> +       if (vao == 0 && piglit_is_core_profile) {
>>                 glGenVertexArrays(1, &vao);
>>                 glBindVertexArray(vao);
>>         }
>>  }
>>
>>  static enum piglit_result
>>  draw_arrays_common(int first, size_t count)
>>  {
>>         enum piglit_result result = program_must_be_in_use();
>>         if (first < 0) {
>> diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
>> index 5968459..20b9c45 100644
>> --- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
>> +++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
>> @@ -533,21 +533,26 @@ make_context_current(struct piglit_wfl_framework *wfl_fw,
>>  {
>>         bool ok = false;
>>
>>  #if defined(PIGLIT_USE_OPENGL)
>>
>>         if (test_config->supports_gl_core_version) {
>>                 ok = make_context_current_singlepass(wfl_fw, test_config,
>>                                                      CONTEXT_GL_CORE,
>>                                                      partial_config_attrib_list);
>>                 if (ok) {
>> -                       piglit_is_core_profile = true;
>> +                       /* OpenGL 3.1 is special. It doesn't have
>> +                        * a compatibility profile, but it can have
>> +                        * ARB_compatibility.
>> +                        */
>> +                       piglit_is_core_profile =
>> +                               !piglit_is_extension_supported("GL_ARB_compatibility");
>
> Presumably a test that wants a core context wouldn't be happy with GL
> 3.1 + GL_ARB_compatibility. IMHO only do the return when
> piglit_is_core_profile == true.

It's pretty unlikely for a GL core test to be affected by a
compatibility profile. Compatibility extends Core, not the other way
around. Additionally, there is no core profile in GL 3.1. If you only
have GL 3.1, you can't choose the profile (barring the
forward-compatible flag).

Marek
On Mon, Oct 23, 2017 at 8:35 AM, Marek Olšák <maraeo@gmail.com> wrote:
> On Sat, Oct 21, 2017 at 7:59 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
>> On Sat, Oct 21, 2017 at 8:55 AM, Marek Olšák <maraeo@gmail.com> wrote:
>>> From: Marek Olšák <marek.olsak@amd.com>
>>>
>>> ---
>>>  tests/shaders/shader_runner.c                         | 2 +-
>>>  tests/util/piglit-framework-gl/piglit_wfl_framework.c | 7 ++++++-
>>>  2 files changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
>>> index 625521c..31bd315 100644
>>> --- a/tests/shaders/shader_runner.c
>>> +++ b/tests/shaders/shader_runner.c
>>> @@ -2786,21 +2786,21 @@ program_must_be_in_use(void)
>>>         } else if (!prog_in_use) {
>>>                 fprintf(stderr, "Failed to use program: %s\n", prog_err_info);
>>>                 return PIGLIT_FAIL;
>>>         }
>>>         return PIGLIT_PASS;
>>>  }
>>>
>>>  static void
>>>  bind_vao_if_supported()
>>>  {
>>> -       if (vao == 0 && gl_version.num >= 31) {
>>> +       if (vao == 0 && piglit_is_core_profile) {
>>>                 glGenVertexArrays(1, &vao);
>>>                 glBindVertexArray(vao);
>>>         }
>>>  }
>>>
>>>  static enum piglit_result
>>>  draw_arrays_common(int first, size_t count)
>>>  {
>>>         enum piglit_result result = program_must_be_in_use();
>>>         if (first < 0) {
>>> diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
>>> index 5968459..20b9c45 100644
>>> --- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
>>> +++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
>>> @@ -533,21 +533,26 @@ make_context_current(struct piglit_wfl_framework *wfl_fw,
>>>  {
>>>         bool ok = false;
>>>
>>>  #if defined(PIGLIT_USE_OPENGL)
>>>
>>>         if (test_config->supports_gl_core_version) {
>>>                 ok = make_context_current_singlepass(wfl_fw, test_config,
>>>                                                      CONTEXT_GL_CORE,
>>>                                                      partial_config_attrib_list);
>>>                 if (ok) {
>>> -                       piglit_is_core_profile = true;
>>> +                       /* OpenGL 3.1 is special. It doesn't have
>>> +                        * a compatibility profile, but it can have
>>> +                        * ARB_compatibility.
>>> +                        */
>>> +                       piglit_is_core_profile =
>>> +                               !piglit_is_extension_supported("GL_ARB_compatibility");
>>
>> Presumably a test that wants a core context wouldn't be happy with GL
>> 3.1 + GL_ARB_compatibility. IMHO only do the return when
>> piglit_is_core_profile == true.
>
> It's pretty unlikely for a GL core test to be affected by a
> compatibility profile. Compatibility extends Core, not the other way
> around. Additionally, there is no core profile in GL 3.1. If you only
> have GL 3.1, you can't choose the profile (barring the
> forward-compatible flag).

The trivial example is "make sure that compat feature is not available
in core profile".
On Mon, Oct 23, 2017 at 2:49 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> On Mon, Oct 23, 2017 at 8:35 AM, Marek Olšák <maraeo@gmail.com> wrote:
>> On Sat, Oct 21, 2017 at 7:59 PM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
>>> On Sat, Oct 21, 2017 at 8:55 AM, Marek Olšák <maraeo@gmail.com> wrote:
>>>> From: Marek Olšák <marek.olsak@amd.com>
>>>>
>>>> ---
>>>>  tests/shaders/shader_runner.c                         | 2 +-
>>>>  tests/util/piglit-framework-gl/piglit_wfl_framework.c | 7 ++++++-
>>>>  2 files changed, 7 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
>>>> index 625521c..31bd315 100644
>>>> --- a/tests/shaders/shader_runner.c
>>>> +++ b/tests/shaders/shader_runner.c
>>>> @@ -2786,21 +2786,21 @@ program_must_be_in_use(void)
>>>>         } else if (!prog_in_use) {
>>>>                 fprintf(stderr, "Failed to use program: %s\n", prog_err_info);
>>>>                 return PIGLIT_FAIL;
>>>>         }
>>>>         return PIGLIT_PASS;
>>>>  }
>>>>
>>>>  static void
>>>>  bind_vao_if_supported()
>>>>  {
>>>> -       if (vao == 0 && gl_version.num >= 31) {
>>>> +       if (vao == 0 && piglit_is_core_profile) {
>>>>                 glGenVertexArrays(1, &vao);
>>>>                 glBindVertexArray(vao);
>>>>         }
>>>>  }
>>>>
>>>>  static enum piglit_result
>>>>  draw_arrays_common(int first, size_t count)
>>>>  {
>>>>         enum piglit_result result = program_must_be_in_use();
>>>>         if (first < 0) {
>>>> diff --git a/tests/util/piglit-framework-gl/piglit_wfl_framework.c b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
>>>> index 5968459..20b9c45 100644
>>>> --- a/tests/util/piglit-framework-gl/piglit_wfl_framework.c
>>>> +++ b/tests/util/piglit-framework-gl/piglit_wfl_framework.c
>>>> @@ -533,21 +533,26 @@ make_context_current(struct piglit_wfl_framework *wfl_fw,
>>>>  {
>>>>         bool ok = false;
>>>>
>>>>  #if defined(PIGLIT_USE_OPENGL)
>>>>
>>>>         if (test_config->supports_gl_core_version) {
>>>>                 ok = make_context_current_singlepass(wfl_fw, test_config,
>>>>                                                      CONTEXT_GL_CORE,
>>>>                                                      partial_config_attrib_list);
>>>>                 if (ok) {
>>>> -                       piglit_is_core_profile = true;
>>>> +                       /* OpenGL 3.1 is special. It doesn't have
>>>> +                        * a compatibility profile, but it can have
>>>> +                        * ARB_compatibility.
>>>> +                        */
>>>> +                       piglit_is_core_profile =
>>>> +                               !piglit_is_extension_supported("GL_ARB_compatibility");
>>>
>>> Presumably a test that wants a core context wouldn't be happy with GL
>>> 3.1 + GL_ARB_compatibility. IMHO only do the return when
>>> piglit_is_core_profile == true.
>>
>> It's pretty unlikely for a GL core test to be affected by a
>> compatibility profile. Compatibility extends Core, not the other way
>> around. Additionally, there is no core profile in GL 3.1. If you only
>> have GL 3.1, you can't choose the profile (barring the
>> forward-compatible flag).
>
> The trivial example is "make sure that compat feature is not available
> in core profile".

That's already guaranteed for GL >= 3.2 and CONTEXT_GL_CORE. If
CONTEXT_GL_CORE sets the forward compatible flag, it's also guaranteed
for GL 3.1. There is no other way to enforce a core profile.

The context has been created and made current at this point, so the
function has to return.

Marek