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] Support local const in ImageSample.offset #7213

Merged
merged 5 commits into from
Mar 7, 2025

Conversation

sagudev
Copy link
Contributor

@sagudev sagudev commented Feb 24, 2025

Connections
Continuation of #6935, fixes #7230.

Description
ImageSample.offset was assumed to be global const everywhere, so this PR changes the requirement to be an expr that is also local, this required fixing all parts of naga ir (compaction,validation,analyzer); wgsl-in to accept local const and all backends to support writing const expr that come from function expr arena (instead of global expr arena).

This PR needs to be squashed, commits are separated only for easier review.

Testing
CTS run in servo: https://github.com/sagudev/servo/actions/runs/13517257103/job/37775703718 is good and changed existing test.

Checklist

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

sagudev added a commit to sagudev/servo that referenced this pull request Feb 25, 2025
Signed-off-by: sagudev <[email protected]>
sagudev added a commit to sagudev/servo that referenced this pull request Feb 25, 2025
{"fail_fast": false, "matrix": [{"name": "Linux (Production, WPT)", "workflow": "linux", "wpt_layout": "2020", "profile": "production", "unit_tests": false, "build_libservo": false, "bencher": false, "wpt_args": "_webgpu"}]}
@sagudev sagudev force-pushed the local-const-img-sample branch from eedefed to 2c8a3fc Compare February 25, 2025 13:07
@sagudev

This comment was marked as outdated.

Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

Good stuff!

@teoxoy
Copy link
Member

teoxoy commented Mar 6, 2025

@sagudev one last thing: could you update the docs as well?

/// This refers to an expression in [`Module::global_expressions`].

wgpu/naga/src/lib.rs

Lines 2228 to 2229 in 7df6e47

/// - [`Expression::ImageSample::offset`] refers to an expression in
/// [`Module::global_expressions`].

@sagudev
Copy link
Contributor Author

sagudev commented Mar 6, 2025

@sagudev sagudev force-pushed the local-const-img-sample branch from f011b1b to 4f9fb8d Compare March 7, 2025 07:45
@sagudev sagudev force-pushed the local-const-img-sample branch from 4f9fb8d to 0bf1098 Compare March 7, 2025 07:49
@sagudev
Copy link
Contributor Author

sagudev commented Mar 7, 2025

I updated docs and rebased, so this should be ready to land.

@teoxoy teoxoy merged commit 424fde1 into gfx-rs:trunk Mar 7, 2025
36 checks passed
@cwfitzgerald
Copy link
Member

This seemed to regress one of our late-running tests, parsing the dota2 shaders: https://github.com/gfx-rs/wgpu/blob/trunk/.github/workflows/lazy.yml#L16-L40

@sagudev
Copy link
Contributor Author

sagudev commented Mar 9, 2025

This seemed to regress one of our late-running tests, parsing the dota2 shaders: https://github.com/gfx-rs/wgpu/blob/trunk/.github/workflows/lazy.yml#L16-L40

Yeah, I noticed this before. Fix is already done in #7297

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.

[naga] Local Expressions should never refer directly to global Expressions
3 participants