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

Fix shader compilation on Chrome #387

Merged
merged 1 commit into from
Oct 24, 2023
Merged

Fix shader compilation on Chrome #387

merged 1 commit into from
Oct 24, 2023

Conversation

Zoxc
Copy link
Collaborator

@Zoxc Zoxc commented Oct 14, 2023

This has some fixes for shader compilation on Chrome.

The sign variable shadows the sign function, so it's renamed.

Atomics must have a read_write binding so BumpAllocators usage is changed.

Copy link
Contributor

@raphlinus raphlinus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, these are useful fixes, and it reminds me we should do more testing on the web backend.

@@ -5,7 +5,7 @@
#import bump

@group(0) @binding(0)
var<storage> bump: BumpAllocators;
var<storage, read_write> bump: BumpAllocators;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see this is a reasonable patch. It feels odd to me that an atomic load requires a read-write binding, but I checked the spec and it is. I was thrown off a bit by the fact that it isn't considered a write access (see 13.5.1).

Another possible approach would be to have a non-atomic version of the struct. This is done for AtomicPathBbox (which is going away when monoid bbox computation lands) and AtomicTile. However, in this case I think it's better to have one source of truth, as the bump struct will almost certainly continue to evolve.

let sign = select(-1.0, 1.0, is_positive_slope);
let xt0 = floor(s0.x * sign);
let c = s0.x * sign - xt0;
let sign_ = select(-1.0, 1.0, is_positive_slope);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense but I'm not in love. I think I might prefer xsign (or possibly x_sign as it represents the sign of dx.

@Zoxc Zoxc merged commit 0e998df into linebender:main Oct 24, 2023
4 checks passed
@Zoxc Zoxc deleted the wasm-fix branch October 24, 2023 20:56
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