Browse Source

Initialize GL object label size to 0 to prevent uninit mem access.

On AMD drivers the debug output has to be explicitly enabled on context
creation, otherwise all debug functions are no-op, thus causing the functions
to read uninitialized memory.
pull/132/head
Vladimír Vondruš 11 years ago
parent
commit
16576552d2
  1. 4
      src/Magnum/AbstractObject.cpp

4
src/Magnum/AbstractObject.cpp

@ -161,7 +161,7 @@ std::string AbstractObject::getLabelImplementationNoOp(GLenum, GLuint) { return
std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, const GLuint name) { std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, const GLuint name) {
/* Get label size (w/o null terminator). Specifying 0 as size is not /* Get label size (w/o null terminator). Specifying 0 as size is not
allowed, thus we pass the maximum instead. */ allowed, thus we pass the maximum instead. */
GLsizei size; GLsizei size = 0;
#ifndef MAGNUM_TARGET_GLES #ifndef MAGNUM_TARGET_GLES
glGetObjectLabel(identifier, name, maxLabelLength(), &size, nullptr); glGetObjectLabel(identifier, name, maxLabelLength(), &size, nullptr);
#elif !defined(CORRADE_TARGET_NACL) #elif !defined(CORRADE_TARGET_NACL)
@ -189,7 +189,7 @@ std::string AbstractObject::getLabelImplementationKhr(const GLenum identifier, c
} }
std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, const GLuint name) { std::string AbstractObject::getLabelImplementationExt(const GLenum identifier, const GLuint name) {
GLsizei size; GLsizei size = 0;
/* Get label size (w/o null terminator) */ /* Get label size (w/o null terminator) */
#ifndef CORRADE_TARGET_NACL #ifndef CORRADE_TARGET_NACL

Loading…
Cancel
Save