Repository navigation
Shader: decode the packed typed-buffer formats - #25
Merged
Merged
Conversation
|
Tested
AI-assisted (DeepSeek V4.1 Flash coding agent). |
Contributor
|
checked: PR head Ran (shader crate only):
Cross-checks of the claims:
Review notes (all minor):
Not verified: any Windows or GPU runtime, DXIL validation of the emitted shader, or real titles. Only the unit tests and the cross-checks above were run. |
This was referenced Nov 24, 2026
Typed buffer loads in the 10_11_11, 11_11_10 and 10_10_10_2 families (GFX10 unified formats 30-49) were refused, failing the shader. Fill in their channel layouts and decode the unsigned 11- and 10-bit floats by shifting them into half position for legacyF16ToF32, which is exact for denormals, infinities and NaNs. Format numbers from LLVM's UfmtGFX10, channel order from Mesa's ac_formats.c. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
artor410
force-pushed
the
packed-buffer-formats
branch
from
November 24, 2026 02:03
f1485bc to
9fe73ba
Compare
Contributor
Author
|
Thanks @DaviTostes and @tedin7! Rebased onto the latest main; the PR now touches only crates/victory-shader/src/emit/lower.rs and the stray loader diff is gone. |
AntoninMichelq
pushed a commit
to AntoninMichelq/VIctory-forkAMD
that referenced
this pull request
Nov 24, 2026
… into the integration Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AZ9pSB4ZoXYUifuXg8gm66
edsuuu
referenced
this pull request
in edsuuu/VI-BR-PORT
Nov 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closed
Xeltax
referenced
this pull request
in Xeltax/VIcky
Nov 24, 2026
This was referenced Nov 24, 2026
suirentakamura
referenced
this pull request
in suirentakamura/victory-suiren
Nov 24, 2026
Shader: decode the packed typed-buffer formats
itsonlysimbo
pushed a commit
to itsonlysimbo/VIctory
that referenced
this pull request
Nov 24, 2026
Shader: decode the packed typed-buffer formats
H4itz
pushed a commit
to H4itz/victory
that referenced
this pull request
Nov 26, 2026
…binds again is not named, queried and kept again (one lookup by address instead of two QueryInterface calls, three locks and a name search per switch) Read line by line before merging. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Summary
Typed buffer loads (
tbuffer_load_format_*) in the 10_11_11, 11_11_10 and 10_10_10_2 families (GFX10 unified formats 30-49) were refused, so any shader using them failed translation. This fills in their channel layouts and decodes the unsigned small floats.An unsigned 11/10-bit float is a half's exponent (5 bits, bias 15) plus the top of its mantissa without the sign, so shifting it into half position widens exactly, denormals, infinities and NaNs included. The other numerics (unorm, snorm, scaled, int) go through the existing generic per-width code.
Sources, cited in the code: format numbers from LLVM's
UfmtGFX10(SIDefines.h; the GFX10 buffer table has no 5_9_9_9), channel order from Mesa'sac_formats.c(R11G11B10_FLOAT is 10_11_11; 10_10_10_2 has its 2-bit channel in the low bits).Evidence
buffer_format(36)(and 30-49) returnedNone, so the load failed translation with "a buffer format".After: new unit tests in
emit::lower::tests:packed_buffer_formats_by_number: the ids map to the layouts and numerics above.small_floats_widen_as_halves: spec values through the shift: 11-bit0x001= 2^-20,0x03F= largest denormal,0x3C0= 1.0,0x7BF= 65024,0x7C0= inf,0x7C1= NaN; the same for 10-bit; 16-bit unchanged.cargo test -p victory-shaderpasses (59).cargo clippyadds no warnings andcargo xtask policyis clean.Not covered: I can't run
diff_tests(no console compiler here), so the emitted DXIL is untested on a GPU and against the game. The snorm -1 clamp on the 2-bit channel is the existing generic code and isn't tested here either. Atyped loadsdiff case with R11G11B10_FLOAT and the 10_10_10_2 formats would cover both.Merge Danger
Door: two-way
Blast Radius: small
Only shaders that used to fail translation on these formats change. The 16-bit float path keeps a shift of 0.
🤖 Generated with Claude Code