mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
implement #1992
add debugname to settings table for texture and buffer, which can be used for debugging in e.g. RenderDoc.
This commit is contained in:
@@ -68,6 +68,7 @@ static GLenum getGLFormat(DataFormat format)
|
||||
|
||||
Buffer::Buffer(love::graphics::Graphics *gfx, const Settings &settings, const std::vector<DataDeclaration> &format, const void *data, size_t size, size_t arraylength)
|
||||
: love::graphics::Buffer(gfx, settings, format, size, arraylength)
|
||||
, debugName(settings.debugName)
|
||||
{
|
||||
size = getSize();
|
||||
arraylength = getArrayLength();
|
||||
@@ -164,6 +165,9 @@ bool Buffer::load(const void *initialdata)
|
||||
glTexBuffer(target, glformat, buffer);
|
||||
}
|
||||
|
||||
if (!debugName.empty())
|
||||
glObjectLabel(GL_BUFFER, buffer, -1, debugName.c_str());
|
||||
|
||||
return (glGetError() == GL_NO_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,6 +81,8 @@ private:
|
||||
|
||||
Range mappedRange;
|
||||
|
||||
std::string debugName;
|
||||
|
||||
}; // Buffer
|
||||
|
||||
} // opengl
|
||||
|
||||
@@ -227,6 +227,7 @@ Texture::Texture(love::graphics::Graphics *gfx, const Settings &settings, const
|
||||
, framebufferStatus(GL_FRAMEBUFFER_COMPLETE)
|
||||
, textureGLError(GL_NO_ERROR)
|
||||
, actualSamples(1)
|
||||
, debugName(settings.debugName)
|
||||
{
|
||||
if (data != nullptr)
|
||||
slices = *data;
|
||||
@@ -422,6 +423,14 @@ bool Texture::loadVolatile()
|
||||
|
||||
setGraphicsMemorySize(memsize);
|
||||
|
||||
if (!debugName.empty())
|
||||
{
|
||||
if (texture)
|
||||
glObjectLabel(GL_TEXTURE, texture, -1, debugName.c_str());
|
||||
else
|
||||
glObjectLabel(GL_FRAMEBUFFER, renderbuffer, -1, debugName.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,8 @@ private:
|
||||
|
||||
int actualSamples;
|
||||
|
||||
std::string debugName;
|
||||
|
||||
}; // Texture
|
||||
|
||||
} // opengl
|
||||
|
||||
Reference in New Issue
Block a user