From 181a03890158bae7e7d76cb11497c34e2e9b48c3 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Mon, 16 Nov 2015 10:43:27 -1000 Subject: [PATCH] Bug fixes for HECL --- .../boo/graphicsdev/IGraphicsDataFactory.hpp | 2 ++ lib/graphicsdev/GL.cpp | 22 +++++++++++++------ lib/inputdev/HIDListenerUdev.cpp | 14 ++---------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/boo/graphicsdev/IGraphicsDataFactory.hpp b/include/boo/graphicsdev/IGraphicsDataFactory.hpp index a8967ce..ada7972 100644 --- a/include/boo/graphicsdev/IGraphicsDataFactory.hpp +++ b/include/boo/graphicsdev/IGraphicsDataFactory.hpp @@ -13,6 +13,7 @@ struct IGraphicsBuffer protected: bool m_dynamic; IGraphicsBuffer(bool dynamic) : m_dynamic(dynamic) {} + virtual ~IGraphicsBuffer() {} }; /** Static resource buffer for verts, indices, uniform constants */ @@ -59,6 +60,7 @@ struct ITexture protected: Type m_type; ITexture(Type type) : m_type(type) {} + virtual ~ITexture() {} }; /** Static resource buffer for textures */ diff --git a/lib/graphicsdev/GL.cpp b/lib/graphicsdev/GL.cpp index 59df46d..463a4d9 100644 --- a/lib/graphicsdev/GL.cpp +++ b/lib/graphicsdev/GL.cpp @@ -262,6 +262,12 @@ public: other.m_frag = 0; m_prog = other.m_prog; other.m_prog = 0; + m_sfactor = other.m_sfactor; + m_dfactor = other.m_dfactor; + m_depthTest = other.m_depthTest; + m_depthWrite = other.m_depthWrite; + m_backfaceCulling = other.m_backfaceCulling; + m_uniLocs = std::move(other.m_uniLocs); return *this; } GLShaderPipeline(GLShaderPipeline&& other) {*this = std::move(other);} @@ -440,18 +446,20 @@ struct GLShaderDataBinding : IShaderDataBinding m_vtxFormat->bind(); for (size_t i=0 ; idynamic()) - static_cast(m_ubufs[i])->bindUniform(i); + IGraphicsBuffer* ubuf = m_ubufs[i]; + if (ubuf->dynamic()) + static_cast(ubuf)->bindUniform(i); else - static_cast(m_ubufs[i])->bindUniform(i); + static_cast(ubuf)->bindUniform(i); glUniformBlockBinding(prog, m_pipeline->m_uniLocs.at(i), i); } for (size_t i=0 ; itype() == ITexture::TextureDynamic) - static_cast(m_texs[i])->bind(i); - else if (m_texs[i]->type() == ITexture::TextureStatic) - static_cast(m_texs[i])->bind(i); + ITexture* tex = m_texs[i]; + if (tex->type() == ITexture::TextureDynamic) + static_cast(tex)->bind(i); + else if (tex->type() == ITexture::TextureStatic) + static_cast(tex)->bind(i); } } }; diff --git a/lib/inputdev/HIDListenerUdev.cpp b/lib/inputdev/HIDListenerUdev.cpp index c8bd14e..cb8a9a1 100644 --- a/lib/inputdev/HIDListenerUdev.cpp +++ b/lib/inputdev/HIDListenerUdev.cpp @@ -118,10 +118,7 @@ class HIDListenerUdev final : public IHIDListener } /* Empty handler for SIGTERM */ - static void _sigterm(int signo) - { - (void)signo; - } + static void _sigterm(int) {} static void _udevProc(HIDListenerUdev* listener) { @@ -132,13 +129,6 @@ class HIDListenerUdev final : public IHIDListener s.sa_flags = 0; sigaction(SIGTERM, &s, nullptr); - /* SIGTERM will atomically become unblocked - * when pselect is entered */ - sigset_t sigset, oldset; - sigemptyset(&sigset); - sigaddset(&sigset, SIGTERM); - pthread_sigmask(SIG_BLOCK, &sigset, &oldset); - udev_monitor_enable_receiving(listener->m_udevMon); int fd = udev_monitor_get_fd(listener->m_udevMon); while (listener->m_udevRunning) @@ -146,7 +136,7 @@ class HIDListenerUdev final : public IHIDListener fd_set fds; FD_ZERO(&fds); FD_SET(fd, &fds); - if (pselect(fd+1, &fds, nullptr, nullptr, nullptr, &oldset) < 0) + if (select(fd+1, &fds, nullptr, nullptr, nullptr) < 0) { /* SIGTERM handled here */ if (errno == EINTR)