From e8e17641c10e095d1e9123ad8fb1ca0f6f4d93fe Mon Sep 17 00:00:00 2001 From: Eric Engestrom Date: Wed, 15 Feb 2023 19:53:18 +0000 Subject: [PATCH] mesa: add _mesa_is_desktop_gl_compat() and _mesa_is_desktop_gl_core() helpers Signed-off-by: Eric Engestrom Reviewed-by: Adam Jackson Part-of: --- src/mesa/main/context.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index fbfdd2ddbf8..20340a33f53 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -246,13 +246,31 @@ do { \ /*@}*/ +/** + * Checks if the context is for Desktop GL Compatibility + */ +static inline bool +_mesa_is_desktop_gl_compat(const struct gl_context *ctx) +{ + return ctx->API == API_OPENGL_COMPAT; +} + +/** + * Checks if the context is for Desktop GL Core + */ +static inline bool +_mesa_is_desktop_gl_core(const struct gl_context *ctx) +{ + return ctx->API == API_OPENGL_CORE; +} + /** * Checks if the context is for Desktop GL (Compatibility or Core) */ static inline bool _mesa_is_desktop_gl(const struct gl_context *ctx) { - return ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGL_CORE; + return _mesa_is_desktop_gl_compat(ctx) || _mesa_is_desktop_gl_core(ctx); }