/* * Copyright 2024 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #import "graphite_metal_context_helper.h" #import "include/ports/SkCFObject.h" #import skgpu::graphite::MtlBackendContext GetMetalContext() { skgpu::graphite::MtlBackendContext backendContext = {}; sk_cfp> device; device.reset(MTLCreateSystemDefaultDevice()); sk_cfp> queue; queue.reset([*device newCommandQueue]); backendContext.fDevice.retain((CFTypeRef)device.get()); backendContext.fQueue.retain((CFTypeRef)queue.get()); return backendContext; }