Skip to content

fix(gpu): take an unordered view's level from its MipSlice word - #525

Merged
pragyaangaur merged 1 commit into
pragyaangaur:mainfrom
hackgods:fix/uav-mip-slice
Nov 27, 2026
Merged

pragyaangaur merged 1 commit into
pragyaangaur:mainfrom
hackgods:fix/uav-mip-slice

Conversation

@hackgods

Copy link
Copy Markdown
Contributor

What. image_words builds the size fields of the console image descriptor, which programs read as numbers through the view table. For an unordered view (UAV) it now takes the level from word 2 of the view description, MipSlice, where uav_desc hands it to the host.

Why. It read word 4. That is a shader view's MostDetailedMip (an SRV's union starts at byte 16), but in an unordered view's description (its union starts at byte 8) word 4 is an array's ArraySize or a 3D view's WSize. So a 2D UAV of level 3 read as level 0, and a UAV of six array slices read as level 6. A program that reads those fields as numbers then works with the wrong level's size, or with a level that doesn't exist.

Context: #488. With VICTORY_UAV_SIZE_LEVEL0=1 (every program) halfwave50 saw speckles on skin. Per their comment on #488, that run used a build from before this word-2 fix in their fork, so the wrong level is a plausible cause. Nobody has checked that in game yet, and this PR doesn't change #488's switch or its per-program default.

Tests

  • descriptor::host::tests::a_texture_view_gives_its_image_descriptor_size_fields (Windows target, runs under Wine): the UAV's level is now where the host's description has it (word 2), and a new case covers a view of level 2 of six array slices, where the level must not be the slice count.
  • On this branch (base d2b4889): cargo test --workspace 722 passed; tools/macos/test-wine.sh --workspace --no-fail-fast 1443 passed, 1 failed (draw::bake_sources::tests::bindless_bake_draw_pre_uploads_unmade_placed_texture_on_first_execution, intermittent on plain main too in our runs, which shared the machine with a game run); gnullvm clippy --workspace --all-targets -D warnings, with and without --all-features: clean; cargo xtask policy: ok.
  • In game: in our integration builds (v6 onwards, M5 Pro): lit, no new refusals. No A/B isolates it, and skin with =1 plus this fix is still unchecked (our open promise on fix(gpu): smooth sun-shadow edges on D3DMetal (optional VICTORY_UAV_SIZE_LEVEL0) #488).

Credits. From halfwave50/VIctory-macOS-halfwave b9ac764 (GPL-3.0, issue #455).

Update: rebased onto main f7dddb0 (after #518–#522 and #447); tests re-run there, clippy and policy clean. This change has also been in our play builds on the M5 Pro (integration v8/v9, lit and correct prison scene) for the last day.

🤖 Generated with Claude Code

image_words builds the size fields of the console image descriptor that
programs read as numbers through the view table. For an unordered view
it took the level from word 4 of the view description: a shader view's
MostDetailedMip, but for an unordered view (its union starts at byte 8)
an array's size or a 3D view's depth. Its MipSlice is word 2, as
uav_desc hands it to the host. A 2D unordered view of level 3 read as
level 0, a view of six array slices as level 6.

The test has the level where the host's description has it, and a view
of level 2 of six array slices.

From halfwave50/VIctory-macOS-halfwave b9ac764 (GPL-3.0, issue
pragyaangaur#455).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pragyaangaur
pragyaangaur merged commit 8811fc2 into pragyaangaur:main Nov 27, 2026
1 check passed
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.

2 participants