Progress on migrating to Metal is progressing, with a bit of a slow down over Christmas, I’m getting back into it.
I made a few false steps, and perhaps got a bit too into investigating some of the new features in Metal 4 that I got distracted from just writing the simplest pipeline to start with.
I was also hopeful I could have done some nice mixing and matching of rendering techniques using protocols, but that also while possible, is probably too complex. I’ve ended up making 2 parallel rendering pipelines, one for Metal and one for OpenGL, just copying the classes and removing all the openGL code for the metal pipeline so it compiles, then figuring out how to replace everything with Metal.
There’s some small differences to the APIs, probably the biggest one is switching from using openGL contexts, to using Metal’s Command queues, buffers and encoders. With the context, you can just call opengl code without being aware of the context, with the Metal approach, we have to manage the buffers and encoders and pass them around to the code that’s using them. I do see some potential benefits to this in the future though.
It still broadly fits with my rendering model, so the adaption isn’t too painful.
I’ve now just managed to make a simple full render pass, from generating a texture to getting to a drawable, or rather I’ve done it in theory and the code compiles, now I’m learning about Metal debugging!