From d09744aed8c97ccdbb39097f03c0ce42c17ce5f9 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Wed, 25 Mar 2020 17:48:59 +0000 Subject: [PATCH] tests/gl_basic_test: add GL_CONTEXT_PROFILE_MASK check Earlier commit added a string based check for the GL profile. Yet with version GL 3.2 one can query the profile (mask). Add that alongside the existing, string semi-magic. Signed-off-by: Emil Velikov --- tests/functional/gl_basic_test.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/functional/gl_basic_test.c b/tests/functional/gl_basic_test.c index cf69555..5c9a08a 100644 --- a/tests/functional/gl_basic_test.c +++ b/tests/functional/gl_basic_test.c @@ -118,6 +118,10 @@ typedef double GLclampd; /* double precision float in [0,1] */ #define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001 #define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#define GL_CONTEXT_PROFILE_MASK 0x9126 +#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001 +#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002 + #ifndef _WIN32 #define APIENTRY #else @@ -504,6 +508,25 @@ gl_basic_draw__(void **state, struct gl_basic_draw_args__ args) int version_10x = 10 * major + minor; + // Another profile check + if (waffle_context_api == WAFFLE_CONTEXT_OPENGL && version_10x >= 32) { + GLint profile_mask = 0; + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &profile_mask); + + switch (context_profile) { + case WAFFLE_CONTEXT_CORE_PROFILE: + assert_true(profile_mask & GL_CONTEXT_CORE_PROFILE_BIT); + break; + case WAFFLE_CONTEXT_COMPATIBILITY_PROFILE: + assert_true(profile_mask & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT); + case WAFFLE_DONT_CARE: + break; + default: + assert_true(0); + break; + } + } + if ((waffle_context_api == WAFFLE_CONTEXT_OPENGL && version_10x >= 30) || (waffle_context_api != WAFFLE_CONTEXT_OPENGL && version_10x >= 32)) { GLint context_flags = 0; -- 2.11.4.GIT