mesa: optimize out _mesa_is_desktop_gl*() and _mesa_is_gles*() calls when not built
This will in turn optimize out anything that's gated on those. Suggested-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Adam Jackson <ajax@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21343>
This commit is contained in:

committed by
Marge Bot

parent
b20a614e82
commit
adbe8b6c17
@@ -121,6 +121,10 @@ with_gles2 = get_option('gles2') \
|
|||||||
.require(with_shared_glapi, error_message : 'OpengGL ES 2.x requires shared-glapi') \
|
.require(with_shared_glapi, error_message : 'OpengGL ES 2.x requires shared-glapi') \
|
||||||
.allowed()
|
.allowed()
|
||||||
|
|
||||||
|
pre_args += '-DHAVE_OPENGL=@0@'.format(with_opengl ? '1' : '0')
|
||||||
|
pre_args += '-DHAVE_OPENGL_ES_1=@0@'.format(with_gles1 ? '1' : '0')
|
||||||
|
pre_args += '-DHAVE_OPENGL_ES_2=@0@'.format(with_gles2 ? '1' : '0')
|
||||||
|
|
||||||
with_any_opengl = with_opengl or with_gles1 or with_gles2
|
with_any_opengl = with_opengl or with_gles1 or with_gles2
|
||||||
# Only build shared_glapi if at least one OpenGL API is enabled
|
# Only build shared_glapi if at least one OpenGL API is enabled
|
||||||
with_shared_glapi = with_shared_glapi and with_any_opengl
|
with_shared_glapi = with_shared_glapi and with_any_opengl
|
||||||
|
@@ -252,7 +252,11 @@ do { \
|
|||||||
static inline bool
|
static inline bool
|
||||||
_mesa_is_desktop_gl_compat(const struct gl_context *ctx)
|
_mesa_is_desktop_gl_compat(const struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
|
#if HAVE_OPENGL
|
||||||
return ctx->API == API_OPENGL_COMPAT;
|
return ctx->API == API_OPENGL_COMPAT;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -261,7 +265,11 @@ _mesa_is_desktop_gl_compat(const struct gl_context *ctx)
|
|||||||
static inline bool
|
static inline bool
|
||||||
_mesa_is_desktop_gl_core(const struct gl_context *ctx)
|
_mesa_is_desktop_gl_core(const struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
|
#if HAVE_OPENGL
|
||||||
return ctx->API == API_OPENGL_CORE;
|
return ctx->API == API_OPENGL_CORE;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -279,7 +287,11 @@ _mesa_is_desktop_gl(const struct gl_context *ctx)
|
|||||||
static inline bool
|
static inline bool
|
||||||
_mesa_is_gles1(const struct gl_context *ctx)
|
_mesa_is_gles1(const struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
|
#if HAVE_OPENGL_ES_1
|
||||||
return ctx->API == API_OPENGLES;
|
return ctx->API == API_OPENGLES;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -288,7 +300,11 @@ _mesa_is_gles1(const struct gl_context *ctx)
|
|||||||
static inline bool
|
static inline bool
|
||||||
_mesa_is_gles2(const struct gl_context *ctx)
|
_mesa_is_gles2(const struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
|
#if HAVE_OPENGL_ES_2
|
||||||
return ctx->API == API_OPENGLES2;
|
return ctx->API == API_OPENGLES2;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user