1

New project: Top Secret Epic Megagrant Work

 2 years ago
source link: https://www.patreon.com/posts/58563886
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
New project: Top Secret Epic Megagrant Work
New project: Top Secret Epic Megagrant Work

You will not believe the week I'm having.

First, Amir is in Denver with an Oculus Quest strapped to his face, showing off DragonRuby's latest invention, and I'm home frantically making fixes to it while recovering from a booster shot. More on that shortly.

Second, we're burning on all cylinders to get SDL 2.0.18 out the door. We're making bug reports play Red Light Green Light and let's just say they aren't good at holding still when we turn our gaze on them.

I'm also in an ongoing fight with an iPod. It's winning.

And then, in all this frantic chaos, I stop to check my email, and what do I find?

1.png?token-time=1637971200&token-hash=SM5odjsixHBbKVQsje2JWZAawR3NE2TLVaJcWlpCHG0%3D

Well dang.

This was unexpected. I submitted this grant proposal 182 days ago, and was fully prepared by this point for them to say nothing, except eventually, "no." A real not-a-bang-but-a-whimper scenario, y'know?

But it looks like it didn't shake out like that this time.

Lots of people are dying to know what this grant is for. So without further ado, let me tell you a seemingly-unrelated story.

SDL 2.0.18 will have a new feature in it. It will be able to render triangles. Triangles! Can you believe it? We have finally reached feature parity with the original 3DFx Voodoo cards!*

But you have to understand, despite that gentle teasing, I fought for years to prevent this addition.

Because SDL's render API is--intentionally--incredibly basic. I once described it as "the most hyped-up Super Nintendo you've ever seen," because it gives you sprites that you can rotate and scale and a few other primitives and that is it. And if you are making 2D games, this is often all you needed, and you know it is going to work on whatever system you throw at it, figuring out how to rotate those sprites in OpenGL, or GLES, or Direct3D, or Metal, or, crucially when all else fails, even a software renderer.

Of course, people want to make games with more than two dimensions, so there were always requests for more features. We always gently pushed back, because this is the slippiest of slopes. You could look at what OpenGL offered in the mid-2010s and think, okay, but also how about this one more thing?

Then that one more thing would have to be implemented across nine backends, one of them a software renderer of the type that people wrote encyclopedias about how to implement. Then there would be a next one more thing and before you know it you've written a wrapper around the entire OpenGL Compatibility Profile nine times, implemented Software Mesa from scratch, and shipped it all as part of SDL's core API.

And just...hell no.

One day, a valid argument was made that basic 2D triangles are pretty powerful in themselves for not much more code, and it notably makes wiring the excellent Dear Imgui library to an SDL app nice and clean. Even here I was ready to push back but the always-amazing Sylvain Becker showed up not just with a full implementation but also with the software rendering additions and I could fight no longer. In it went.

It won't be long before people are asking for triangles that can set a Z coordinate, or vertex buffers, or the next one more thing, though.

On a long enough timeline, the next one more thing is always shaders. On a long enough timeline, 2D graphics are never going to be good enough.

Our attitude has always been "the 2D API is super-easy to use and if you outgrow it you should use OpenGL directly."

1.png?token-time=1637971200&token-hash=1UkYS02wuFLeuKW94-TV_6PvJ_DYp1Jq2doAxcJW0Y4%3D

But this is terrible advice in 2021, because OpenGL, for all intents and purposes, is a deprecated API. It still works, it's still got some reasonably modern features, but even if you add up the 22 years Microsoft spent trying to kill it with Apple's seven-or-maybe-twenty, it doesn't change the fact that the brains behind OpenGL would rather you migrate to Vulkan, which is also terrible advice.

Vulkan, you see, is kind of...verbose.

1.jpg?token-time=1637971200&token-hash=um9Sot_SIdyP5Y3HPXilaFwqPiZzjQSMVJmFM84hoGo%3D

It seems bonkers to tell people "write these three lines of code to make a window, and then 2000 more to clear it," but that's the migration funnel--and meat grinder--that SDL users are eventually going to get shoved into, and that's unacceptable to me.

Vulkan verbosity aside, all the modern GPU APIs (Vulkan, Metal, and Direct3D 12), all have the same basic structure. Unlike older OpenGL and Direct3D they are no longer state machines, where you turn a bunch of knobs and then say "draw a triangle with those settings" and then dial them around to different positions for the next triangle. Instead, these new APIs operate on the idea of "command queues," where you send a buffer of details down a pipeline and its knobs are completely independent from every other buffer's knobs.

And the more important truth: there's just less knobs in general. Almost all the magic you want to do is done with shaders. Since these GPU APIs have a little programming language of their own, the GPU API itself doesn't have to be super powerful. It can be small, designed to exactly how one would control the hardware efficiently, and the programmer has tons of freedom, because they can get buck-wild in a shader with almost no limits.

So I thought it might be nice if SDL provided something like this itself, the same way it had for a 2D rendering API: a simple, cross-platform, hopefully pleasant-to-use interface that Just Works and finds the best way to get things done with what it finds on the end-user's system. But this time, with all the power and small interface footprint of these next-gen GPU APIs.

Knowing this is going to be months of work, I submitted an Epic Megagrant request for funding specifically for this effort, and now it looks like it's happening!

1.png?token-time=1637971200&token-hash=zebcavMKM9_O_CX-ela5nUzrixFGUIwAAsS2vSpA6uo%3D

I will be saying more about this soon; I intend to document the work here over the next few months.

Also, there are several other Patreon-ish projects that are floating around almost-finished, and those are not being abandoned; I will update here about those as they finish up, as well.

So stay tuned, there will be more information shortly!

* (the original Voodoo cards' triangles had Z coordinates and a depth buffer, though, so like, whatever.)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK