Renderer: Eliminates String allocations for all labels in the renderer

Uses `Span<char>` to avoid additional allocations in the graph.
This commit is contained in:
Stuart Carnie 2025-05-23 06:52:10 +10:00
parent 6c9765d87e
commit 7d93119353
10 changed files with 30 additions and 19 deletions

View file

@ -56,6 +56,8 @@ class PixelFormats;
class MDResourceCache;
class API_AVAILABLE(macos(11.0), ios(14.0), tvos(14.0)) RenderingContextDriverMetal : public RenderingContextDriver {
bool capture_available = false;
protected:
#ifdef __OBJC__
id<MTLDevice> metal_device = nullptr;
@ -80,7 +82,7 @@ public:
void surface_set_needs_resize(SurfaceID p_surface, bool p_needs_resize) final override;
bool surface_get_needs_resize(SurfaceID p_surface) const final override;
void surface_destroy(SurfaceID p_surface) final override;
bool is_debug_utils_enabled() const final override { return true; }
bool is_debug_utils_enabled() const final override { return capture_available; }
#pragma mark - Metal-specific methods

View file

@ -45,6 +45,10 @@ RenderingContextDriverMetal::~RenderingContextDriverMetal() {
}
Error RenderingContextDriverMetal::initialize() {
if (OS::get_singleton()->get_environment(U"METAL_DEVICE_WRAPPER_TYPE") == "1") {
capture_available = true;
}
metal_device = MTLCreateSystemDefaultDevice();
#if TARGET_OS_OSX
if (@available(macOS 13.3, *)) {