diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 1b256275504..eabb0ffa6f6 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -303,11 +303,7 @@ _mesa_is_gles1(const struct gl_context *ctx) static inline bool _mesa_is_gles2(const struct gl_context *ctx) { -#if HAVE_OPENGL_ES_2 - return ctx->API == API_OPENGLES2; -#else - return false; -#endif + return _mesa_is_api_gles2(ctx->API); } /** diff --git a/src/mesa/main/menums.h b/src/mesa/main/menums.h index b78fb2634b3..360809e656d 100644 --- a/src/mesa/main/menums.h +++ b/src/mesa/main/menums.h @@ -32,6 +32,7 @@ #ifndef MENUMS_H #define MENUMS_H +#include #include "util/macros.h" /** @@ -49,6 +50,19 @@ typedef enum API_OPENGL_LAST = API_OPENGL_CORE } gl_api; +/** + * Checks if the api is for GLES 2.0 or later + */ +static inline bool +_mesa_is_api_gles2(gl_api api) +{ +#if HAVE_OPENGL_ES_2 + return api == API_OPENGLES2; +#else + return false; +#endif +} + /** * An index for each type of texture object. These correspond to the GL * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc.