LWJGL / lwjgl3

LWJGL is a Java library that enables cross-platform access to popular native APIs useful in the development of graphics (OpenGL, Vulkan, bgfx), audio (OpenAL, Opus), parallel computing (OpenCL, CUDA) and XR (OpenVR, LibOVR, OpenXR) applications.
https://www.lwjgl.org
BSD 3-Clause "New" or "Revised" License
4.75k stars 635 forks source link

metal api #965

Closed expensivecake290 closed 4 days ago

expensivecake290 commented 6 months ago

Library

metal api

Project page

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

Source repository

No response

Platforms

macOS x64, macOS arm64

Description

hi I was wondering if it was possible to add the metal graphics api to LWJGL3 so many can take advantage of apple silicon to have more fps in many use cases for example Minecraft or any other java application

bonenaut7 commented 1 month ago

Have you tried to look at bgfx bindings? BGFX supports multiple backends including Metal and MoltenVK for MacOS

Spasi commented 4 days ago

Hey @expensivecake290,

Technically, it is possible to use Metal using the Objective-C Runtime bindings that LWJGL already provides. However, it would be difficult, ugly and likely slower, because of how the objc_msgSend family of functions need to be called (often via libffi). Things will get better in LWJGL 4, since Panama has proper support for vararg calls.

In any case though, wrapping Metal into a usable Java API would be a huge undertaking, outside the scope of what LWJGL does. Besides, any application that will want to use Metal directly, would also definitely want to use a number of other Apple APIs. It would be more practical for such an app to implement everything directly (e.g. via Panama) and exactly (the calls it needs and nothing else), rather than wait for a library such as LWJGL to create bindings for entire APIs.

Spasi commented 3 days ago

swift-java looks relevant and promising.