NVIDIAGameWorks / NRI

Low-level abstract render interface
MIT License
205 stars 25 forks source link

Metal Support #88

Open pollend opened 2 weeks ago

pollend commented 2 weeks ago

would there be a problem with introducing support for metal. I would like to use this for some metal applications would there be any problems if I could work on adding support.

dzhdanNV commented 2 weeks ago

Hi Michael! Sure! Currently NRI can be used on Apple via MoltenVK, but, of course, it's worse than native Metal. I'm happy to accept a new implementation (even with limited functionality).

Notes:

pollend commented 2 weeks ago

I need to do some research on how I would do this. there is a cpp provided interface but it seems kind of troublesome so looks like I need to use objective-C. that is the native interface so it probably the preferred way to do so. or maybe void pointers need to do some more research. I'll probably make some notes as I go and see what I'll need to do.

Screenshot 2024-08-28 at 12 12 48 PM
vertver commented 2 weeks ago

@pollend you might want to check out the dawn as the WebGPU API is very similar to the NRI specifics. The only thing that might be different is the pipeline and shader handling, but I don't see any problems here since you already have to manage your shader blobs manually.

vertver commented 2 weeks ago

By the way, if you really want to implement fully featured Metal implementation, you should also implement Metal-compatible shader header with NRICompatibility.hlsli internals.

pollend commented 2 weeks ago

@pollend you might want to check out the dawn as the WebGPU API is very similar to the NRI specifics. The only thing that might be different is the pipeline and shader handling, but I don't see any problems here since you already have to manage your shader binaries manually.

that's a good resource, I guess I need to spend a bit of time studying objective-c++. recently got a MacBook to work on some metal related stuff. I have a project that I was adding support for metal and I would like to add this support to nri for my own use.

vertver commented 2 weeks ago

If you have any questions about NRI or ObjC specifics or testing on macOS machine - feel free to ask me here. I'll answer as soon as possible.

dzhdanNV commented 2 weeks ago

I have just committed shading rate support with a minor interface change (a naming change as usual).

pollend commented 2 weeks ago

just started a little: https://github.com/NVIDIAGameWorks/NRI/pull/89

quite a lot of boilerplate to setup before i have something to compile might take me a couple days to get to that point.

dzhdanNV commented 2 weeks ago

Sorry for the inconvenience, I had to resolve the final issue in the API related to read-only depth and/or stencil. Now it's done. No more API changes planned!

dzhdanNV commented 1 week ago

Sorry, guys, for several releases today. I'm happy with the look of the interface. I really think I'm finished.

pollend commented 1 week ago

Not too bad I rebases my changes without much incident. I have a few questions in the pr I've drafted. Need to study metal examples to get a better idea.