Add missing CHECK_ERROR

This commit is contained in:
Leith Bade
2014-12-11 00:14:46 +11:00
parent d599fc5504
commit df2ebadaa3
2 changed files with 15 additions and 16 deletions

View File

@@ -36,6 +36,13 @@ struct Error : ::std::runtime_error {
const GLenum code;
};
void checkError(const char *cmd, const char *file, int line);
#if defined(DEBUG)
#define MBGL_CHECK_ERROR(cmd) ([&]() { struct _ { inline ~_() { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } _; return cmd; }())
#else
#define MBGL_CHECK_ERROR(cmd) (cmd)
#endif
// GL_KHR_debug / GL_ARB_debug_output
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
@@ -162,9 +169,9 @@ extern PFNGLPROGRAMPARAMETERIPROC ProgramParameteri;
// static int indent = 0;
inline void start_group(const std::string &str) {
if (gl::PushDebugGroup != nullptr) {
gl::PushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, GLsizei(str.size()), str.c_str());
MBGL_CHECK_ERROR(gl::PushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, GLsizei(str.size()), str.c_str()));
} else if (gl::PushGroupMarkerEXT != nullptr) {
gl::PushGroupMarkerEXT(GLsizei(str.size()), str.c_str());
MBGL_CHECK_ERROR(gl::PushGroupMarkerEXT(GLsizei(str.size()), str.c_str()));
}
// fprintf(stderr, "%s%s\n", std::string(indent * 4, ' ').c_str(), str.c_str());
// indent++;
@@ -172,9 +179,9 @@ inline void start_group(const std::string &str) {
inline void end_group() {
if (gl::PopDebugGroup != nullptr) {
gl::PopDebugGroup();
MBGL_CHECK_ERROR(gl::PopDebugGroup());
} else if (gl::PopGroupMarkerEXT != nullptr) {
gl::PopGroupMarkerEXT();
MBGL_CHECK_ERROR(gl::PopGroupMarkerEXT());
}
// indent--;
}
@@ -188,8 +195,6 @@ struct group {
~group() { end_group(); };
};
void checkError(const char *cmd, const char *file, int line);
}
}
@@ -198,10 +203,4 @@ void checkError(const char *cmd, const char *file, int line);
#define glDepthRange glDepthRangef
#endif
#if defined(DEBUG)
#define MBGL_CHECK_ERROR(cmd) ([&]() { struct _ { inline ~_() { ::mbgl::gl::checkError(#cmd, __FILE__, __LINE__); } } _; return cmd; }())
#else
#define MBGL_CHECK_ERROR(cmd) (cmd)
#endif
#endif

View File

@@ -18,12 +18,12 @@ PrerenderedTexture::~PrerenderedTexture() {
}
if (fboDepth != 0) {
glDeleteRenderbuffers(1, &fboDepth);
MBGL_CHECK_ERROR(glDeleteRenderbuffers(1, &fboDepth));
fboDepth = 0;
}
if (fboStencil != 0) {
glDeleteRenderbuffers(1, &fboStencil);
MBGL_CHECK_ERROR(glDeleteRenderbuffers(1, &fboStencil));
fboStencil = 0;
}
@@ -99,8 +99,8 @@ void PrerenderedTexture::bindFramebuffer() {
MBGL_CHECK_ERROR(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fboDepth));
#endif
} else {
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fboDepth);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fboStencil);
MBGL_CHECK_ERROR(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, fboDepth));
MBGL_CHECK_ERROR(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, fboStencil));
}
GLenum status = MBGL_CHECK_ERROR(glCheckFramebufferStatus(GL_FRAMEBUFFER));