Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements partial OpLine support. "Partial" because this only supports OpLine in two places: in types_global_values, and inside basic blocks. In reality, OpLine is allowed in types_global_values, inside basic blocks, but also between basic blocks, in the OpFunctionParameter header, between functions, after all functions, and all sorts of other wacky locations. Supporting all those wacky locations would take a fairly significant refactor (for example, adding a
Vec<Instruction>
in basic blocks for "OpLine/OpNoLines preceding the OpLabel instruction" - because yes, there can be multiple, if we want to faithfully represent all valid spir-v modules)Turns out, though, this partial support is kind of all that we need in rust-gpu, we don't need to represent wacky shenanigans, so I'll leave the full refactor work up to whoever needs that functionality in the future :)
Additionally, the debug section needs to be split up into its three component subsections to not intermix OpString and OpName instructions (which, OpString is relevant to OpLine because that's how the source file is specified). The spec states:
I don't know why they didn't just make it three distinct "top-level" sections, because that's essentially what these subsections are, and it just causes a lot of confusion. Anyway, unfortunately, splitting up the subsections is a breaking change, so reviewers should be aware of that and consider alternatives (but I think a breaking change is the right way to go here).