From bb35ded399710b5694de1128da125bfcd7da5985 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Thu, 17 Dec 2015 11:29:47 -1000 Subject: [PATCH] handy debug assert --- lib/graphicsdev/GL.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/graphicsdev/GL.cpp b/lib/graphicsdev/GL.cpp index e7ed850..6157f20 100644 --- a/lib/graphicsdev/GL.cpp +++ b/lib/graphicsdev/GL.cpp @@ -499,6 +499,12 @@ struct GLShaderDataBinding : IShaderDataBinding std::unique_ptr m_ubufs; size_t m_texCount; std::unique_ptr m_texs; + +#ifndef NDEBUG + /* Debugging aids */ + bool m_committed = false; +#endif + GLShaderDataBinding(IShaderPipeline* pipeline, IVertexFormat* vtxFormat, size_t ubufCount, IGraphicsBuffer** ubufs, @@ -517,6 +523,12 @@ struct GLShaderDataBinding : IShaderDataBinding } void bind(int b) const { +#ifndef NDEBUG + if (!m_committed) + Log.report(LogVisor::FatalError, + "attempted to use uncommitted GLShaderDataBinding"); +#endif + GLuint prog = m_pipeline->bind(); m_vtxFormat->bind(b); for (size_t i=0 ; i lk(m_committedMutex); GLData* retval = m_deferredData; + for (std::unique_ptr& b : retval->m_SBinds) + b->m_committed = true; m_deferredData = nullptr; m_committedData.insert(retval); /* Let's go ahead and flush to ensure our data gets to the GPU