endif
if _egl == 'auto'
with_egl = (
- not ['darwin', 'windows'].contains(host_machine.system()) and
- with_dri and with_shared_glapi
+ host_machine.system() != 'darwin' and
+ (with_platform_windows or with_dri) and
+ with_shared_glapi
)
elif _egl == 'enabled'
- if not with_dri and not with_platform_haiku
- error('EGL requires dri')
+ if not with_dri and not with_platform_haiku and not with_platform_windows
+ error('EGL requires dri, haiku, or windows')
elif not with_shared_glapi
error('EGL requires shared-glapi')
elif not ['disabled', 'dri'].contains(with_glx)
error('EGL requires dri, but a GLX is being built without dri')
- elif ['darwin', 'windows'].contains(host_machine.system())
- error('EGL is not available on Windows or MacOS')
+ elif host_machine.system() == 'darwin'
+ error('EGL is not available on MacOS')
endif
with_egl = true
else
if with_gbm and not with_platform_android
pre_args += '-DHAVE_DRM_PLATFORM'
endif
+if with_platform_windows
+ pre_args += '-DHAVE_WINDOWS_PLATFORM'
+endif
with_android_stub = get_option('android-stub')
if with_android_stub and not with_platform_android
if with_dri3
egl_drivers += 'builtin:egl_dri3'
endif
+ if with_platform_windows
+ egl_drivers += 'builtin:wgl'
+ endif
lines += 'EGL drivers: ' + ' '.join(egl_drivers)
endif
if with_egl or with_any_vk
--- /dev/null
+/*
+ * Copyright © Microsoft Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include <egldriver.h>
+
+struct _egl_driver _eglDriver;
+
#include "c99_compat.h"
#include "c11/threads.h"
#include "util/u_thread.h"
+#include "util/u_string.h"
#include "egllog.h"
#include "eglcurrent.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
+#ifdef _WIN32
+#include <io.h>
+#else
#include <unistd.h>
+#endif
#include <fcntl.h>
#include "c11/threads.h"
#include "util/macros.h"
{ _EGL_PLATFORM_HAIKU, "haiku" },
{ _EGL_PLATFORM_SURFACELESS, "surfaceless" },
{ _EGL_PLATFORM_DEVICE, "device" },
+ { _EGL_PLATFORM_WINDOWS, "windows" },
};
_EGL_PLATFORM_HAIKU,
_EGL_PLATFORM_SURFACELESS,
_EGL_PLATFORM_DEVICE,
+ _EGL_PLATFORM_WINDOWS,
_EGL_NUM_PLATFORMS,
_EGL_INVALID_PLATFORM = -1
#include "egldisplay.h"
#include "util/macros.h"
+#include "util/os_misc.h"
#ifdef HAVE_MINCORE
#include <unistd.h>
_eglPointerIsDereferencable(void *p)
{
uintptr_t addr = (uintptr_t) p;
- const long page_size = getpagesize();
+ uint64_t page_size = 0;
+ os_get_page_size(&page_size);
#ifdef HAVE_MINCORE
unsigned char valid = 0;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <strings.h>
#include "c11/threads.h"
#include "util/macros.h"
#include "util/u_string.h"
files_egl += files('drivers/haiku/egl_haiku.cpp')
link_for_egl += libgl
deps_for_egl += cpp.find_library('be')
+elif with_platform_windows
+ c_args_for_egl += [
+ '-DEGLAPI=', '-DPUBLIC='
+ ]
+ files_egl += files('drivers/wgl/egl_wgl.c')
endif
if cc.has_function('mincore')
if not with_glvnd
egl_lib_name = 'EGL' + get_option('egl-lib-suffix')
egl_lib_version = '1.0.0'
+ egl_lib_soversion = host_machine.system() == 'windows' ? '' : '1'
else
egl_lib_name = 'EGL_@0@'.format(glvnd_vendor_name)
egl_lib_version = '0.0.0'
+ egl_lib_soversion = '0'
deps_for_egl += dep_glvnd
files_egl += [g_egldispatchstubs_h, g_egldispatchstubs_c]
files_egl += files('main/eglglvnd.c', 'main/egldispatchstubs.c')
dependencies : [deps_for_egl, dep_dl, dep_libdrm, dep_clock, dep_thread, idep_mesautil],
install : true,
version : egl_lib_version,
+ soversion : egl_lib_soversion,
+ name_prefix : 'lib', # even on windows
)
if not with_glvnd