public static CVMetalTextureCache?FromDevice(IMTLDevice metalDevice, CVMetalTextureAttributes textureAttributes, out CVReturn creationErr) { if (metalDevice == null) { throw new ArgumentNullException(nameof(metalDevice)); } IntPtr handle; creationErr = (CVReturn)CVMetalTextureCacheCreate(IntPtr.Zero, IntPtr.Zero, /* change one day to support cache attributes */ metalDevice.Handle, textureAttributes?.Dictionary.Handle ?? IntPtr.Zero, out handle); if (creationErr == CVReturn.Success) { return(new CVMetalTextureCache(handle)); } return(null); }
public CVMetalTextureCache(IMTLDevice metalDevice, CVMetalTextureAttributes textureAttributes) { if (metalDevice == null) { throw new ArgumentNullException(nameof(metalDevice)); } CVReturn err = (CVReturn)CVMetalTextureCacheCreate(IntPtr.Zero, IntPtr.Zero, /* change one day to support cache attributes */ metalDevice.Handle, textureAttributes?.Dictionary.Handle ?? IntPtr.Zero, out handle); if (err == CVReturn.Success) { return; } throw new Exception($"Could not create the texture cache, Reason: {err}."); }
public CVMetalTextureCache(IMTLDevice metalDevice, CVMetalTextureAttributes textureAttributes) : base(Create(metalDevice, textureAttributes), true) { }
public static CVMetalTextureCache?FromDevice(IMTLDevice metalDevice, CVMetalTextureAttributes textureAttributes) { CVReturn creationErr; return(FromDevice(metalDevice, textureAttributes, out creationErr)); }