Skip to content

Shaders: lower image_get_lod on cube textures - #1004

Open
tarcisioads wants to merge 1 commit into
Marvisak:mainfrom
tarcisioads:shader/cube-image-get-lod
Open

tarcisioads wants to merge 1 commit into
Marvisak:mainfrom
tarcisioads:shader/cube-image-get-lod

Conversation

@tarcisioads

Copy link
Copy Markdown

Support image_get_lod (dx.op.calculateLOD.f32, opcode 81) on cube textures (dim = 3) in crates/victory-shader/src/emit/lower.rs:

  • Allow image_get_lod in pixel shaders for dim = 3 (kind = 5, coords = 3).
  • Remove op == 81 from the kind == 5 refusal (keeping *unorm || op == 63), so cube_direction converts the face coordinates into a 3D direction vector before calculateLOD.f32.
  • Add unit test cube_image_get_lod_lowers.

Verification

  • cargo test -p victory-shader (97 passed, 0 failed, 1 ignored benchmark on macOS; Windows dxil.dll validation not run)
  • cargo xtask policy (ok)

MfDev0 pushed a commit to MfDev0/victory that referenced this pull request Nov 24, 2026
In pixel shaders a cube's level query takes the face coordinates turned
into a direction, as a sample does.

From upstream PR Marvisak#1004 (cbc8c33), hand-ported.

Co-authored-by: arena-agent <297053741+arena-agent@users.noreply.github.com>
@andrewpozdnakov7-jpg

Copy link
Copy Markdown
Contributor

Windows validation on cbc8c33. I extended the existing cube LOD fixture to pass its emitted DXIL through Microsoft’s validator, then created a pixel PSO with the fixture shader and the test vertex stub. Both checks passed, and validation kept the emitted container hash.

The full shader suite with native WARP 1.0.22 and Agility 1.620.2 reported 121 passed and 1 ignored. The inbox runtime on this host lacks SM 6.6, which accounts for the GPU test failures when run with the default loader.

This check covers DXIL acceptance and PSO creation. AI-assisted.

@Zipettte

Copy link
Copy Markdown

Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at cbc8c33: cargo test -p victory-shader passes, 121 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).

Tested with AI assistance (Claude).

@MamaLeVrai

Copy link
Copy Markdown

Heads-up: this PR and #563 both edit the cube-sample refusal in emit/lower.rs and conflict with each other. Merged together only texel coordinates are still refused; that resolution is in the bundle #1319 (clippy and tests pass). AI-assisted (Claude Code); no game data.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main: main has moved since the last triage, and the branch now conflicts in crates/victory-shader/src/emit/lower.rs. It will be reviewed again once it is rebased onto current main.

Previous verdict for this head: merge candidate.


Generated by Claude Code

@catminou4 catminou4 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge with current main (940d32f) breaks compilation — verified locally after git merge origin/main:

error[E0063]: missing field `view_marks` in initializer of `Parts<'_>`

Main added view_marks to Parts after this PR was opened (same break as #1587/#1519 — a rebase initializing the new field should fix it). image_get_lod on cube textures looks right; I will re-test after the rebase.

@tarcisioads
tarcisioads force-pushed the shader/cube-image-get-lod branch from 67891e2 to eb3e229 Compare November 25, 2026 10:45

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against origin/main (940d32f) on Windows 11 + NVIDIA GeForce RTX 5090 and WARP:

  • Clean lowering of image_get_lod on cube textures with dxil.dll validation.
  • cargo test -p victory-shader emit::lower::tests: 22/22 passed on RTX 5090, 22/22 passed on WARP (including cube_image_get_lod_lowers).
  • cargo clippy -p victory-shader --all-targets -- -D warnings: 0 warnings.
  • cargo xtask policy: 183 files ok.

AI-assisted (Gemini 4 Neon).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants