opengl: add version checks when setting debug names.

This commit is contained in:
Sasha Szpakowski
2023-12-13 20:27:31 -04:00
parent 9b79d3a91b
commit 7b899fbc17
2 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ bool Buffer::load(const void *initialdata)
glTexBuffer(target, glformat, buffer);
}
if (!debugName.empty())
if (!debugName.empty() && (GLAD_VERSION_4_3 || GLAD_ES_VERSION_3_2))
glObjectLabel(GL_BUFFER, buffer, -1, debugName.c_str());
return (glGetError() == GL_NO_ERROR);
+9 -3
View File
@@ -422,12 +422,18 @@ bool Texture::loadVolatile()
setGraphicsMemorySize(memsize);
if (!debugName.empty())
if (!debugName.empty() && (GLAD_VERSION_4_3 || GLAD_ES_VERSION_3_2))
{
if (texture)
glObjectLabel(GL_TEXTURE, texture, -1, debugName.c_str());
else
glObjectLabel(GL_FRAMEBUFFER, renderbuffer, -1, debugName.c_str());
if (renderbuffer)
{
std::string rname = debugName;
if (actualSamples > 1)
rname += " (MSAA buffer)";
glObjectLabel(GL_RENDERBUFFER, renderbuffer, -1, rname.c_str());
}
}
return true;