Browse Source

metal: implement buffer/texture debug names.

Sasha Szpakowski 1 year ago
parent
commit
059cab0364
2 changed files with 9 additions and 0 deletions
  1. 3 0
      src/modules/graphics/metal/Buffer.mm
  2. 6 0
      src/modules/graphics/metal/Texture.mm

+ 3 - 0
src/modules/graphics/metal/Buffer.mm

@@ -76,6 +76,9 @@ Buffer::Buffer(love::graphics::Graphics *gfx, id<MTLDevice> device, const Settin
 	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, *))

+ 6 - 0
src/modules/graphics/metal/Texture.mm

@@ -86,6 +86,9 @@ Texture::Texture(love::graphics::Graphics *gfxbase, id<MTLDevice> device, const
 	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)
@@ -100,6 +103,9 @@ Texture::Texture(love::graphics::Graphics *gfxbase, id<MTLDevice> device, const
 			texture = nil;
 			throw love::Exception("Out of graphics memory.");
 		}
+
+		if (!debugName.empty())
+			msaaTexture.label = [@(debugName.c_str()) stringByAppendingString:@" (MSAA buffer)"];
 	}
 
 	int mipcount = getMipmapCount();