Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GL_CHECK macro on Windows #2277

Merged
merged 1 commit into from
Jul 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/gl/framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void FrameBuffer::init(RenderState& _rs) {
}

GLenum status = GL::checkFramebufferStatus(GL_FRAMEBUFFER);
GL_CHECK();
GL_CHECK({});

if (status != GL_FRAMEBUFFER_COMPLETE) {
LOGE("Framebuffer status is incomplete:");
Expand Down
2 changes: 2 additions & 0 deletions core/src/gl/glError.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class GLError {

};

// On Windows you should provide valid C++ statement for macro to compile
// using {} works good enough
#ifdef DEBUG
#define GL_CHECK(STMT) do { STMT; Tangram::GLError::error(#STMT, __FILE__, __LINE__); } while (0)
#else
Expand Down
16 changes: 8 additions & 8 deletions platforms/common/platform_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GLenum GL::getError() {

const GLubyte* GL::getString(GLenum name) {
auto result = glGetString(name);
GL_CHECK();
GL_CHECK({});
return result;
}

Expand Down Expand Up @@ -86,12 +86,12 @@ void GL::deleteShader(GLuint shader) {
}
GLuint GL::createShader(GLenum type) {
auto result = glCreateShader(type);
GL_CHECK();
GL_CHECK({});
return result;
}
GLuint GL::createProgram() {
auto result = glCreateProgram();
GL_CHECK();
GL_CHECK({});
return result;
}

Expand All @@ -117,12 +117,12 @@ void GL::getProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, GLc
}
GLint GL::getUniformLocation(GLuint program, const GLchar *name) {
auto result = glGetUniformLocation(program, name);
GL_CHECK();
GL_CHECK({});
return result;
}
GLint GL::getAttribLocation(GLuint program, const GLchar *name) {
auto result = glGetAttribLocation(program, name);
GL_CHECK();
GL_CHECK({});
return result;
}
void GL::getProgramiv(GLuint program, GLenum pname, GLint *params) {
Expand Down Expand Up @@ -263,12 +263,12 @@ void GL::uniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, co
// mapbuffer
void* GL::mapBuffer(GLenum target, GLenum access) {
auto result = glMapBuffer(target, access);
GL_CHECK();
GL_CHECK({});
return result;
}
GLboolean GL::unmapBuffer(GLenum target) {
auto result = glUnmapBuffer(target);
GL_CHECK();
GL_CHECK({});
return result;
}

Expand Down Expand Up @@ -329,7 +329,7 @@ void GL::deleteRenderbuffers(GLsizei n, const GLuint *renderbuffers) {

GLenum GL::checkFramebufferStatus(GLenum target) {
GLenum status = glCheckFramebufferStatus(target);
GL_CHECK();
GL_CHECK({});
return status;
}

Expand Down