Questions tagged [metal]

Metal is a proprietary framework for GPU-accelerated advanced 3D graphics rendering and data-parallel computation workloads. Made by Apple.

Metal is a proprietary framework for GPU-accelerated advanced 3D graphics rendering and data-parallel computation workloads. Made by Apple.

Metal provides the lowest-overhead access to the GPU, enabling you to maximize the graphics and compute potential of your apps on iOS, OS X, and tvOS. With a streamlined API, precompiled shaders, and support for efficient multi-threading, Metal can take your game or graphics app to the next level of performance and capability.


OpenGL Vs Metal

OpenGL vs Metal

Red: The game
Blue: is GPU use


Metal is specifically designed to exploit modern architectural considerations, such as multiprocessing and shared memory, to make it easy to parallelize the creation of GPU commands. This design philosophy extends to the tools used to build iOS apps.

From https://developer.apple.com/metal/.

2141 questions
71
votes
1 answer

RealityKit vs SceneKit vs Metal – High-Quality Rendering

I'm creating an iOS app that I intend to display realistic/high-quality renders within AR. Whilst experimenting with these 3 options, I'm still unsure which of them I should go forward with developing my app's framework around: SceneKit, RealityKit…
rmLuma
  • 829
  • 1
  • 6
  • 4
39
votes
4 answers

Xcode logging: "Metal API Validation Enabled"

I'm building a macOS app via Xcode. Every time I build, I get the log output: Metal API Validation Enabled To my knowledge my app is not using any Metal features. I'm not using hardware-accelerated 3D graphics or shaders or video game features or…
pkamb
  • 33,281
  • 23
  • 160
  • 191
31
votes
1 answer

Using a MTLTexture as the environment map of a SCNScene

I want to set a MTLTexture object as the environment map of a scene, as it seems to be possible according to the documentation. I can set the environment map to be a UIImage with the following code: let roomImage = UIImage(named:…
halileohalilei
  • 2,220
  • 2
  • 25
  • 52
31
votes
2 answers

Why is writing to a buffer from within a fragment shader disallowed in Metal?

As stated in the Metal Shading Language Guide: Writes to a buffer or a texture are disallowed from a fragment function. I understand that this is the case, but I'm curious as to why. Being able to write to a buffer from within a fragment shader is…
lcmylin
  • 2,552
  • 2
  • 19
  • 31
29
votes
2 answers

LiDAR and RealityKit – Capture a Real World Texture for a Scanned Model

Task I would like to capture a real-world texture and apply it to a reconstructed mesh produced with a help of LiDAR scanner. I suppose that Projection-View-Model matrices should be used for that. A texture must be made from fixed Point-of-View, for…
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
28
votes
2 answers

Memory write performance - GPU CPU Shared Memory

I'm allocating both input and output MTLBuffer using posix_memalign according to the shared GPU/CPU documentation provided by memkite. Aside: it is easier to just use latest API than muck around with posix_memalign let metalBuffer =…
Cameron Lowell Palmer
  • 21,528
  • 7
  • 125
  • 126
22
votes
1 answer

SceneKit Cocoa snapshot failed assertion

I am working on a Swift/Cocoa/Xcode application. This application contains a SceneKit View. The rendering API is set to Default (I think this is Metal). If I run a snapshot() on this SceneKit view object, I get this error message. What I want to do…
Bob5421
  • 7,757
  • 14
  • 81
  • 175
20
votes
2 answers

Capture Metal MTKView as Movie in realtime?

What is the most efficient way to capture frames from a MTKView? If possible, I would like to save a .mov file from the frames in realtime. Is it possible to render into an AVPlayer frame or something? It is currently drawing with this code (based…
Jeshua Lacock
  • 5,730
  • 1
  • 28
  • 58
20
votes
4 answers

Holding onto a MTLTexture from a CVImageBuffer causes stuttering

I'm creating a MTLTexture from CVImageBuffers (from camera and players) using CVMetalTextureCacheCreateTextureFromImage to get a CVMetalTexture and then CVMetalTextureGetTexture to get the MTLTexture. The problem I'm seeing is that when I later…
Blixt
  • 49,547
  • 13
  • 120
  • 153
20
votes
5 answers

QuartzCore/CAMetalLayer.h file not found

I try to check out the new Samples from the new Metal API for iOS. When i download the code an open it in the XCode 6 Beta I'm getting the following error message: QuartzCore/CAMetalLayer.h file not found Do i need to add some other files or am I…
Brixto
  • 253
  • 1
  • 3
  • 8
19
votes
1 answer

Are MTLVertexAttributeDescriptors necessary? Why are they needed?

I've been learning Metal for iOS / OSX, and I began by following a Ray Wenderlich tutorial. This tutorial works fine but it makes no mention of MTLVertexAttributeDescriptors. Now that I'm developing my own app, I'm getting weird glitches and I'm…
bsabiston
  • 721
  • 6
  • 22
18
votes
1 answer

CoreML / MLModelConfig preferredMetalDevice - understanding device placement heuristics

Is there any public document that clearly states CoreML's strategy for GPU device placement when running inference models on macOS? How does it decide if it should run on integrated, discrete or CPU? Can one reliably 'force' one path? How does this…
vade
  • 702
  • 4
  • 22
18
votes
3 answers

Metal file as part of an iOS framework

I am trying to create a framework that works with METAL Api (iOS). I am pretty new to this platform and I would like to know how to build the framework to work with .metal files (I am building a static lib, not dynamic). Should they be a part of the…
DocForNoc
  • 346
  • 2
  • 13
17
votes
1 answer

Passing textures with UInt8 component type to Metal compute shader

I have an image that I generate programmatically and I want to send this image as a texture to a compute shader. The way I generate this image is that I calculate each of the RGBA components as UInt8 values, and combine them into a UInt32 and store…
halileohalilei
  • 2,220
  • 2
  • 25
  • 52
17
votes
3 answers

Metal iOS gives compile error

import UIKit import Metal import QuartzCore class ViewController: UIViewController { var device: MTLDevice! = nil var metalLayer: CAMetalLayer! = nil override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after…
Pocketkid2
  • 803
  • 1
  • 11
  • 16
1
2 3
99 100