From 0c086b631b5e78b85a05d8a343736c3b313f1e91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 8 Sep 2015 09:37:13 +0200 Subject: [PATCH] Fix OpenGL object label queries. Passing 0 as bufSize to glGetObjectLabel() is not allowed by the spec even when just querying the size, thus passing the maximum. Might hopefully fix the label queries on AMD drivers. --- src/Magnum/AbstractObject.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Magnum/AbstractObject.cpp b/src/Magnum/AbstractObject.cpp index 82a1a1c4d..a50bc0345 100644 --- a/src/Magnum/AbstractObject.cpp +++ b/src/Magnum/AbstractObject.cpp @@ -159,12 +159,13 @@ void AbstractObject::labelImplementationExt(const GLenum identifier, const GLuin std::string AbstractObject::getLabelImplementationNoOp(GLenum, GLuint) { return {}; } std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, const GLuint name) { - /* Get label size (w/o null terminator) */ + /* Get label size (w/o null terminator). Specifying 0 as size is not + allowed, thus we pass the maximum instead. */ GLsizei size; #ifndef MAGNUM_TARGET_GLES - glGetObjectLabel(identifier, name, 0, &size, nullptr); + glGetObjectLabel(identifier, name, maxLabelLength(), &size, nullptr); #elif !defined(CORRADE_TARGET_NACL) - glGetObjectLabelKHR(identifier, name, 0, &size, nullptr); + glGetObjectLabelKHR(identifier, name, maxLabelLength(), &size, nullptr); #else static_cast(identifier); static_cast(name);