diff --git a/Graphics/GraphicsEngineOpenGL/include/GLObjectWrapper.hpp b/Graphics/GraphicsEngineOpenGL/include/GLObjectWrapper.hpp index 197d63701..a61dc87c3 100644 --- a/Graphics/GraphicsEngineOpenGL/include/GLObjectWrapper.hpp +++ b/Graphics/GraphicsEngineOpenGL/include/GLObjectWrapper.hpp @@ -126,7 +126,29 @@ class GLObjWrapper VERIFY_EXPR(Name != nullptr); if (glObjectLabel && m_uiHandle) { - glObjectLabel(m_CreateReleaseHelper.Type, m_uiHandle, -1, Name); + static GLint MaxLabelLen = 0; + if (MaxLabelLen == 0) + { + glGetIntegerv(GL_MAX_LABEL_LENGTH, &MaxLabelLen); +# ifdef DILIGENT_DEVELOPMENT + glGetError(); // Ignore GL error +# endif + if (MaxLabelLen <= 0) + { + // Minimum required value by the spec + MaxLabelLen = 256; + } + + // The spec requires that the number of characters in