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] Use const ctx instead of global ctx for const resolution #6935

Draft
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

sagudev
Copy link
Contributor

@sagudev sagudev commented Jan 17, 2025

Connections
Fix #6720, depends on #6945

Description
Naga currently assumes constants are global and it passes global ctx to const needing functions. Instead we should pass const ctx (expr ctx) that can represents either local or global consts.

Testing
There will be CTS run in servo and some new 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 <16504129+sagudev@users.noreply.github.com>
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
@sagudev sagudev changed the title [naga] use const ctx for type resolution [naga] Use const ctx instead of global ctx for const resolution Jan 23, 2025
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
@sagudev
Copy link
Contributor Author

sagudev commented Jan 23, 2025

I have a feeling we need to recheck evals and all arena invariants. Distinction between global const ctx and local const ctx is very blurry.

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.

WGSL: const declarations in function scope cannot be used as const expressions
1 participant