Skip to content

GPU: exclude 4:2:2 packed formats 68/69 from castable texture formats - #1776

Open
0xKaji wants to merge 2 commits into
Marvisak:mainfrom
0xKaji:fix/castable-formats
Open

0xKaji wants to merge 2 commits into
Marvisak:mainfrom
0xKaji:fix/castable-formats

Conversation

@0xKaji

@0xKaji 0xKaji commented Nov 24, 2026 •

Copy link
Copy Markdown

Summary

castable() in crates/victory-gpu/src/resource.rs groups formats by element() size, which included 68 (DXGI_FORMAT_R8G8_B8G8_UNORM) and 69 (DXGI_FORMAT_G8R8_G8B8_UNORM) in the 2-byte 1x1 class.

However, 68 and 69 are 4:2:2 2x1 subsampled 4-byte block formats, not 1x1 2-byte texels (despite element()'s (2, 1) approximation). Per DirectX-Specs (d3d/VulkanOn12.md, Format List Casting), castable formats must match block size and texels-per-block, so they cannot be cast with 16-bit 1x1 formats.

Per-host format filtering is left to #2101.

Change

  • Exclude 68 and 69 (SUBSAMPLED_422) from castable() in crates/victory-gpu/src/resource.rs.
  • Extend castable_formats_share_the_element to assert castable(48) excludes 68 and 69.

Verification

  • Verified git diff origin/main contains only the 68/69 exclusion and castable(48) test assertion; GitHub CI check will verify the trimmed commit.

@DesertGamer

Copy link
Copy Markdown

VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.

@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 locally merged onto origin/main (70564ae, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu — all 77 passing tests (including castable_host_textures_are_accepted_by_the_host) pass on both RTX 5090 hardware and VICTORY_D3D12_WARP=1 (0 new failures; the 2 HEAP_VIEWS failures reproduce identically on untouched origin/main 70564ae)
  • cargo clippy -p victory-gpu --all-targets — 0 warnings
  • cargo xtask policy — ok

Clean exclusion of uncastable formats (68, 69, 89) from castable texture format lists with host-verified test coverage. Looks good.

AI-assisted (Gemini 4 Neon).

@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.

Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Formats 68/69/89 excluded from castable texture lists — hardcoded DXGI format numbers; please add a comment naming them (BC6H/BC7-family?) so the next reader doesn't need the enum table.

Marvisak commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Automated triage for the maintainers.

Merge candidate. The new commit addresses the earlier ask: castable() in crates/victory-gpu/src/resource.rs now returns an empty list when the format itself is 68 or 69 (R8G8_B8G8_UNORM/G8R8_G8B8_UNORM), and keeps excluding them from the 2-byte 1x1 class from the other side. The test castable_formats_share_the_element asserts both directions. The diff is limited to this one function and its test, and it merges cleanly with main.

CI: passing (check).


Generated by Claude Code

@0xKaji
0xKaji force-pushed the fix/castable-formats branch from 36b4ac4 to 22ddc4d Compare November 25, 2026 13:20
@0xKaji 0xKaji changed the title GPU: exclude uncastable formats (68, 69, 89) from castable texture lists GPU: filter castable texture formats per host and exclude 4:2:2 packed 68/69 Nov 25, 2026
@0xKaji

0xKaji commented Nov 25, 2026

Copy link
Copy Markdown
Author

Updated and rebased onto main (940d32f) to address the triage and review feedback:

  • Reconciled with GPU: castable formats the host has #2101 / removed static exclusion of 89: make_texture now filters castable_formats per host with CheckFeatureSupport(D3D12_FEATURE_FORMAT_SUPPORT) (Support1 != D3D12_FORMAT_SUPPORT1_NONE, cached in host_has), rather than hardcoding 89 (DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM) out of castable(). Hosts that support 89 (e.g. Windows drivers) keep it; hosts missing it (e.g. vkd3d-proton) drop only the unsupported format.
  • Named 68 / 69 with spec rationale: Kept 68 (DXGI_FORMAT_R8G8_B8G8_UNORM) and 69 (DXGI_FORMAT_G8R8_G8B8_UNORM) excluded from the 1x1 2-byte class in castable() with explicit format names and a reference to DirectX-Specs (d3d/VulkanOn12.md, Format List Casting): they are 4:2:2 2x1 subsampled 4-byte block formats, not 1x1 2-byte texels, so they do not match block size and texels-per-block with 16-bit 1x1 formats.
  • Verified:
    • cargo xtask policy: asset policy: 182 files ok
    • cargo xwin clippy -p victory-gpu --tests --target x86_64-pc-windows-msvc --offline -- -D warnings: 0 warnings
    • Wine GPU tests (resource::tests::castable --test-threads=1 on Linux + Wine + NVIDIA RTX 3060): 2 passed, 0 failed (castable_formats_share_the_element, castable_host_textures_are_accepted_by_the_host, asserting tex.castable matches the host_has-filtered list).

@0xKaji
0xKaji force-pushed the fix/castable-formats branch from 22ddc4d to b15ca37 Compare November 25, 2026 16:12
@0xKaji 0xKaji changed the title GPU: filter castable texture formats per host and exclude 4:2:2 packed 68/69 GPU: exclude 4:2:2 packed formats 68/69 from castable texture formats Nov 25, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 25, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 26, 2026
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.

5 participants