Hacker News new | ask | show | jobs
by picture_view 1477 days ago
For the uninitiated, could someone explain why this is important? Is rendering triangles really that difficult?
10 comments

As Carl Sagan purportedly said, "In order to draw a triangle, you must first invent the universe". Once you have a thorough understanding of the proprietary hardware and its drivers, it's not a complicated thing to draw. But you need to do a lot of groundwork to construct that simple shape on less-than-friendly turf.
Not just purportedly - you can watch him say it in the original Cosmos, which I highly recommend.
Strange that the GP's comment is the only google result for the phrase...

edit: Ah, I think the original was "If you wish to make an apple pie from scratch"

It means that most of the rendering pipeline is working: getting data from the CPU- to the GPU-side, compiling, uploading and running shaders (big deal!), fixed-function render states / pipeline-state-objects, rasterization to the framebuffer and displaying the result. I'd wager that getting an untextured triangle on screen is probably 70% of the total work (I'm not a GPU driver coder though, but that number is about right for writing a "user mode" 3D API wrapper).

Also: this is on hardware without any public information available that has to be reverse engineered from scratch, this is the actually incredible part.

This is the first time that the Apple M1 GPU has been able to be used outside of macOS. The earlier work (links elsewhere in thread) was all under macOS. So this means that there has been some reverse engineering of the macOS kernel side of the proprietary macOS driver and we are one step closer to a Linux or BSD kernel driver, which the macOS open source userspace driver could be ported to.
Very hard, if you have to figure out most of the hardware along the way. This triangle was rendered with literally no other software running on the main CPU than what they wrote. So certainly no high level API to call...
Rendering a triangle usually means you have a working driver, meaning you can talk to the GPU and get it to render things via OpenGL / Vulkan / etc.

https://en.wikipedia.org/wiki/Rasterisation

https://rampantgames.com/blog/?p=7745:

“It was sometime in my first week possibly my first or second day. In the main engineering room, there was a whoop and cry of success.

Our company financial controller and acting HR lady, Jen, came in to see what incredible things the engineers and artists had come up with. Everyone was staring at a television set hooked up to a development box for the Sony Playstation. There, on the screen, against a single-color background, was a black triangle.

“It’s a black triangle,” she said in an amused but sarcastic voice. One of the engine programmers tried to explain, but she shook her head and went back to her office. I could almost hear her thoughts… “We’ve got ten months to deliver two games to Sony, and they are cheering over a black triangle? THAT took them nearly a month to develop?”

What she later came to realize (and explain to others) was that the black triangle was a pioneer. It wasn’t just that we’d managed to get a triangle onto the screen. That could be done in about a day. It was the journey the triangle had taken to get up on the screen. It had passed through our new modeling tools, through two different intermediate converter programs, had been loaded up as a complete database, and been rendered through a fairly complex scene hierarchy, fully textured and lit (though there were no lights, so the triangle came out looking black). The black triangle demonstrated that the foundation was finally complete the core of a fairly complex system was completed, and we were now ready to put it to work doing cool stuff. By the end of the day, we had complete models on the screen, manipulating them with the controllers. Within a week, we had an environment to move the model through.

Afterwards, we came to refer to certain types of accomplishments as “black triangles.” These are important accomplishments that take a lot of effort to achieve, but upon completion you don’t have much to show for it only that more work can now proceed. It takes someone who really knows the guts of what you are doing to appreciate a black triangle.”

This is similar, but slightly different. There isn’t months of work on writing tools to render scenes using Sony’s documentation to figure out how to render stuff, but months of work on figuring out what Apple’s internal documentation says about rendering a triangle.

It allows 3D acceleration on M1 Macs when running an OS other than macOS. Linux, specifically.
The tweet doesn't refer to a Linux driver, but to a driver for the Asahi m1n1 bootloader thing:

https://www.phoronix.com/scan.php?page=news_item&px=Asahi-Li...

Currently, yes. But that's just for development purposes. Nobody is expected to run m1n1 itself. One of the reasons for this development is to create a Linux driver doing the same.
It's not difficult as such (I mean a triangle is not hard, but getting something out is), but it's the basic building block. If you can render a triangle, you can render it lots of times and create any scene. (simplifying a bit, but still...)
All the models in 3D games are made up of triangles rendered on the GPU. This is the first time even one triangle has been rendered on an Apple M1 GPU without the macOS kernel driver, using fully reverse engineered open source code.
It's the rendering with undocumented GPU part that's difficult, triangle meshes are the geometry representation used on current GPUs.