Cleanup: GPU: Replace multiple checks by GLContext::debug_layer_support

This commit is contained in:
2020-09-09 00:23:48 +02:00
parent 25380802d7
commit f7fab77f85
8 changed files with 19 additions and 31 deletions

View File

@@ -63,13 +63,11 @@ GLFrameBuffer::GLFrameBuffer(
viewport_[2] = scissor_[2] = w;
viewport_[3] = scissor_[3] = h;
#ifndef __APPLE__
if (fbo_id_ && (G.debug & G_DEBUG_GPU) && (GLEW_VERSION_4_3 || GLEW_KHR_debug)) {
if (fbo_id_ && GLContext::debug_layer_support) {
char sh_name[32];
SNPRINTF(sh_name, "FrameBuffer-%s", name);
glObjectLabel(GL_FRAMEBUFFER, fbo_id_, -1, sh_name);
}
#endif
}
GLFrameBuffer::~GLFrameBuffer()
@@ -100,15 +98,13 @@ void GLFrameBuffer::init(void)
state_manager_ = static_cast<GLStateManager *>(context_->state_manager);
glGenFramebuffers(1, &fbo_id_);
#ifndef __APPLE__
if ((G.debug & G_DEBUG_GPU) && (GLEW_VERSION_4_3 || GLEW_KHR_debug)) {
if (GLContext::debug_layer_support) {
char sh_name[64];
SNPRINTF(sh_name, "FrameBuffer-%s", name_);
/* Binding before setting the label is needed on some drivers. */
glBindFramebuffer(GL_FRAMEBUFFER, fbo_id_);
glObjectLabel(GL_FRAMEBUFFER, fbo_id_, -1, sh_name);
}
#endif
}
/** \} */