Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebGL #1629

Closed
dsseng opened this issue Jan 30, 2019 · 22 comments
Closed

WebGL #1629

dsseng opened this issue Jan 30, 2019 · 22 comments
Labels
suggestion suggestions for new features (yet to be agreed) web related to Web APIs

Comments

@dsseng
Copy link
Contributor

dsseng commented Jan 30, 2019

Idea: create a GPGPU library or even standart functions for Deno.

@kyranet
Copy link
Contributor

kyranet commented Jan 30, 2019

I believe this is out of the scope for Deno... we do not need to implement every library in core, but you can make one and PR a link in registry

@ry
Copy link
Member

ry commented Jan 30, 2019

Not out of scope. I want to support WebGL in core. But i won't be ready to start this for many months.

@ry ry added this to the future milestone Jan 30, 2019
@ry ry changed the title Wanted: GPGPU WebGL Jan 30, 2019
@dsseng
Copy link
Contributor Author

dsseng commented Jan 30, 2019

@kyranet It needs native bindings, you can't use OpenCL/CUDA in JS 😆

@kyranet
Copy link
Contributor

kyranet commented Jan 30, 2019

I assume this would slowly lead to a native implementation of canvas in Deno, right? I find this a very complicated task, but also one of the most interesting things 😄

And sorry about my previous message, I wasn't very sure of what @sh7dm meant with GPGPU 👍

@ry
Copy link
Member

ry commented Jan 30, 2019

The plan is to use Angle: https://cs.chromium.org/chromium/src/third_party/angle/BUILD.gn

following the example of https://github.com/stackgl/headless-gl

@dsseng
Copy link
Contributor Author

dsseng commented Jan 30, 2019

@ry it renders its output to file?

@KeKsBoTer
Copy link

@sh7dm rendering to an image is one option. But you can also create a window with Angle, as seen in this example: https://cs.chromium.org/chromium/src/third_party/angle/samples/WindowTest/WindowTest.cpp?g=0

@quininer
Copy link

quininer commented Feb 6, 2019

Although still not a standard, webgpu is also an interesting choice.

@dsseng
Copy link
Contributor Author

dsseng commented Feb 6, 2019

@quininer interesting

@EisenbergEffect
Copy link

I'd love to see this happen!

I've been building a TypeScript UI framework on top of Skia (via CanvasKit) and Aurelia vNext. It's still early, but very promising (think of it as a competitor to Flutter, but heavily inspired by WPF). I had hoped, as a phase two, to look into trying to convince the Deno team to surface WebGL APIs and a mechanism to create platform windows. I think there's a compelling set of scenarios here for building cross-platform games and GUIs without HTML/CSS being involved, and with a stronger, capabilities-based security model. Sadly, I wouldn't say that I have the experience required to make this contribution to Deno myself, but I'd love to be involved in providing use cases and helping to prove out what Deno ends up supporting. I'm also happy to act as a liaison to the Skia folks, as I think having CanvasKit enabled for Deno, independent of my own work, is a very powerful enabler. I could also help coordinate with other popular libraries, such as Pixi.js and Babylon.js. My open source team has some presence in those communities and I think it's to all our benefit to collaborate and try to make this happen.

Thanks for all the awesome work that's going on here. Keep it up Deno team!

@Brooooooklyn
Copy link

I will have a try to implement a minimal demo with https://github.com/rust-skia/rust-skia and https://github.com/pcwalton/surfman when I had time.

@hayd
Copy link
Contributor

hayd commented Feb 26, 2020

aside: rust-skia looks like a good candidate to use https://github.com/denoland/cargo_gn

@Uzume
Copy link

Uzume commented Apr 10, 2020

Instead of supporting WebGL directly in core (or at least in addition to), it might make more sense to consider WebGPU. I realize it is early in the process for such things but we are already on the bleeding edge for several other things like WASM ESM, etc. and there is already wgpu, a rust implementation we might be able to bring in via cargo.

@chances
Copy link

chances commented Apr 19, 2020

Considering WebGPU, I'm working on bindings to wgpu-rs following the WebGPU IDL interface as a Deno plugin.

@lin7sh
Copy link

lin7sh commented May 14, 2020

@maierfelix has been made a webgpu-node implementation based on Google's Dawn working with Nodejs, and even made ray-tracing extension works!!. better integrate his excellent work

And more importantly, enabling webgpu based tensorflow.js

@KeKsBoTer
Copy link

@mko-io I would prefer the webgpu rust implementation since deno is also written in rust.
One could also argue that Google's Dawn will work better with v8.
IMO wgpu-rs is still the better choice for deno.

@crowlKats
Copy link
Member

crowlKats commented Oct 12, 2020

I think glow would be the right way support WebGL

@kitsonk kitsonk added feat new feature (which has been agreed to/accepted) web related to Web APIs labels Nov 5, 2020
@bartlomieju bartlomieju added suggestion suggestions for new features (yet to be agreed) and removed feat new feature (which has been agreed to/accepted) labels Nov 18, 2020
@DjDeveloperr
Copy link
Contributor

Are there still plans to implement WebGL considering WebGPU has landed already?

@crowlKats
Copy link
Member

WebGL can technically be polyfilled using webgpu, but that's quite the task, but i think that would be the best solution, as we wouldn't need to depend on a second graphics api

@lucacasonato
Copy link
Member

I'm going to close this. We have WebGPU now, which is going to be capable of everything WebGL is. There is no point in implementing both APIs (like fetch and XXLHttpRequest).

@Uzume
Copy link

Uzume commented Mar 25, 2021

I am assuming this is closed due to #7863 and the recent merge of #7977. Now we just need a WebGL polyfill (implemented using the WebGPU API). It might be possible to do this in TypeScript/JavaScript but a Rust implementation could be interesting too.

@chirsz-ever
Copy link
Contributor

I am assuming this is closed due to #7863 and the recent merge of #7977. Now we just need a WebGL polyfill (implemented using the WebGPU API). It might be possible to do this in TypeScript/JavaScript but a Rust implementation could be interesting too.

Do you have any good idea about "WebGL polyfill over WebGPU"? I am interested in such a thing. WebGL need a canvas for create context, and the corresponding thing in deno is Deno.UnsafeWindowSurface ? We can use the polyfill like this:

// modified from https://deno.com/blog/v1.40#webgpu-windowing--bring-your-own-window
import {
  EventType,
  WindowBuilder,
} from "https://deno.land/x/sdl2@0.8.0/mod.ts";

const win = new WindowBuilder("Hello, World!", 800, 600).build();

/* Returns a Deno.UnsafeWindowSurface */
const surface = win.windowSurface();
/* Returns a WebGL WebGLRenderingContext */
const gl = surface.getContext("webgl");
gl.Clear(gl.COLOR_BUFFER_BIT);

Is this good?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
suggestion suggestions for new features (yet to be agreed) web related to Web APIs
Projects
None yet
Development

No branches or pull requests