Skip to content

Commit

Permalink
metal: implement buffer/texture debug names.
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Dec 14, 2023
1 parent 7b899fb commit 059cab0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/modules/graphics/metal/Buffer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ static MTLPixelFormat getMTLPixelFormat(DataFormat format)
if (buffer == nil)
throw love::Exception("Could not create buffer with %d bytes (out of VRAM?)", size);

if (!debugName.empty())
buffer.label = @(debugName.c_str());

if (usageFlags & BUFFERUSAGEFLAG_TEXEL)
{
if (@available(iOS 12, macOS 10.14, *))
Expand Down
6 changes: 6 additions & 0 deletions src/modules/graphics/metal/Texture.mm
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ static MTLTextureType getMTLTextureType(TextureType type, int msaa)
if (texture == nil)
throw love::Exception("Out of graphics memory.");

if (!debugName.empty())
texture.label = @(debugName.c_str());

actualMSAASamples = gfx->getClosestMSAASamples(getRequestedMSAA());

if (actualMSAASamples > 1)
Expand All @@ -100,6 +103,9 @@ static MTLTextureType getMTLTextureType(TextureType type, int msaa)
texture = nil;
throw love::Exception("Out of graphics memory.");
}

if (!debugName.empty())
msaaTexture.label = [@(debugName.c_str()) stringByAppendingString:@" (MSAA buffer)"];
}

int mipcount = getMipmapCount();
Expand Down

0 comments on commit 059cab0

Please sign in to comment.