Repository navigation
Shaders: a thread-id count field of 3 still means three components - #339
Closed
SkippySteve wants to merge 1 commit into
Closed
SkippySteve wants to merge 1 commit into
SkippySteve wants to merge 1 commit into
Conversation
COMPUTE_PGM_RSRC2.TIDIG_COMP_CNT is a 2-bit field, and ComputeIo::thread_id_vgprs returned it plus one: 4 for a value of 3. io::raise then labelled v3 as Input::ThreadIdInGroup(3), and lowering asks DXIL's threadIdInGroup for component 3, which does not exist (the console-lanes path quietly treats it as z instead). A thread id has only x, y and z, so clamp the field to 2 before adding one: v0-v2 are the thread id and v3 stays an ordinary VGPR. A unit test covers the field at 3.
Author
|
superseded by #333 (combined native.rs: SGPR bound + refusal tests + TIDIG_COMP_CNT clamp) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
`ComputeIo::thread_id_vgprs` (crates/victory-shader/src/native.rs) read `COMPUTE_PGM_RSRC2.TIDIG_COMP_CNT` (bits 11-12) and added one, so a field value of 3 gave 4 thread-id VGPRs. `io::raise` then mapped v3 to `Input::ThreadIdInGroup(3)`, and `emit/lower.rs` passes that component straight to DXIL's `threadIdInGroup.i32` — a component that doesn't exist (only 0-2 are valid). On the console-lanes path, component 3 fell into the `_` arm and was silently computed as z.
Fix
A thread id has only x, y and z, so the field is clamped to 2 before adding one: 3 now means v0-v2 like 2 does, and v3 stays an ordinary VGPR. One line plus a doc comment.
Tests