Simplify previous commit and also fix the double egl context deletion
This commit is contained in:
parent
26a6c49fc1
commit
c13f812290
@ -120,7 +120,7 @@ public:
|
|||||||
uint32_t serial, uint32_t time, uint32_t button,
|
uint32_t serial, uint32_t time, uint32_t button,
|
||||||
uint32_t state)
|
uint32_t state)
|
||||||
{
|
{
|
||||||
CIrrDeviceWayland* device = static_cast<CIrrDeviceWayland* >(data);
|
CIrrDeviceWayland* device = static_cast<CIrrDeviceWayland*>(data);
|
||||||
|
|
||||||
SEvent irrevent;
|
SEvent irrevent;
|
||||||
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
irrevent.EventType = irr::EET_MOUSE_INPUT_EVENT;
|
||||||
@ -210,7 +210,7 @@ public:
|
|||||||
static void pointer_axis(void* data, wl_pointer* wl_pointer, uint32_t time,
|
static void pointer_axis(void* data, wl_pointer* wl_pointer, uint32_t time,
|
||||||
uint32_t axis, wl_fixed_t value)
|
uint32_t axis, wl_fixed_t value)
|
||||||
{
|
{
|
||||||
CIrrDeviceWayland* device = static_cast<CIrrDeviceWayland* >(data);
|
CIrrDeviceWayland* device = static_cast<CIrrDeviceWayland*>(data);
|
||||||
|
|
||||||
if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
|
if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
|
||||||
{
|
{
|
||||||
@ -733,11 +733,16 @@ bool CIrrDeviceWayland::initEGL()
|
|||||||
m_egl_context = new ContextManagerEGL();
|
m_egl_context = new ContextManagerEGL();
|
||||||
|
|
||||||
ContextEGLParams egl_params;
|
ContextEGLParams egl_params;
|
||||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
|
||||||
|
if (CreationParams.DriverType == video::EDT_OGLES2)
|
||||||
|
{
|
||||||
egl_params.opengl_api = CEGL_API_OPENGL_ES;
|
egl_params.opengl_api = CEGL_API_OPENGL_ES;
|
||||||
#else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
egl_params.opengl_api = CEGL_API_OPENGL;
|
egl_params.opengl_api = CEGL_API_OPENGL;
|
||||||
#endif
|
}
|
||||||
|
|
||||||
egl_params.surface_type = CEGL_SURFACE_WINDOW;
|
egl_params.surface_type = CEGL_SURFACE_WINDOW;
|
||||||
egl_params.force_legacy_device = CreationParams.ForceLegacyDevice;
|
egl_params.force_legacy_device = CreationParams.ForceLegacyDevice;
|
||||||
egl_params.with_alpha_channel = CreationParams.WithAlphaChannel;
|
egl_params.with_alpha_channel = CreationParams.WithAlphaChannel;
|
||||||
@ -849,12 +854,6 @@ void CIrrDeviceWayland::createDriver()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CIrrDeviceWayland::swapBuffers()
|
|
||||||
{
|
|
||||||
wl_display_dispatch_pending(m_display);
|
|
||||||
m_egl_context->swapBuffers();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CIrrDeviceWayland::updateCursor()
|
void CIrrDeviceWayland::updateCursor()
|
||||||
{
|
{
|
||||||
if (!getCursorControl()->isVisible() && CreationParams.Fullscreen)
|
if (!getCursorControl()->isVisible() && CreationParams.Fullscreen)
|
||||||
@ -887,6 +886,8 @@ bool CIrrDeviceWayland::run()
|
|||||||
{
|
{
|
||||||
os::Timer::tick();
|
os::Timer::tick();
|
||||||
|
|
||||||
|
wl_display_dispatch_pending(m_display);
|
||||||
|
|
||||||
for (unsigned int i = 0; i < m_events.size(); i++)
|
for (unsigned int i = 0; i < m_events.size(); i++)
|
||||||
{
|
{
|
||||||
postEventFromUser(m_events[i]);
|
postEventFromUser(m_events[i]);
|
||||||
|
@ -135,7 +135,6 @@ namespace irr
|
|||||||
static bool isWaylandDeviceWorking();
|
static bool isWaylandDeviceWorking();
|
||||||
|
|
||||||
ContextManagerEGL* getEGLContext() {return m_egl_context;}
|
ContextManagerEGL* getEGLContext() {return m_egl_context;}
|
||||||
void swapBuffers();
|
|
||||||
void updateCursor();
|
void updateCursor();
|
||||||
unsigned int getWidth() {return m_width;}
|
unsigned int getWidth() {return m_width;}
|
||||||
unsigned int getHeight() {return m_height;}
|
unsigned int getHeight() {return m_height;}
|
||||||
|
@ -54,9 +54,6 @@ namespace video
|
|||||||
#endif
|
#endif
|
||||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||||
, HDc(0)
|
, HDc(0)
|
||||||
#endif
|
|
||||||
#ifdef _IRR_COMPILE_WITH_WAYLAND_DEVICE_
|
|
||||||
, wl_device(0)
|
|
||||||
#endif
|
#endif
|
||||||
, Params(params)
|
, Params(params)
|
||||||
{
|
{
|
||||||
@ -146,7 +143,6 @@ namespace video
|
|||||||
ColorFormat(ECF_R8G8B8), EglContext(0), Params(params)
|
ColorFormat(ECF_R8G8B8), EglContext(0), Params(params)
|
||||||
{
|
{
|
||||||
EglContext = device->getEGLContext();
|
EglContext = device->getEGLContext();
|
||||||
wl_device = device;
|
|
||||||
genericDriverInit(params.WindowSize, params.Stencilbuffer);
|
genericDriverInit(params.WindowSize, params.Stencilbuffer);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -162,7 +158,7 @@ namespace video
|
|||||||
if (BridgeCalls)
|
if (BridgeCalls)
|
||||||
delete BridgeCalls;
|
delete BridgeCalls;
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_EGL_)
|
#if defined(_IRR_COMPILE_WITH_EGL_) && !defined(_IRR_COMPILE_WITH_WAYLAND_DEVICE_)
|
||||||
delete EglContext;
|
delete EglContext;
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||||
@ -485,15 +481,6 @@ namespace video
|
|||||||
CNullDriver::endScene();
|
CNullDriver::endScene();
|
||||||
|
|
||||||
#if defined(_IRR_COMPILE_WITH_EGL_)
|
#if defined(_IRR_COMPILE_WITH_EGL_)
|
||||||
#ifdef _IRR_COMPILE_WITH_WAYLAND_DEVICE_
|
|
||||||
if (wl_device != NULL)
|
|
||||||
{
|
|
||||||
wl_device->swapBuffers();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
bool res = EglContext->swapBuffers();
|
bool res = EglContext->swapBuffers();
|
||||||
|
|
||||||
if (!res)
|
if (!res)
|
||||||
@ -501,7 +488,6 @@ namespace video
|
|||||||
os::Printer::log("Could not swap buffers for OpenGL-ES2 driver.");
|
os::Printer::log("Could not swap buffers for OpenGL-ES2 driver.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
glFlush();
|
glFlush();
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, ViewRenderbuffer);
|
glBindRenderbuffer(GL_RENDERBUFFER, ViewRenderbuffer);
|
||||||
|
@ -468,9 +468,6 @@ namespace video
|
|||||||
#if defined(_IRR_COMPILE_WITH_EGL_)
|
#if defined(_IRR_COMPILE_WITH_EGL_)
|
||||||
ContextManagerEGL* EglContext;
|
ContextManagerEGL* EglContext;
|
||||||
#endif
|
#endif
|
||||||
#ifdef _IRR_COMPILE_WITH_WAYLAND_DEVICE_
|
|
||||||
CIrrDeviceWayland* wl_device;
|
|
||||||
#endif
|
|
||||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||||
CIrrDeviceIPhone* Device;
|
CIrrDeviceIPhone* Device;
|
||||||
GLuint ViewFramebuffer;
|
GLuint ViewFramebuffer;
|
||||||
|
@ -982,7 +982,7 @@ bool COpenGLDriver::endScene()
|
|||||||
#ifdef _IRR_COMPILE_WITH_WAYLAND_DEVICE_
|
#ifdef _IRR_COMPILE_WITH_WAYLAND_DEVICE_
|
||||||
if (DeviceType == EIDT_WAYLAND)
|
if (DeviceType == EIDT_WAYLAND)
|
||||||
{
|
{
|
||||||
wl_device->swapBuffers();
|
wl_device->getEGLContext()->swapBuffers();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user