Bug fixes for HECL

This commit is contained in:
Jack Andersen 2015-11-16 10:43:27 -10:00
parent d75c675f7a
commit 181a038901
3 changed files with 19 additions and 19 deletions

View File

@ -13,6 +13,7 @@ struct IGraphicsBuffer
protected: protected:
bool m_dynamic; bool m_dynamic;
IGraphicsBuffer(bool dynamic) : m_dynamic(dynamic) {} IGraphicsBuffer(bool dynamic) : m_dynamic(dynamic) {}
virtual ~IGraphicsBuffer() {}
}; };
/** Static resource buffer for verts, indices, uniform constants */ /** Static resource buffer for verts, indices, uniform constants */
@ -59,6 +60,7 @@ struct ITexture
protected: protected:
Type m_type; Type m_type;
ITexture(Type type) : m_type(type) {} ITexture(Type type) : m_type(type) {}
virtual ~ITexture() {}
}; };
/** Static resource buffer for textures */ /** Static resource buffer for textures */

View File

@ -262,6 +262,12 @@ public:
other.m_frag = 0; other.m_frag = 0;
m_prog = other.m_prog; m_prog = other.m_prog;
other.m_prog = 0; 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; return *this;
} }
GLShaderPipeline(GLShaderPipeline&& other) {*this = std::move(other);} GLShaderPipeline(GLShaderPipeline&& other) {*this = std::move(other);}
@ -440,18 +446,20 @@ struct GLShaderDataBinding : IShaderDataBinding
m_vtxFormat->bind(); m_vtxFormat->bind();
for (size_t i=0 ; i<m_ubufCount ; ++i) for (size_t i=0 ; i<m_ubufCount ; ++i)
{ {
if (m_ubufs[i]->dynamic()) IGraphicsBuffer* ubuf = m_ubufs[i];
static_cast<GLGraphicsBufferD*>(m_ubufs[i])->bindUniform(i); if (ubuf->dynamic())
static_cast<GLGraphicsBufferD*>(ubuf)->bindUniform(i);
else else
static_cast<GLGraphicsBufferS*>(m_ubufs[i])->bindUniform(i); static_cast<GLGraphicsBufferS*>(ubuf)->bindUniform(i);
glUniformBlockBinding(prog, m_pipeline->m_uniLocs.at(i), i); glUniformBlockBinding(prog, m_pipeline->m_uniLocs.at(i), i);
} }
for (size_t i=0 ; i<m_texCount ; ++i) for (size_t i=0 ; i<m_texCount ; ++i)
{ {
if (m_texs[i]->type() == ITexture::TextureDynamic) ITexture* tex = m_texs[i];
static_cast<GLTextureD*>(m_texs[i])->bind(i); if (tex->type() == ITexture::TextureDynamic)
else if (m_texs[i]->type() == ITexture::TextureStatic) static_cast<GLTextureD*>(tex)->bind(i);
static_cast<GLTextureS*>(m_texs[i])->bind(i); else if (tex->type() == ITexture::TextureStatic)
static_cast<GLTextureS*>(tex)->bind(i);
} }
} }
}; };

View File

@ -118,10 +118,7 @@ class HIDListenerUdev final : public IHIDListener
} }
/* Empty handler for SIGTERM */ /* Empty handler for SIGTERM */
static void _sigterm(int signo) static void _sigterm(int) {}
{
(void)signo;
}
static void _udevProc(HIDListenerUdev* listener) static void _udevProc(HIDListenerUdev* listener)
{ {
@ -132,13 +129,6 @@ class HIDListenerUdev final : public IHIDListener
s.sa_flags = 0; s.sa_flags = 0;
sigaction(SIGTERM, &s, nullptr); 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); udev_monitor_enable_receiving(listener->m_udevMon);
int fd = udev_monitor_get_fd(listener->m_udevMon); int fd = udev_monitor_get_fd(listener->m_udevMon);
while (listener->m_udevRunning) while (listener->m_udevRunning)
@ -146,7 +136,7 @@ class HIDListenerUdev final : public IHIDListener
fd_set fds; fd_set fds;
FD_ZERO(&fds); FD_ZERO(&fds);
FD_SET(fd, &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 */ /* SIGTERM handled here */
if (errno == EINTR) if (errno == EINTR)