1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-22 18:28:52 -05:00
Related to #786.
This commit is contained in:
Camilla Löwy 2017-09-07 19:28:44 +02:00
parent 243db302bf
commit 4e1d7e9266
6 changed files with 109 additions and 105 deletions

View File

@ -11,8 +11,9 @@ application development. It provides a simple, platform-independent API for
creating windows, contexts and surfaces, reading input, handling events, etc. creating windows, contexts and surfaces, reading input, handling events, etc.
GLFW natively supports Windows, macOS and Linux and other Unix-like systems. GLFW natively supports Windows, macOS and Linux and other Unix-like systems.
Experimental implementations for the Wayland protocol and the Mir display server Experimental implementations for the Wayland protocol, the Mir display server
are available but not yet officially supported. and direct rendering via EGLDevice are available but not yet officially
supported.
GLFW is licensed under the [zlib/libpng GLFW is licensed under the [zlib/libpng
license](http://www.glfw.org/license.html). license](http://www.glfw.org/license.html).
@ -91,6 +92,9 @@ GLFW itself depends only on the headers and libraries for your window system.
The (experimental) Wayland backend also depends on the `extra-cmake-modules` The (experimental) Wayland backend also depends on the `extra-cmake-modules`
package, which is used to generated Wayland protocol headers. package, which is used to generated Wayland protocol headers.
The (experimental) EGLDevice backend also depends on the `libdrm-dev`
development package.
The examples and test programs depend on a number of tiny libraries. These are The examples and test programs depend on a number of tiny libraries. These are
located in the `deps/` directory. located in the `deps/` directory.
@ -208,6 +212,7 @@ information on what to include when reporting a bug.
- [X11] Bugfix: Incremental reading of selections was not supported (#275) - [X11] Bugfix: Incremental reading of selections was not supported (#275)
- [X11] Bugfix: Selection I/O reported but did not support `COMPOUND_TEXT` - [X11] Bugfix: Selection I/O reported but did not support `COMPOUND_TEXT`
- [X11] Bugfix: Latin-1 text read from selections was not converted to UTF-8 - [X11] Bugfix: Latin-1 text read from selections was not converted to UTF-8
- [Linux] Added experimental support for direct rendering via EGLDevice (#786)
- [Linux] Moved to evdev for joystick input (#906,#1005) - [Linux] Moved to evdev for joystick input (#906,#1005)
- [Linux] Bugfix: Event processing did not detect joystick disconnection (#932) - [Linux] Bugfix: Event processing did not detect joystick disconnection (#932)
- [Linux] Bugfix: The joystick device path could be truncated (#1025) - [Linux] Bugfix: The joystick device path could be truncated (#1025)
@ -282,6 +287,7 @@ skills.
- David Carlier - David Carlier
- Arturo Castro - Arturo Castro
- Chi-kwan Chan - Chi-kwan Chan
- Kamal Chandra
- Ian Clarkson - Ian Clarkson
- Michał Cichoń - Michał Cichoń
- Lambert Clara - Lambert Clara

View File

@ -257,6 +257,7 @@ ramps and clipboard. The options are:
- @b _GLFW_WAYLAND to use the Wayland API (experimental and incomplete) - @b _GLFW_WAYLAND to use the Wayland API (experimental and incomplete)
- @b _GLFW_MIR to use the Mir API (experimental and incomplete) - @b _GLFW_MIR to use the Mir API (experimental and incomplete)
- @b _GLFW_OSMESA to use the OSMesa API (headless and non-interactive) - @b _GLFW_OSMESA to use the OSMesa API (headless and non-interactive)
- @b _GLFW_EGLDEVICE to use the EGLDevice API (experimental and incomplete)
If you are building GLFW as a shared library / dynamic library / DLL then you If you are building GLFW as a shared library / dynamic library / DLL then you
must also define @b _GLFW_BUILD_DLL. Otherwise, you must not define it. must also define @b _GLFW_BUILD_DLL. Otherwise, you must not define it.

View File

@ -1,5 +1,5 @@
//======================================================================== //========================================================================
// GLFW 3.2 EGLDevice - www.glfw.org // GLFW 3.3 EGLDevice - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. // Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
// //
@ -28,44 +28,44 @@
#include <linux/limits.h> #include <linux/limits.h>
static GLFWbool initializeExtensions() static GLFWbool initializeExtensions(void)
{ {
_glfw.egldevice.eglQueryDevicesEXT = _glfw.egldevice.QueryDevicesEXT =
(PFNEGLQUERYDEVICESEXTPROC) (PFNEGLQUERYDEVICESEXTPROC)
_glfw.egl.GetProcAddress("eglQueryDevicesEXT"); eglGetProcAddress("eglQueryDevicesEXT");
_glfw.egldevice.eglQueryDeviceStringEXT = _glfw.egldevice.QueryDeviceStringEXT =
(PFNEGLQUERYDEVICESTRINGEXTPROC) (PFNEGLQUERYDEVICESTRINGEXTPROC)
_glfw.egl.GetProcAddress("eglQueryDeviceStringEXT"); eglGetProcAddress("eglQueryDeviceStringEXT");
_glfw.egldevice.eglGetPlatformDisplayEXT = _glfw.egldevice.GetPlatformDisplayEXT =
(PFNEGLGETPLATFORMDISPLAYEXTPROC) (PFNEGLGETPLATFORMDISPLAYEXTPROC)
_glfw.egl.GetProcAddress("eglGetPlatformDisplayEXT"); eglGetProcAddress("eglGetPlatformDisplayEXT");
_glfw.egldevice.eglGetOutputLayersEXT = _glfw.egldevice.GetOutputLayersEXT =
(PFNEGLGETOUTPUTLAYERSEXTPROC) (PFNEGLGETOUTPUTLAYERSEXTPROC)
_glfw.egl.GetProcAddress("eglGetOutputLayersEXT"); eglGetProcAddress("eglGetOutputLayersEXT");
_glfw.egldevice.eglCreateStreamKHR = _glfw.egldevice.CreateStreamKHR =
(PFNEGLCREATESTREAMKHRPROC) (PFNEGLCREATESTREAMKHRPROC)
_glfw.egl.GetProcAddress("eglCreateStreamKHR"); eglGetProcAddress("eglCreateStreamKHR");
_glfw.egldevice.eglDestroyStreamKHR = _glfw.egldevice.DestroyStreamKHR =
(PFNEGLDESTROYSTREAMKHRPROC) (PFNEGLDESTROYSTREAMKHRPROC)
_glfw.egl.GetProcAddress("eglDestroyStreamKHR"); eglGetProcAddress("eglDestroyStreamKHR");
_glfw.egldevice.eglStreamConsumerOutputEXT = _glfw.egldevice.StreamConsumerOutputEXT =
(PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (PFNEGLSTREAMCONSUMEROUTPUTEXTPROC)
_glfw.egl.GetProcAddress("eglStreamConsumerOutputEXT"); eglGetProcAddress("eglStreamConsumerOutputEXT");
_glfw.egldevice.eglCreateStreamProducerSurfaceKHR = _glfw.egldevice.CreateStreamProducerSurfaceKHR =
(PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)
_glfw.egl.GetProcAddress("eglCreateStreamProducerSurfaceKHR"); eglGetProcAddress("eglCreateStreamProducerSurfaceKHR");
if(!_glfw.egldevice.eglQueryDevicesEXT || if(!_glfw.egldevice.QueryDevicesEXT ||
!_glfw.egldevice.eglQueryDeviceStringEXT || !_glfw.egldevice.QueryDeviceStringEXT ||
!_glfw.egldevice.eglGetPlatformDisplayEXT || !_glfw.egldevice.GetPlatformDisplayEXT ||
!_glfw.egldevice.eglGetOutputLayersEXT || !_glfw.egldevice.GetOutputLayersEXT ||
!_glfw.egldevice.eglCreateStreamKHR || !_glfw.egldevice.CreateStreamKHR ||
!_glfw.egldevice.eglDestroyStreamKHR || !_glfw.egldevice.DestroyStreamKHR ||
!_glfw.egldevice.eglStreamConsumerOutputEXT || !_glfw.egldevice.StreamConsumerOutputEXT ||
!_glfw.egldevice.eglCreateStreamProducerSurfaceKHR) !_glfw.egldevice.CreateStreamProducerSurfaceKHR)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Missing required function(s)"); "EGLDevice: Failed to find required EGL extension functions");
return GLFW_FALSE; return GLFW_FALSE;
} }
return GLFW_TRUE; return GLFW_TRUE;
@ -90,7 +90,7 @@ static EGLDeviceEXT getEGLDevice(void)
"EGLDevice: EGL_EXT_device base extensions not found"); "EGLDevice: EGL_EXT_device base extensions not found");
} }
if (!_glfw.egldevice.eglQueryDevicesEXT(0, NULL, &num_devs)) if (!eglQueryDevicesEXT(0, NULL, &num_devs))
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Falied to query EGLDevice"); "EGLDevice: Falied to query EGLDevice");
@ -98,7 +98,7 @@ static EGLDeviceEXT getEGLDevice(void)
if (num_devs < 1) if (num_devs < 1)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: No Devices Found"); "EGLDevice: No devices found");
} }
egl_devs = calloc(sizeof(EGLDeviceEXT), num_devs); egl_devs = calloc(sizeof(EGLDeviceEXT), num_devs);
@ -109,7 +109,7 @@ static EGLDeviceEXT getEGLDevice(void)
} }
// Select suitable device // Select suitable device
if (!_glfw.egldevice.eglQueryDevicesEXT(num_devs, egl_devs, &num_devs)) if (!eglQueryDevicesEXT(num_devs, egl_devs, &num_devs))
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Failed to query EGL devices"); "EGLDevice: Failed to query EGL devices");
@ -119,8 +119,7 @@ static EGLDeviceEXT getEGLDevice(void)
{ {
const char* deviceExtensionString; const char* deviceExtensionString;
deviceExtensionString = deviceExtensionString = eglQueryDeviceStringEXT(egl_devs[i], EGL_EXTENSIONS);
_glfw.egldevice.eglQueryDeviceStringEXT(egl_devs[i], EGL_EXTENSIONS);
if (_glfwStringInExtensionString("EGL_EXT_device_drm", if (_glfwStringInExtensionString("EGL_EXT_device_drm",
deviceExtensionString)) deviceExtensionString))
{ {
@ -134,8 +133,7 @@ static EGLDeviceEXT getEGLDevice(void)
if (eglDevice == EGL_NO_DEVICE_EXT) if (eglDevice == EGL_NO_DEVICE_EXT)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Missing required extension:" "EGLDevice: Missing required extension EGL_EXT_device_drm");
" EGL_EXT_device_drm");
} }
return eglDevice; return eglDevice;
} }
@ -145,8 +143,7 @@ static int getDRMFd(EGLDeviceEXT eglDevice)
int drm_fd; int drm_fd;
const char* drmName; const char* drmName;
drmName = _glfw.egldevice.eglQueryDeviceStringEXT(eglDevice, drmName = eglQueryDeviceStringEXT(eglDevice, EGL_DRM_DEVICE_FILE_EXT);
EGL_DRM_DEVICE_FILE_EXT);
if (!drmName || (strnlen(drmName, PATH_MAX) == 0)) if (!drmName || (strnlen(drmName, PATH_MAX) == 0))
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
@ -173,8 +170,7 @@ static GLFWbool initEGLDisplay(EGLDeviceEXT egl_dev, int drm_fd)
EGL_NONE EGL_NONE
}; };
_glfw.egl.display = _glfw.egl.display = eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT,
_glfw.egldevice.eglGetPlatformDisplayEXT(EGL_PLATFORM_DEVICE_EXT,
(void*)egl_dev, (void*)egl_dev,
displayAttribs); displayAttribs);
if (_glfw.egl.display == EGL_NO_DISPLAY) if (_glfw.egl.display == EGL_NO_DISPLAY)
@ -196,8 +192,7 @@ static GLFWbool initEGLDisplay(EGLDeviceEXT egl_dev, int drm_fd)
displayExtensionString)) displayExtensionString))
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Missing required extension:" "EGLDevice: Missing required extension EGL_EXT_output_base");
" EGL_EXT_output_base");
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -205,8 +200,7 @@ static GLFWbool initEGLDisplay(EGLDeviceEXT egl_dev, int drm_fd)
displayExtensionString)) displayExtensionString))
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Missing required extension:" "EGLDevice: Missing required extension EGL_EXT_output_drm");
" EGL_EXT_output_drm");
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -214,8 +208,7 @@ static GLFWbool initEGLDisplay(EGLDeviceEXT egl_dev, int drm_fd)
displayExtensionString)) displayExtensionString))
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Missing required extension:" "EGLDevice: Missing required extension EGL_KHR_stream");
" EGL_KHR_stream");
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -223,16 +216,14 @@ static GLFWbool initEGLDisplay(EGLDeviceEXT egl_dev, int drm_fd)
displayExtensionString)) displayExtensionString))
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Missing required extension:" "EGLDevice: Missing required extension EGL_KHR_stream_producer_eglsurface");
" EGL_KHR_stream_producer_eglsurface");
return GLFW_FALSE; return GLFW_FALSE;
} }
if (!_glfwStringInExtensionString("EGL_EXT_stream_consumer_egloutput", if (!_glfwStringInExtensionString("EGL_EXT_stream_consumer_egloutput",
displayExtensionString)) displayExtensionString))
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Missing required extension:" "EGLDevice: Missing required extension EGL_EXT_stream_consumer_egloutput");
" EGL_EXT_stream_consumer_egloutput");
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -290,3 +281,4 @@ const char* _glfwPlatformGetVersionString(void)
#endif #endif
; ;
} }

View File

@ -1,5 +1,5 @@
//======================================================================== //========================================================================
// GLFW 3.2 EGLDevice - www.glfw.org // GLFW 3.3 EGLDevice - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. // Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
// //
@ -58,8 +58,7 @@ static GLFWbool pickConnector(_GLFWmonitor* monitor, int drm_fd, drmModeRes* res
drmModeGetEncoder(drm_fd, monitor->egldevice.encId); drmModeGetEncoder(drm_fd, monitor->egldevice.encId);
if (!enc_info) { if (!enc_info) {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Unable to query DRM-KMS" "EGLDevice: Unable to query DRM-KMS information for connector index %d", i);
" information for connector index %d", i);
} }
// Select the modesize // Select the modesize
@ -163,3 +162,4 @@ void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp)
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: _glfwPlatformSetGammaRamp not implemented"); "EGLDevice: _glfwPlatformSetGammaRamp not implemented");
} }

View File

@ -1,5 +1,5 @@
//======================================================================== //========================================================================
// GLFW 3.2 EGLDevice - www.glfw.org // GLFW 3.3 EGLDevice - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. // Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
// //
@ -24,9 +24,6 @@
// //
//======================================================================== //========================================================================
#ifndef _glfw3_egldevice_h_
#define _glfw3_egldevice_h_
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
@ -77,6 +74,16 @@ typedef EGLBoolean (EGLAPIENTRY * PFNEGLSTREAMCONSUMEROUTPUTEXTPROC)(EGLDisplay,
typedef EGLSurface (EGLAPIENTRY * PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay,EGLConfig,EGLStreamKHR,const EGLint*); typedef EGLSurface (EGLAPIENTRY * PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay,EGLConfig,EGLStreamKHR,const EGLint*);
typedef EGLBoolean (EGLAPIENTRY * PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay,EGLStreamKHR,EGLenum,EGLint); typedef EGLBoolean (EGLAPIENTRY * PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay,EGLStreamKHR,EGLenum,EGLint);
typedef EGLBoolean (EGLAPIENTRY * PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC)(EGLDisplay,EGLStreamKHR,const EGLAttrib*); typedef EGLBoolean (EGLAPIENTRY * PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC)(EGLDisplay,EGLStreamKHR,const EGLAttrib*);
#define eglQueryDevicesEXT _glfw.egldevice.QueryDevicesEXT
#define eglQueryDeviceStringEXT _glfw.egldevice.QueryDeviceStringEXT
#define eglGetPlatformDisplayEXT _glfw.egldevice.GetPlatformDisplayEXT
#define eglGetOutputLayersEXT _glfw.egldevice.GetOutputLayersEXT
#define eglCreateStreamKHR _glfw.egldevice.CreateStreamKHR
#define eglDestroyStreamKHR _glfw.egldevice.DestroyStreamKHR
#define eglStreamConsumerOutputEXT _glfw.egldevice.StreamConsumerOutputEXT
#define eglCreateStreamProducerSurfaceKHR _glfw.egldevice.CreateStreamProducerSurfaceKHR
#define eglStreamAttribKHR _glfw.egldevice.StreamAttribKHR
#define eglStreamConsumerAcquireAttribKHR _glfw.egldevice.StreamConsumerAcquireAttribKHR
#define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL) #define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL)
#define _glfw_dlclose(handle) dlclose(handle) #define _glfw_dlclose(handle) dlclose(handle)
@ -85,17 +92,17 @@ typedef EGLBoolean (EGLAPIENTRY * PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC)(EGLD
#define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY #define _GLFW_EGL_NATIVE_DISPLAY EGL_DEFAULT_DISPLAY
#define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType)window->egldevice.handle) #define _GLFW_EGL_NATIVE_WINDOW ((EGLNativeWindowType)window->egldevice.handle)
#define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowEgldevice egldevice #define _GLFW_PLATFORM_WINDOW_STATE _GLFWwindowEGLDevice egldevice
#define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryEgldevice egldevice #define _GLFW_PLATFORM_LIBRARY_WINDOW_STATE _GLFWlibraryEGLDevice egldevice
#define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorEgldevice egldevice #define _GLFW_PLATFORM_MONITOR_STATE _GLFWmonitorEGLDevice egldevice
#define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorEgldevice egldevice #define _GLFW_PLATFORM_CURSOR_STATE _GLFWcursorEGLDevice egldevice
#define _GLFW_PLATFORM_CONTEXT_STATE #define _GLFW_PLATFORM_CONTEXT_STATE
#define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE #define _GLFW_PLATFORM_LIBRARY_CONTEXT_STATE
// EGLDEVICE-specific per-window data // EGLDevice-specific per-window data
// //
typedef struct _GLFWwindowEgldevice typedef struct _GLFWwindowEGLDevice
{ {
int xsurfsize, ysurfsize; int xsurfsize, ysurfsize;
int xoffset, yoffset; int xoffset, yoffset;
@ -106,38 +113,39 @@ typedef struct _GLFWwindowEgldevice
EGLDisplay handle; EGLDisplay handle;
EGLOutputLayerEXT eglLayer; EGLOutputLayerEXT eglLayer;
EGLStreamKHR eglStream; EGLStreamKHR eglStream;
} _GLFWwindowEgldevice; } _GLFWwindowEGLDevice;
// EGLDEVICE-specific global data // EGLDevice-specific global data
// //
typedef struct _GLFWlibraryEgldevice typedef struct _GLFWlibraryEGLDevice
{ {
int drmFd; int drmFd;
PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT; PFNEGLQUERYDEVICESEXTPROC QueryDevicesEXT;
PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT; PFNEGLQUERYDEVICESTRINGEXTPROC QueryDeviceStringEXT;
PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT; PFNEGLGETPLATFORMDISPLAYEXTPROC GetPlatformDisplayEXT;
PFNEGLGETOUTPUTLAYERSEXTPROC eglGetOutputLayersEXT; PFNEGLGETOUTPUTLAYERSEXTPROC GetOutputLayersEXT;
PFNEGLCREATESTREAMKHRPROC eglCreateStreamKHR; PFNEGLCREATESTREAMKHRPROC CreateStreamKHR;
PFNEGLDESTROYSTREAMKHRPROC eglDestroyStreamKHR; PFNEGLDESTROYSTREAMKHRPROC DestroyStreamKHR;
PFNEGLSTREAMCONSUMEROUTPUTEXTPROC eglStreamConsumerOutputEXT; PFNEGLSTREAMCONSUMEROUTPUTEXTPROC StreamConsumerOutputEXT;
PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC eglCreateStreamProducerSurfaceKHR; PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC CreateStreamProducerSurfaceKHR;
PFNEGLSTREAMATTRIBKHRPROC eglStreamAttribKHR; PFNEGLSTREAMATTRIBKHRPROC StreamAttribKHR;
PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC eglStreamConsumerAcquireAttribKHR; PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC StreamConsumerAcquireAttribKHR;
} _GLFWlibraryEgldevice; } _GLFWlibraryEGLDevice;
// EGLDEVICE-specific per-monitor data // EGLDevice-specific per-monitor data
// //
typedef struct _GLFWmonitorEgldevice { typedef struct _GLFWmonitorEGLDevice
{
int crtcIndex; int crtcIndex;
uint32_t connId, encId, crtcId; uint32_t connId, encId, crtcId;
} _GLFWmonitorEgldevice; } _GLFWmonitorEGLDevice;
// EGLDEVICE-specific per-cursor data // EGLDevice-specific per-cursor data
// //
typedef struct _GLFWcursorEgldevice { typedef struct _GLFWcursorEGLDevice
} _GLFWcursorEgldevice; {
} _GLFWcursorEGLDevice;
void _glfwPollMonitorsEGLDevice(void); void _glfwPollMonitorsEGLDevice(void);
#endif // _glfw3_egldevice_platform_h_

View File

@ -1,5 +1,5 @@
//======================================================================== //========================================================================
// GLFW 3.2 EGLDevice - www.glfw.org // GLFW 3.3 EGLDevice - www.glfw.org
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. // Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
// //
@ -57,9 +57,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
layerAttribs[0] = EGL_DRM_CRTC_EXT; layerAttribs[0] = EGL_DRM_CRTC_EXT;
layerAttribs[1] = (EGLAttrib)monitor->egldevice.crtcId; layerAttribs[1] = (EGLAttrib)monitor->egldevice.crtcId;
if (!_glfw.egldevice.eglGetOutputLayersEXT(_glfw.egl.display, layerAttribs, if (!eglGetOutputLayersEXT(_glfw.egl.display, layerAttribs,
&window->egldevice.eglLayer, &window->egldevice.eglLayer,
1, &n) || !n) 1, &n) || !n)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Unable to obtain EGLOutputLayer"); "EGLDevice: Unable to obtain EGLOutputLayer");
@ -68,7 +68,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
// Create a stream and connect to the output // Create a stream and connect to the output
window->egldevice.eglStream = window->egldevice.eglStream =
_glfw.egldevice.eglCreateStreamKHR(_glfw.egl.display, streamAttribs); eglCreateStreamKHR(_glfw.egl.display, streamAttribs);
if (window->egldevice.eglStream == EGL_NO_STREAM_KHR) if (window->egldevice.eglStream == EGL_NO_STREAM_KHR)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
@ -76,9 +76,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
eglGetError()); eglGetError());
return GLFW_FALSE; return GLFW_FALSE;
} }
if (!_glfw.egldevice.eglStreamConsumerOutputEXT(_glfw.egl.display, if (!eglStreamConsumerOutputEXT(_glfw.egl.display,
window->egldevice.eglStream, window->egldevice.eglStream,
window->egldevice.eglLayer)) window->egldevice.eglLayer))
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Unable to connect stream (error 0x%x)", "EGLDevice: Unable to connect stream (error 0x%x)",
@ -90,15 +90,14 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
surfaceAttribs[1] = window->egldevice.xsurfsize; surfaceAttribs[1] = window->egldevice.xsurfsize;
surfaceAttribs[3] = window->egldevice.ysurfsize; surfaceAttribs[3] = window->egldevice.ysurfsize;
window->context.egl.surface = window->context.egl.surface =
_glfw.egldevice.eglCreateStreamProducerSurfaceKHR(_glfw.egl.display, eglCreateStreamProducerSurfaceKHR(_glfw.egl.display,
window->context.egl.config, window->context.egl.config,
window->egldevice.eglStream, window->egldevice.eglStream,
surfaceAttribs); surfaceAttribs);
if (window->context.egl.surface == EGL_NO_SURFACE) if (window->context.egl.surface == EGL_NO_SURFACE)
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: Unable to create rendering" "EGLDevice: Unable to create rendering surface (error 0x%x)", eglGetError());
" surface (error 0x%x)", eglGetError());
return GLFW_FALSE; return GLFW_FALSE;
} }
@ -111,10 +110,7 @@ void _glfwPlatformDestroyWindow(_GLFWwindow* window)
window->context.destroy(window); window->context.destroy(window);
if (window->egldevice.eglStream != EGL_NO_STREAM_KHR) if (window->egldevice.eglStream != EGL_NO_STREAM_KHR)
{ eglDestroyStreamKHR(_glfw.egl.display, window->egldevice.eglStream);
_glfw.egldevice.eglDestroyStreamKHR(_glfw.egl.display,
window->egldevice.eglStream);
}
} }
void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title) void _glfwPlatformSetWindowTitle(_GLFWwindow* window, const char* title)
@ -307,7 +303,7 @@ int _glfwPlatformWindowMaximized(_GLFWwindow* window)
void _glfwPlatformPollEvents(void) void _glfwPlatformPollEvents(void)
{ {
return; _glfwDetectJoystickConnectionLinux();
} }
void _glfwPlatformWaitEvents(void) void _glfwPlatformWaitEvents(void)
@ -419,7 +415,7 @@ int _glfwPlatformGetPhysicalDevicePresentationSupport(VkInstance instance,
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: _glfwPlatformGetPhysicalDevicePresentationSupport not supported"); "EGLDevice: _glfwPlatformGetPhysicalDevicePresentationSupport not supported");
return 0; return GLFW_FALSE;
} }
VkResult _glfwPlatformCreateWindowSurface(VkInstance instance, VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
@ -429,5 +425,6 @@ VkResult _glfwPlatformCreateWindowSurface(VkInstance instance,
{ {
_glfwInputError(GLFW_PLATFORM_ERROR, _glfwInputError(GLFW_PLATFORM_ERROR,
"EGLDevice: _glfwPlatformCreateWindowSurface not supported"); "EGLDevice: _glfwPlatformCreateWindowSurface not supported");
return (VkResult)NULL; return VK_ERROR_INITIALIZATION_FAILED;
} }