News for hackers. Stuff that matters.
Re:Apple introduces macOS Mojave by treeform on Monday June 04, 2018 @05:06PM (#17232459)
What do you think about them forcing you to use Swift or Objective-C for this? Forcing you to use languages that use ref counting and object oriented pointer tables that are traversed at runtime? How much of the gains does objc_msgSend eat up? I though you are against such things?

How ugly would the JAI code to need to be to interface with this?

I wish they had a simple Metal C API, but their new API comes with a bunch of Objective-C baggage.

Re:Apple introduces macOS Mojave by thdoeunt34stnoe on Monday June 04, 2018 @07:08PM (#17233450)
Have you actually used the API? When it comes to submitting geometry and textures (some of the biggest bottlenecks), it's exactly the same as in C. You pass a pointer to your buffer of bytes and they get copied to the GPU for you.
Re:Apple introduces macOS Mojave by astrange on Monday June 04, 2018 @07:57PM (#17233781)
When you're calling any library, that simple C call invariably goes somewhere else inside the library itself. For OpenGL this is because there's always hooks for introspection, or because the GPU driver wants to implement something themselves, etc. For many other libraries it's just because people don't feel like they've written "production quality code" unless it goes through a bunch of hoops and ends up in some method with five underscores in the name.

In Metal the Obj-C abstraction is part of the design and used to eliminate any other abstraction people would want to introduce. The objects you get back from the API are implemented straight in the GPU vendor code, and the debug tools can swap the methods out for extra validation, recording, etc.

Re:Apple introduces macOS Mojave by seandougall on Tuesday June 05, 2018 @01:27AM (#17235190)
Any overhead coming from objc_msgSend is minuscule compared to the gains from things like better serialization of GPU-bound tasks and not having to synchronize repeatedly with the CPU.

If you're worried about refcounting, use ARC (which you have to with Swift anyway). First, the compiler is very smart about optimizing away retain/release/autorelease calls whenever it can. Second, when those calls do have to be made, they're implemented using vtables, and never hit objc_msgSend() in the first place.

Re:Apple introduces macOS Mojave by pjmlp on Monday June 04, 2018 @05:32PM (#17232737)
I think it is about time industry relevant OS vendors start to move away from C, kudos to Apple.