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

Ensure PathEncoder encodes in little-endian #820

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Ensure PathEncoder encodes in little-endian #820

wants to merge 4 commits into from

Conversation

tomcur
Copy link
Member

@tomcur tomcur commented Feb 20, 2025

(On top of #817 to prevent conflicts. See 6c4d4cc for the changes here.)

WGSL expects little-endian data, but Vello currently doesn't convert to little-endian, except for colors: DrawColor specifies its endianness explicitly, with conversion handled by the Color crate. On big-endian hosts, the other encodings would break.

Whether big-endian hosts are a valid target for Vello, I do not know. This is opened in part as a place to have that discussion. If this is desirable, other places will need attention. I have not taken a look yet.

DJMcNab and others added 4 commits February 14, 2025 14:37
We already assume these are word-aligned, and so this would
catch a failure of that assumption much earller.

A future change would be to encode the full scene encoding as u32.
That would be useful for #810, as the current code has an alignment hazard
(On top of #817 to prevent
conflicts.)

WGSL expects little-endian data, but Vello currently doesn't convert to
little-endian, except for colors: `DrawColor` specifies its endianness
explicitly, with conversion handled by the Color crate. On big-endian
hosts, the other encodings would break.

Whether big-endian hosts are a valid target for Vello, I do not know.
This is opened in part as a place to have that discussion. If this is
desirable, other places will need attention. I have not taken a look
yet.
@tomcur tomcur changed the title Endian Ensure PathEncoder encodes in little-endian Feb 20, 2025
@tomcur tomcur marked this pull request as draft February 20, 2025 20:34
@tomcur
Copy link
Member Author

tomcur commented Feb 20, 2025

Consider all the structs with Bytemuck::Pod that would also need treatment. Doing this right would be somewhat involved.

@DJMcNab
Copy link
Member

DJMcNab commented Feb 21, 2025

I think that it would be good to get this right, but it's hard because of the CPU shaders; the CPU shaders need to have the opposite transformation.

My preference (as we discussed yesterday) would be to just fail to compile for a big endian system (and adding a non-feature cfg to disable that check).

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

Successfully merging this pull request may close these issues.

2 participants