Skip to content

Instantly share code, notes, and snippets.

@matricks
Created June 6, 2012 09:07
Show Gist options
  • Save matricks/2880815 to your computer and use it in GitHub Desktop.
Save matricks/2880815 to your computer and use it in GitHub Desktop.
struct SGfxGlCallInfo
{
unsigned m_ErrorCount;
const char *m_pCallCode;
const char *m_pFilename;
int m_LineNumber;
};
void GfxCheckGlError(SGfxGlCallInfo *pCallInfo)
{
int ErrorCode = glGetError();
if(ErrorCode)
{
if(pCallInfo->m_ErrorCount == 0)
{
dbg_msg("gl", "%s:%d\n\t%s", pCallInfo->m_pFilename, pCallInfo->m_LineNumber, pCallInfo->m_pCallCode);
}
pCallInfo->m_ErrorCount++;
}
}
#define GLCALL(x) x; \
{ \
static SGfxGlCallInfo CallInfo = {0, #x, __FILE__, __LINE__}; \
GfxCheckGlError(&CallInfo); \
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment