Skip to content

Shaders: CalculateLOD gets only the spatial coordinates - #260

Open
Ortomanic wants to merge 1 commit into
fxceless:mainfrom
Ortomanic:fx/calculate-lod-coords
Open

Ortomanic wants to merge 1 commit into
fxceless:mainfrom
Ortomanic:fx/calculate-lod-coords

Conversation

@Ortomanic

Copy link
Copy Markdown

Changes

CalculateLOD was passed every coordinate component of the sample it was derived from. The DXIL validator wants the components beyond the texture's spatial dimensions to be undef (out of bound coord must be undef). The level-of-detail query now passes only the spatial coordinates.

Validation

  • Offline over the title's shader pack: the three programs that failed dxv with that message pass (34e55a0e, cc182397, d52fbc59). Only those three programs' DXIL changes; none is lost and there are no new dxv or dxil-spirv failures.
  • None of the three is bound in the part of the title I can reach, so there is no in-game result for this change.
  • cargo clippy --workspace --all-targets --locked -- -D warnings for the Windows target, with and without --all-features, and cargo test -p victory-shader -p xtask pass on this branch (cross-compiled from Linux with the pinned toolchain).

AI-assisted patch with local build and offline validation.

DXIL's CalculateLOD takes three coordinates and the validator wants those
past the image's spatial dimensions undef: the layer of a 2D array image is
not one. Three pixel programs that read barycentrics directly
(PS_DeferredTextured_AlphaClip and two others) stopped validation with
'out of bound coord must be undef'.

(cherry picked from commit 6e248e45342a3b7d1556298c6a72ab9881128b1d)
RENOxDECEPTION added a commit to RENOxDECEPTION/victory-fork that referenced this pull request Nov 25, 2026
@JRamos1993

Copy link
Copy Markdown

Offline check on the retail shader pack: this PR, merged onto current main 310c6eb, fixes the 3 "out of bound coord must be undef" pixel programs, loses none, and changes nothing else.

Setup: RTX 5090, Windows 11. victory translate --validate --list over the title's full shader pack, with a local DXIL hash on each validated line:

  • Validated: 25,382 → 25,385. None lost, and no other program's DXIL changes.
  • Pipelines: with the same fix, --pipelines on the 3 creates 3 pipelines, 0 refused.

Duplicate closed: I had opened #720 for the same thing without seeing this PR; it emits byte-identical DXIL for all programs, and I closed it. It has a small synthetic test (image_get_lod of a 2D array: emits, validates, makes a pipeline, and fails without the fix) on JRamos1993:lod-array-coords in crates/victory-shader/src/emit/image_lod_tests.rs, if you want one here.

AI use: Claude Code with Claude Opus 5.5 ran the pack and wrote this. Nothing from the title is in it.

@iGoldenNinja

Copy link
Copy Markdown

Independent RTX 5080 result on NVIDIA fork f85101b6095e8cf3cecf8f0647cc7f5428daa177, Windows 11 Pro 25H2 build 26200.9974, driver 617.14 and DXIL validator 1.9.2609.5.

I adapted ZTRX PR 103's synthetic fixture to require validation and pipeline creation on both the hardware adapter and WARP. The parent failed on the 1D array case with out of bound coord must be undef. The port that leaves the slice operand undefined passed validation and made pipelines for all five dimensions in the fixture (1D, 2D, 3D, 1D array and 2D array). This adds a 1D-array check alongside the 2D-array cases reported above. The measured stage was D3D12 graphics pipeline creation. Pinned port and fixture

Testing and reporting assisted by OpenAI Codex.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants