Shaders: an immediate sampler's LOD bias stays in D3D12's range #327
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!327
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/327/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@SkippySteve on GitHub · 2026-11-24 02:19 UTC · original
SkippySteve/victory-pr-own-next24→main· +21 −2 · 1 files · 1 commits · closed without mergingAn immediate sampler's LOD bias comes from bits 0-13 of sampler word 2. That field is signed 5.8 fixed point, so
StaticSampler::from_wordscan decode any value from -32 to 31.996. D3D12 only accepts a static sampler'sMipLODBiasbetween -16 and 15.99 (D3D12_MIP_LOD_BIAS_MIN/D3D12_MIP_LOD_BIAS_MAX). A root signature that holds a static sampler outside that range is refused, and the whole pipeline is lost with it.This change clamps the decoded bias to D3D12's range. Values already inside it come through unchanged. The module doc now says so.
Testing (Linux)
cargo test -p victory-shader: 58 passed, including the newlod_bias_stays_in_the_host_range. It covers 15.996, 31.996 and -32, which are clamped, and -16, 14.5 and -0.5, which are kept.cargo clippy -p victory-shader --all-targets: no new warnings. The one remaining warning,constant_colornever used, was already there before this change.cargo fmt --checkshows no diff for this file, andcargo xtask policypasses.No game data was used; the test builds its sampler words in code.
@SkippySteve on GitHub · 2026-11-24 02:29 UTC · original
superseded by #326 (combined shader DX/parser robustness)
Pull request closed