Skip to content

Row vs column major matrices #146

@nical

Description

@nical

Gecko and euclid's matrices are currently row-major. Web standards use column-major matrices.

@peterjoel proposed in issue #145 to make eulid matrices compatible with the web rather than gecko. I am filing this to keep it a separate discussion since issue #145 is about pre/post multiplications.

I personally think that there is more value in having all internal usage of matrices on the same convention. If/when WebRender makes it into gecko, all of the features are aren't supported (SVG for instance) will be gecko code. The prospect of starting to build a transform in rust-land with a certain layout, keep building it cpp-land with another layout and then debug that is not a happy one.
I am less worried about having to transpose matrices when exposing the DOM, because it happens at a separation between two very different worlds. I don't think I'll find myself hack bits of the rendering engine on both sides of a DOM interface at the same time while I can totally see the rendering engine becoming a mix of rust and cpp code.

So my (biased) opinion is that compatibility with gecko is more important.

That said I am looking into Gecko's matrices to see how dangerous it would be to change the transposition (ideally gecko, servo and the web would agree about matrix layout), so far I haven't come across a lot of code outside of Moz2D that make assumptions about the layout. I'll see what the rest of the gfx team thinks about changing it.

To give an idea of the different matrices involved:

  • euclid: row-major
  • moz2D: row-major
  • cairo: row-major
  • D2D: row-major
  • skia: column-major
  • web standard: column-major

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions