rust-windowing/raw-window-handle

Question: Why are we exposing canvas elements instead of just any node?

madsmtm opened this issue · 2 comments

Since there are multiple ways to render on the web, including inserting e.g. an svg into the page, it seems to me like it would be more generic to give graphics crates a Node or something, and then let them create and insert an inner element?

Or maybe there's something I'm missing here?

WebGL and WebGPU both work with canvases, and expect the canvas to already exist somewhere (in memory as an element or offscreen canvas, or a node in the DOM).

People can create canvases ahead of time to style them, insert them at the right place at the DOM, attach event handlers, etc. so it doesn't really make sense for the graphics crate to take on the responsibility of creating it and surfacing ways to do all of these things.

We could also have handles for SVGs or other elements, but in practice this isn't very useful for the places raw-window-handle is currently used.

Agreeing with @grovesNL here. We should only really expose handles that directly interact with GPU APIs.