Skip to content

[naga spv-out] Document and refactor write_runtime_array_length. #6334

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

Merged
merged 3 commits into from
Sep 28, 2024

Conversation

jimblandy
Copy link
Member

@jimblandy jimblandy commented Sep 27, 2024

  • Document and refactor naga::back::spv::BlockContext::write_runtime_array_length.

    Don't try to handle finding the length of a particular element of a binding_array<array<T>>. The SPIR-V backend doesn't wrap that type correctly anyway; [naga] Permit only structs as binding array elements. #6333 changes the validator to forbid such types. Instead, assume that the elements of a binding_array<T> are always structs whose final members may be a runtime-sized array.

    Pull out consistency checks after the analysis of the array expression, so that we always carry out all the checks regardless of what path we took to produce the information.

  • Update Vulkan spec section number, and provide link.

  • Replace match with equivalent !=.

@jimblandy jimblandy added area: naga back-end Outputs of naga shader conversion naga Shader Translator kind: refactor Making existing function faster or nicer lang: SPIR-V Vulkan's Shading Language labels Sep 27, 2024
@jimblandy jimblandy requested a review from a team September 27, 2024 04:23
@jimblandy jimblandy force-pushed the naga-spv-out-array-length-cleanup branch from 7611701 to 3470345 Compare September 27, 2024 05:04
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.

praise: Yay for clarity, TIL some things! Shippit!

@jimblandy jimblandy force-pushed the naga-spv-out-array-length-cleanup branch from 3470345 to 1cf226d Compare September 27, 2024 23:11
@jimblandy jimblandy force-pushed the naga-spv-out-array-length-cleanup branch from 1cf226d to 573aa75 Compare September 27, 2024 23:14
Document and refactor
`naga::back::spv::BlockContext::write_runtime_array_length`.

Don't try to handle finding the length of a particular element of a
`binding_array<array<T>>`. The SPIR-V backend doesn't wrap that type
correctly anyway; gfx-rs#6333 changes the validator to forbid such types.
Instead, assume that the elements of a `binding_array<T>` are always
structs whose final members may be a runtime-sized array.

Pull out consistency checks after the analysis of the array
expression, so that we always carry out all the checks regardless of
what path we took to produce the information.
@jimblandy jimblandy force-pushed the naga-spv-out-array-length-cleanup branch from 573aa75 to 865dffc Compare September 27, 2024 23:22
@jimblandy jimblandy merged commit 2021e7f into gfx-rs:trunk Sep 28, 2024
27 checks passed
@jimblandy jimblandy deleted the naga-spv-out-array-length-cleanup branch September 28, 2024 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: naga back-end Outputs of naga shader conversion kind: refactor Making existing function faster or nicer lang: SPIR-V Vulkan's Shading Language naga Shader Translator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants