News for hackers. Stuff that matters.
Re:Standalone WebAssembly games using I/O devices by LockAndLol on Sunday January 19, 2020 @09:01AM (#22091452)
What about OpenGL?
Re:Standalone WebAssembly games using I/O devices by flohofwoe on Sunday January 19, 2020 @09:08AM (#22091488)
OpenGL is on the way out, and for rendering 2D image data it requires too much setup code (need to create the GL context, a swap chain, a texture, and (unless GL 1.x is used) a vertex buffer, shader and setting up tons of render state).

For 3D rendering, WebGPU would be the better option to support in WASI because it has standalone native implementations:

https://dawn.googlesource.com/dawn

https://github.com/gfx-rs/wgpu

But for blitting CPU-generated 2D image data to the screen WebGPU is also sort of overkill (of course it would be possible to create a much simplified wrapper library in WASM).

Re:Standalone WebAssembly games using I/O devices by pjmlp on Sunday January 19, 2020 @12:22PM (#22092559)
OpenGL will not be on the way out until Khronos defines an high level alternative to Vulkan, as not everyone enjoys being a GPU driver writer for doing graphics.
Re:Standalone WebAssembly games using I/O devices by WAHa_06x36 on Sunday January 19, 2020 @04:10PM (#22094104)
That will most likely be the already mentioned WebGPU.
Re:Standalone WebAssembly games using I/O devices by pjmlp on Sunday January 19, 2020 @05:16PM (#22094505)
That is only for browsers.
Re:Standalone WebAssembly games using I/O devices by grovesNL on Sunday January 19, 2020 @06:48PM (#22095015)
As mentioned by flohofwoe in the parent comment, Dawn and wgpu are both native implementations of WebGPU for use outside the browser. In particular wgpu-rs will allow users to target both the browser API and run natively.

Dawn and wgpu are also collaborating on a common set of native headers (https://github.com/webgpu-native/webgpu-headers) to make it easy to switch between implementations.

Re:Standalone WebAssembly games using I/O devices by pjmlp on Monday January 20, 2020 @02:37AM (#22097096)
That is not a solution, OpenGL 4.6 with AZDO is more capable than WebGPU, just like WebGL 2.0 still lacks many of the OpenGL ES 3.2 capabilities.
Re:Standalone WebAssembly games using I/O devices by grovesNL on Monday January 20, 2020 @10:52AM (#22099654)
I think it's debatable whether WebGPU is less capable than OpenGL 4.6 with AZDO. Even if it is less capable, it doesn't mean WebGPU is not a solution nor only usable by browsers.

Regardless it's the closest portable solution at the moment, and it will continue to add capabilities. The WebGPU CG has already had public meetings with Khronos to talk about running WebGPU on top of Vulkan, and running Vulkan Portability on top of WebGPU. So I think there's a lot of interest in making WebGPU succeed on both web and native targets.

Re:Standalone WebAssembly games using I/O devices by pjmlp on Monday January 20, 2020 @01:46PM (#22101121)
What many of us want is a high level standard that doesn't require being a driver engineer to take advantage of modern GPUs.

If WebGPU ends up being as castrated as WebGL, then we either keep using OpenGL, or change to modern middleware engines (which is what most are doing), with the added benefit that they make the actual 3D API less relevant, it is just a checkbox.

Re:Standalone WebAssembly games using I/O devices by WAHa_06x36 on Saturday January 25, 2020 @07:49AM (#22146036)
I mean, that is exactly what WebGPU is, so I am not understanding why you are so determined to complain about it.
Re:Standalone WebAssembly games using I/O devices by gdxhyrd on Sunday January 19, 2020 @12:10PM (#22092479)
No, OpenGL is not "on the way out". Please back up your claims.
Re:Standalone WebAssembly games using I/O devices by drfuchs on Sunday January 19, 2020 @12:34PM (#22092622)
“Apple deprecates OpenGL across all OSes”: https://www.anandtech.com/show/12894/apple-deprecates-opengl...
Re:Standalone WebAssembly games using I/O devices by gdxhyrd on Sunday January 19, 2020 @01:08PM (#22092843)
Apple is not Khronos.

They haven't supported OpenGL for years anyway, so the fact they deprecate it now is irrelevant.

Re:Standalone WebAssembly games using I/O devices by dahfizz on Sunday January 19, 2020 @02:27PM (#22093378)
A cross platform library loses its potency if it doesn't work cross platform.
Re:Standalone WebAssembly games using I/O devices by gdxhyrd on Sunday January 19, 2020 @03:16PM (#22093728)
OpenGL does not stop being cross-platform just because it does not work natively in 1 platform.

In any case, abstraction layers for macOS already exist.

And, going by your definition, if Apple only allows Metal, then no API will be cross-platform ever anyway.

Re:Standalone WebAssembly games using I/O devices by pjmlp on Sunday January 19, 2020 @05:16PM (#22094513)
OpenGL was never supported on games consoles, so....
Re:Standalone WebAssembly games using I/O devices by flohofwoe on Sunday January 19, 2020 @01:15PM (#22092888)
The GL tools rot is already starting. E.g. the Radeon GPU Profiler supports Vulkan, D3D12, OpenCL, but not OpenGL:

https://gpuopen.com/gaming-product/radeon-gpu-profiler-rgp/

Re:Standalone WebAssembly games using I/O devices by gdxhyrd on Sunday January 19, 2020 @01:24PM (#22092939)
That profiler is meant for low-level debugging as its own description says. That is why it does not support DX11 either.
Re:Standalone WebAssembly games using I/O devices by flohofwoe on Sunday January 19, 2020 @01:57PM (#22093158)
AMD's OpenGL tools don't look too active either, e.g. the last release of CodeXL is from 2018, and this only updated dependencies or removed functionality, for instance this nugget from the release notes:

---

* Removal of components which have been replaced by new standalone tools:

* FrameAnalysis - use https://github.com/GPUOpen-Tools/Radeon-GPUProfiler

---

...that Radeon-GPUProfiler is that tool which has only D3D12 and Vulkan support.

Look around for AMD's OpenGL activity more recently, there's not much, which isn't surprising because they've been lagging behind NVIDIA with their GL drivers since forever. I bet they're eager to close that chapter.

NVIDIA seems more committed to GL still, but without having all GPU vendors on board to continue supporting OpenGL, Khronos won't be able to do much to keep it alive.

Re:Standalone WebAssembly games using I/O devices by Reelin on Sunday January 19, 2020 @04:30PM (#22094242)
> but without having all GPU vendors on board to continue supporting OpenGL, Khronos won't be able to do much to keep it alive

Please don't make things up. OpenGL 4.6 was released in July 2017. According to Wikipedia, modern AMD and NVIDIA cards both gained driver support for it in April 2018. Intel drivers have support since May 2019.

(https://en.wikipedia.org/wiki/OpenGL#OpenGL_4.6)

Re:Standalone WebAssembly games using I/O devices by gdxhyrd on Sunday January 19, 2020 @03:17PM (#22093734)
AMD has always lacked tools and has never produced much on the software side.

That is not news, and that has nothing to do with the state of OpenGL.

Please, stop spreading misinformation about OpenGL.

Re:Standalone WebAssembly games using I/O devices by WAHa_06x36 on Sunday January 19, 2020 @04:12PM (#22094115)
OpenGL absolutely is a legacy API today. It has been an awful impedance mismatch to modern GPUs for about a decade now.
Re:Standalone WebAssembly games using I/O devices by pnako on Sunday January 19, 2020 @06:43PM (#22094993)
It's a high-level API. It went through N generations of graphics hardware for 30 years (40 if you consider IRIS GL).
Re:Standalone WebAssembly games using I/O devices by WAHa_06x36 on Saturday January 25, 2020 @07:48AM (#22146033)
And it became increasingly less of a good fit with each one. By now, it is ridiculously mismatched to the task it needs to perform.

Just leave it to die.

Re:Standalone WebAssembly games using I/O devices by Godel_unicode on Sunday January 19, 2020 @12:27PM (#22092576)
OpenGL is certainly used by a number of creative apps like Photoshop, but you can't deny that the number of games released with OpenGL is down significantly since say 2010.
Re:Standalone WebAssembly games using I/O devices by gdxhyrd on Sunday January 19, 2020 @01:09PM (#22092849)
A lot of games and apps are being released using OpenGL today.

Then there is WebGL and OpenGL ES, widely used everywhere too.

So, no, it is not going anywhere. In fact, Khronos themselves have said so.

Re:Standalone WebAssembly games using I/O devices by Godel_unicode on Sunday January 19, 2020 @06:06PM (#22094772)
I didn't say that there were no OpenGL games being released in 2019/2020 but that the ratio is definitely skewing away from OpenGL. "A lot of games" seems like a stretch compared with what the numbers used to be.

Also I think it's obvious but I'll say it anyway; it's not up to khronos it's up to developers. It doesn't matter if they continue to support OpenGL if developers move to some combination of dx11/12, Vulkan, and Metal.

WebGL and OpenGL ES aren't OpenGL. Their uptake or lack thereof in other arenas is orthogonal to whether people are moving away from OpenGL for game development.

Re:Standalone WebAssembly games using I/O devices by gdxhyrd on Monday January 20, 2020 @04:14AM (#22097534)
Considering UE4 and Unity both support OpenGL, yes, a lot if not the majority of games.

WebGL and OpenGL ES are pretty much OpenGL. Formally they are different standards, but they are based all in OpenGL: if you know one, you know the others pretty well, which is what is important for developers as you agree in the second paragraph.

Re:Standalone WebAssembly games using I/O devices by Godel_unicode on Monday January 20, 2020 @06:02PM (#22102792)
Once again, that's support not implementation. Developers could use OpenGL in Unreal. They could, but they haven't in general. Vulkan is the default, and is the more common choice.

If it were true that lots of games were picking OpenGL, why is it so hard to make a long list of them? It's easy to make such a list for vulkan.

Re:Standalone WebAssembly games using I/O devices by xet7 on Sunday January 19, 2020 @12:40PM (#22092660)
OpenGL is deprecated on macOS and iOS, because Apple has changed to use Metal: https://github.com/godotengine/godot/issues/19368

That's why Godot is moving to Vulkan, that can also run on Metal: https://godotengine.org/article/retrospective-and-future

For Godot game developers, this will not be visible in any way, it's under the hood change to engine.

For other apps, there is in progress development to run full OpenGL on top of Vulkan with Zink. There is a blogpost about it here: https://www.collabora.com/news-and-blog/blog/2018/10/31/intr...

There is also a talk about it at The X.Org Developer's Conference 2019-10-02 here, for example Blender seems to work already: https://youtu.be/rV0P1ChE_5o?t=3970

All conference recordings are listed at conference website: https://xdc2019.x.org/

Re:Standalone WebAssembly games using I/O devices by fenwick67 on Sunday January 19, 2020 @02:27PM (#22093384)
Thanks for sharing Zink, this gives me hope for OpenGL's future.
Re:Standalone WebAssembly games using I/O devices by WAHa_06x36 on Sunday January 19, 2020 @04:10PM (#22094100)
OpenGL really is a legacy API in 2020. There is a massive mismatch between modern GPU design and the OpenGL API design. The only reason it wasn't left behind a decade ago is that there wasn't a decent replacement.

Today, with Vulkan and soon WebGPU available, there really is very little reason to hang on to OpenGL for anything but legacy.

Re:Standalone WebAssembly games using I/O devices by pjmlp on Sunday January 19, 2020 @05:15PM (#22094501)
Yeah, because everyone wants to be a driver writer and compiler expert, in addition to graphics programming.
Re:Standalone WebAssembly games using I/O devices by fenwick67 on Sunday January 19, 2020 @08:07PM (#22095384)
The only platform that has marked it as legacy doesn't support Vulkan (directly) either so I'm not convinced it's dead yet. The simpler API for the minor performance trade-off is still compelling for lots of uses.
Re:Standalone WebAssembly games using I/O devices by WAHa_06x36 on Saturday January 25, 2020 @07:51AM (#22146037)
WebGPU is a simpler API for doing modern rendering, with less tradeoff.

OpenGL is not simple if you want to actually do useful things with it.

Re:Standalone WebAssembly games using I/O devices by _pmf_ on Sunday January 19, 2020 @12:03PM (#22092437)
> What about OpenGL?

You cannot create a window or handle input with OpenGL.

Re:Standalone WebAssembly games using I/O devices by pjmlp on Sunday January 19, 2020 @12:21PM (#22092551)
Sure you can, EGL is part of OpenGL set of standards.
Re:Standalone WebAssembly games using I/O devices by Jasper_ on Sunday January 19, 2020 @01:06PM (#22092823)
EGL doesn't let you create a window, it only lets you bind an OpenGL context to an existing platform window. And input isn't covered by EGL in the slightest.