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

[Mesh] are the objects necessary at all? #47

Open
domenic opened this issue Aug 15, 2024 · 1 comment
Open

[Mesh] are the objects necessary at all? #47

domenic opened this issue Aug 15, 2024 · 1 comment

Comments

@domenic
Copy link
Collaborator

domenic commented Aug 15, 2024

drawMesh() accepts Mesh2DVertexBuffer, Mesh2DUVBuffer, Mesh2DIndexBuffer, and Mesh2DColorBuffer objects. But those objects appear to be just thin wrappers over Float32Arrays.

Could it just accept Float32Arrays directly? Then those objects don't need to be defined.

If those objects existing is especially useful because they represent some sort of pre-computation that happens at construction time, then it would be good to explain that in the explainer.

@fmalita
Copy link
Collaborator

fmalita commented Aug 19, 2024

The intent is to facilitate implementation perf optimizations.

One common taxing use case is animating a huge number of vertices - which implies large buffers, some of which are static inter-frame (e.g. most of the time the vertex positions get updated while the UV mapping remains fixed).

Having a persistent handle allows implementations to store buffer data in a format/layer as close to the HW as possible, and to avoid copying/processing large amounts of static data redundantly for each frame. E.g. in the current Chromium prototype we elide two copies: re-drawing the same buffer is "free" down to the paint op serialization layer, and with some additional work we could push the data even further, all the way to the GPU process and potentially all the way to VRAM.

I'll look into adding additional context to the explainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants