Make EGL utils conditional on EGL.h.
PiperOrigin-RevId: 865064686 Change-Id: I3728de6e49e4c36d76b410c2458767f74df069c9
This commit is contained in:
committed by
Copybara-Service
parent
feb3abcccf
commit
144a8a9e85
@@ -16,12 +16,17 @@
|
|||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <EGL/egl.h>
|
#if __has_include("third_party/GL/gl/include/EGL/egl.h")
|
||||||
#include <EGL/eglext.h>
|
#define MUJOCO_HAS_EGL
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
#include <EGL/eglext.h>
|
||||||
|
#endif
|
||||||
#include <mujoco/mujoco.h>
|
#include <mujoco/mujoco.h>
|
||||||
|
|
||||||
namespace mujoco::platform {
|
namespace mujoco::platform {
|
||||||
|
|
||||||
|
#ifdef MUJOCO_HAS_EGL
|
||||||
|
|
||||||
static EGLDisplay CreateInitializedEglDisplay() {
|
static EGLDisplay CreateInitializedEglDisplay() {
|
||||||
auto eglQueryDevicesEXT =
|
auto eglQueryDevicesEXT =
|
||||||
(PFNEGLQUERYDEVICESEXTPROC)eglGetProcAddress("eglQueryDevicesEXT");
|
(PFNEGLQUERYDEVICESEXTPROC)eglGetProcAddress("eglQueryDevicesEXT");
|
||||||
@@ -136,9 +141,16 @@ struct EglContext {
|
|||||||
EGLContext context_;
|
EGLContext context_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // MUJOCO_HAS_EGL
|
||||||
|
|
||||||
std::shared_ptr<void> CreateEglContext() {
|
std::shared_ptr<void> CreateEglContext() {
|
||||||
|
#ifdef MUJOCO_HAS_EGL
|
||||||
auto egl_context = std::make_shared<EglContext>();
|
auto egl_context = std::make_shared<EglContext>();
|
||||||
return std::static_pointer_cast<void>(egl_context);
|
return std::static_pointer_cast<void>(egl_context);
|
||||||
|
#else
|
||||||
|
mju_error("EGL is not supported");
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mujoco::platform
|
} // namespace mujoco::platform
|
||||||
|
|||||||
Reference in New Issue
Block a user