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] Retain unnamed constants' and overrides' types during compaction. #7077

Merged

Conversation

jimblandy
Copy link
Member

@jimblandy jimblandy commented Feb 7, 2025

Ensure that unnamed constants' types are retained, even when the
constants are used only by global expressions. Add a test case.

Similarly for overrides.

The old code marked all named constants as used; then processed
function bodies; and then marked the types of all used constants as
used. This ensured that, as long as a constant was used by a function,
its type would be retained, but didn't address the case where a
constant is used only by a global expression.

Fixes #7072.

@jimblandy jimblandy added type: bug Something isn't working naga Shader Translator area: naga processing Passes over IR in the middle labels Feb 7, 2025
@jimblandy jimblandy force-pushed the naga-compact-retain-unnamed-constant-types branch 2 times, most recently from bea7832 to 13b01f7 Compare February 7, 2025 17:07
Ensure that unnamed constants' types are retained, even when the
constants are used only by global expressions. Add a test case.

The old code marked all named constants as used; then processed
function bodies; and then marked the types of all used constants as
used. This ensured that, as long as a constant was used by a function,
its type would be retained, but didn't address the case where a
constant is used only by a global expression.
Ensure that unnamed overrides' types are retained, even when the
overrides are used only by global expressions. Add a test case.

Fixes gfx-rs#7072.
@jimblandy jimblandy force-pushed the naga-compact-retain-unnamed-constant-types branch from 13b01f7 to 194b682 Compare February 7, 2025 17:15
@teoxoy teoxoy self-assigned this Feb 10, 2025
Copy link
Member

@ErichDonGubler ErichDonGubler left a comment

Choose a reason for hiding this comment

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

LGTM, minus a nit.

@jimblandy jimblandy merged commit 0dd6a1c into gfx-rs:trunk Feb 12, 2025
33 checks passed
@jimblandy jimblandy deleted the naga-compact-retain-unnamed-constant-types branch February 12, 2025 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga processing Passes over IR in the middle naga Shader Translator type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[naga] compaction may miss used constants' types
3 participants