by dpJudas » Mon Oct 13, 2025 8:53 am
If you got a working Cocoa backend for ZWidget feel free to PR it. You can already use ZWidget on macOS via its SDL 2 backend, but a native Cocoa one would be preferred once it reaches a similar level of maturity. Even without a Metal renderer it would be useful for GZDoom as it would allow the transition from platform specific launchers to be completed (*).
Regarding writing a Metal renderer, note that porting over the GLSL by hand will only get you partially there as lots of mods come with their own shaders that are also written in GLSL. With the Vulkan backend the MoltenVK layer converts it (GLSL -> SPIRV -> Metal IR whatever that's called), so if you're planning on full support you'd have to find a way to deal with the GLSL coming from mods.
Having worked with Direct3D 9, 11, 12, OpenGL and Vulkan on various projects, it has been my experience that there are no obvious performance benefits to be gained by using the newer ones. You can, theoretically, get better performance with D3D12/Vulkan/Metal, but it depends heavily on re-architecting the entire rendering subsystem to build up command buffers on multiple threads. Simply converting existing commands from an older API to a newer one generally won't do anything. Half the times I've done it I've actually lost performance compared to the older API. Driver heuristics in the older APIs do a lot of stuff that newer APIs simply don't offer (you have to do it yourself), which means stuff was using multiple threads with OpenGL and now it all runs on a single thread on Vulkan and so on. In any case, good luck!
*) Can it already do it with the SDL backend? Don't have an Apple hardware anymore so I didn't try it to find out.
If you got a working Cocoa backend for ZWidget feel free to PR it. You can already use ZWidget on macOS via its SDL 2 backend, but a native Cocoa one would be preferred once it reaches a similar level of maturity. Even without a Metal renderer it would be useful for GZDoom as it would allow the transition from platform specific launchers to be completed (*).
Regarding writing a Metal renderer, note that porting over the GLSL by hand will only get you partially there as lots of mods come with their own shaders that are also written in GLSL. With the Vulkan backend the MoltenVK layer converts it (GLSL -> SPIRV -> Metal IR whatever that's called), so if you're planning on full support you'd have to find a way to deal with the GLSL coming from mods.
Having worked with Direct3D 9, 11, 12, OpenGL and Vulkan on various projects, it has been my experience that there are no obvious performance benefits to be gained by using the newer ones. You can, theoretically, get better performance with D3D12/Vulkan/Metal, but it depends heavily on re-architecting the entire rendering subsystem to build up command buffers on multiple threads. Simply converting existing commands from an older API to a newer one generally won't do anything. Half the times I've done it I've actually lost performance compared to the older API. Driver heuristics in the older APIs do a lot of stuff that newer APIs simply don't offer (you have to do it yourself), which means stuff was using multiple threads with OpenGL and now it all runs on a single thread on Vulkan and so on. In any case, good luck!
*) Can it already do it with the SDL backend? Don't have an Apple hardware anymore so I didn't try it to find out.