mesa: add _mesa_is_desktop_gl_compat() and _mesa_is_desktop_gl_core() helpers

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21343>
This commit is contained in:
Eric Engestrom 2023-02-15 19:53:18 +00:00 committed by Marge Bot
parent 8a4c18afff
commit e8e17641c1

View file

@ -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);
}