Rendering from a texture

Hi!

Recently, I was wondering how I'd render a single 2d texture to the screen, I've seen things like this:



But that seems hacky. Is that really the only way to do it?
Yeah, that works if you want to display a quad within a metal view. That's actually a lot less code than most rendering APIs.

If you have a metal texture, eg from rendering with Core Image / MPS / your own metal compute kernel and just want to show it in a CALayer, you can make an IOSurface-backed texture and set the IOSurface as the contents of the CALayer.
Rendering from a texture
 
 
Q