Posts

Post not yet marked as solved
1 Replies
1.6k Views
Hi!I recently discovered this session (https://developer.apple.com/documentation/avfoundation/cameras_and_media_capture/streaming_depth_data_from_the_truedepth_camera ) from the WWDC18 and was wondering how one can extract the point cloud from the depth data without using Metal.My end result is to have the pointcloud as a 3D array which I can save into a .txt file.Best,Rico
Posted
by rmeinl.
Last updated
.
Post not yet marked as solved
1 Replies
1.9k Views
I have one CoreImage Kernel with this namespace "extern "C" { namespace coreimage {" which I have imported like thislet kernel: CIColorKernel let url = Bundle.main.url(forResource: "default", withExtension: "metallib")! let data = try! Data(contentsOf: url) kernel = try! CIColorKernel(functionName: "medianBlend", fromMetalLibraryData: data)and three .metal files with this namespace "using namespace metal;" which I have imported like this:let metalDevice = MTLCreateSystemDefaultDevice()! let defaultLibrary = metalDevice.makeDefaultLibrary()!I cant seem to find a way which compiles both into one library, even though I have tried it using the xcrun command line tool.Can anyone help?
Posted
by rmeinl.
Last updated
.
Post not yet marked as solved
1 Replies
2.1k Views
I tried to add metal files to my project but when i am trying to import them like this:let pipelineDescriptor = MTLRenderPipelineDescriptor() pipelineDescriptor.colorAttachments[0].pixelFormat = .bgra8Unorm pipelineDescriptor.vertexFunction = defaultLibrary.makeFunction(name: "vertexMixer") pipelineDescriptor.fragmentFunction = defaultLibrary.makeFunction(name: "fragmentMixer") do { renderPipelineState = try metalDevice.makeRenderPipelineState(descriptor: pipelineDescriptor) } catch { fatalError("Unable to create video mixer pipeline state. (\(error))") }It throws this error:2019-05-11 20:07:33.715399+0200 Camera[363:16969] -[MTLRenderPipelineDescriptorInternal validateWithDevice:], line 2395: error 'vertexFunction must not be nil.'-[MTLRenderPipelineDescriptorInternal validateWithDevice:]:2395: failed assertion `vertexFunction must not be nil.'Has anyone encountered this before?
Posted
by rmeinl.
Last updated
.
Post not yet marked as solved
0 Replies
1.6k Views
I am trying to scale my MTKView() full screen on an iPhone X and I want to maintain the ratio in regards to the widht (I understand that means that some of the side will be cut off).Can anyone help please?Thats what I am currently doing:required init(coder: NSCoder) { super.init(coder: coder) device = MTLCreateSystemDefaultDevice() configureMetal() createTextureCache() colorPixelFormat = .bgra8Unorm self.framebufferOnly = false self.autoResizeDrawable = false self.contentMode = .scaleAspectFit self.contentScaleFactor = UIScreen.main.scale self.drawableSize = CGSize(width: 2320, height: 3088) }
Posted
by rmeinl.
Last updated
.