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 state)
|
||||
{
|
||||
CIrrDeviceWayland* device = static_cast<CIrrDeviceWayland* >(data);
|
||||
CIrrDeviceWayland* device = static_cast<CIrrDeviceWayland*>(data);
|
||||
|
||||
SEvent irrevent;
|
||||
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,
|
||||
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)
|
||||
{
|
||||
@ -733,11 +733,16 @@ bool CIrrDeviceWayland::initEGL()
|
||||
m_egl_context = new ContextManagerEGL();
|
||||
|
||||
ContextEGLParams egl_params;
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
egl_params.opengl_api = CEGL_API_OPENGL_ES;
|
||||
#else
|
||||
egl_params.opengl_api = CEGL_API_OPENGL;
|
||||
#endif
|
||||
|
||||
if (CreationParams.DriverType == video::EDT_OGLES2)
|
||||
{
|
||||
egl_params.opengl_api = CEGL_API_OPENGL_ES;
|
||||
}
|
||||
else
|
||||
{
|
||||
egl_params.opengl_api = CEGL_API_OPENGL;
|
||||
}
|
||||
|
||||
egl_params.surface_type = CEGL_SURFACE_WINDOW;
|
||||
egl_params.force_legacy_device = CreationParams.ForceLegacyDevice;
|
||||
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()
|
||||
{
|
||||
if (!getCursorControl()->isVisible() && CreationParams.Fullscreen)
|
||||
@ -887,6 +886,8 @@ bool CIrrDeviceWayland::run()
|
||||
{
|
||||
os::Timer::tick();
|
||||
|
||||
wl_display_dispatch_pending(m_display);
|
||||
|
||||
for (unsigned int i = 0; i < m_events.size(); i++)
|
||||
{
|
||||
postEventFromUser(m_events[i]);
|
||||
|
@ -135,7 +135,6 @@ namespace irr
|
||||
static bool isWaylandDeviceWorking();
|
||||
|
||||
ContextManagerEGL* getEGLContext() {return m_egl_context;}
|
||||
void swapBuffers();
|
||||
void updateCursor();
|
||||
unsigned int getWidth() {return m_width;}
|
||||
unsigned int getHeight() {return m_height;}
|
||||
|
@ -54,9 +54,6 @@ namespace video
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||
, HDc(0)
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_WAYLAND_DEVICE_
|
||||
, wl_device(0)
|
||||
#endif
|
||||
, Params(params)
|
||||
{
|
||||
@ -146,7 +143,6 @@ namespace video
|
||||
ColorFormat(ECF_R8G8B8), EglContext(0), Params(params)
|
||||
{
|
||||
EglContext = device->getEGLContext();
|
||||
wl_device = device;
|
||||
genericDriverInit(params.WindowSize, params.Stencilbuffer);
|
||||
}
|
||||
#endif
|
||||
@ -162,7 +158,7 @@ namespace video
|
||||
if (BridgeCalls)
|
||||
delete BridgeCalls;
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_EGL_)
|
||||
#if defined(_IRR_COMPILE_WITH_EGL_) && !defined(_IRR_COMPILE_WITH_WAYLAND_DEVICE_)
|
||||
delete EglContext;
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||
@ -482,30 +478,20 @@ namespace video
|
||||
//! presents the rendered scene on the screen, returns false if failed
|
||||
bool COGLES2Driver::endScene()
|
||||
{
|
||||
CNullDriver::endScene();
|
||||
CNullDriver::endScene();
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_EGL_)
|
||||
#ifdef _IRR_COMPILE_WITH_WAYLAND_DEVICE_
|
||||
if (wl_device != NULL)
|
||||
bool res = EglContext->swapBuffers();
|
||||
|
||||
if (!res)
|
||||
{
|
||||
wl_device->swapBuffers();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
bool res = EglContext->swapBuffers();
|
||||
|
||||
if (!res)
|
||||
{
|
||||
os::Printer::log("Could not swap buffers for OpenGL-ES2 driver.");
|
||||
return false;
|
||||
}
|
||||
os::Printer::log("Could not swap buffers for OpenGL-ES2 driver.");
|
||||
return false;
|
||||
}
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
glFlush();
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, ViewRenderbuffer);
|
||||
Device->displayEnd();
|
||||
glFlush();
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, ViewRenderbuffer);
|
||||
Device->displayEnd();
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
@ -468,9 +468,6 @@ namespace video
|
||||
#if defined(_IRR_COMPILE_WITH_EGL_)
|
||||
ContextManagerEGL* EglContext;
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_WAYLAND_DEVICE_
|
||||
CIrrDeviceWayland* wl_device;
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
CIrrDeviceIPhone* Device;
|
||||
GLuint ViewFramebuffer;
|
||||
|
@ -982,7 +982,7 @@ bool COpenGLDriver::endScene()
|
||||
#ifdef _IRR_COMPILE_WITH_WAYLAND_DEVICE_
|
||||
if (DeviceType == EIDT_WAYLAND)
|
||||
{
|
||||
wl_device->swapBuffers();
|
||||
wl_device->getEGLContext()->swapBuffers();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user