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

[naga] Explicitly use global const ctx in offset #6945

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

sagudev
Copy link
Contributor

@sagudev sagudev commented Jan 18, 2025

Connections
Preparation for #6935

Description
Most of wgsl-in assumes constants are only global. In order to fix this in #6935 this PR makes TetureSampler offset explicitly use global const ctx and fix expr_ctx.as_const() to return local const ctx if possible. We cannot use new corrected version because other parts still expect global constant which causes OOB in arena.

Testing
This is tested by existing tests

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy. If applicable, add:
    • --target wasm32-unknown-unknown
    • --target wasm32-unknown-emscripten
  • Run cargo xtask test to run tests.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Signed-off-by: sagudev <[email protected]>
@sagudev sagudev requested a review from a team as a code owner January 18, 2025 10:07
Comment on lines +375 to 376
#[allow(dead_code)]
fn as_const(&mut self) -> ExpressionContext<'source, '_, '_> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might make sense to remove this and add it back later.

@sagudev sagudev changed the title [naga] Use global const ctx in offset [naga] Explicitly use global const ctx in offset Jan 18, 2025
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.

1 participant