Skip to content

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

Open

Description

@domenic

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.

Activity

  1. fmalita commented on Aug 19, 2024

    @fmalita
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions