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

Open
github-bot wants to merge 2 commits from github-bot/gh-1776 into main AGit
Owner

@⁠0xKaji on GitHub · 2026-11-24 22:20 UTC · original
0xKaji:fix/castable-formats → main · +19 −1 · 1 files · 2 commits · open

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.
**@⁠0xKaji** on GitHub · 2026-11-24 22:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/1776) `0xKaji:fix/castable-formats` → `main` · +19 −1 · 1 files · 2 commits · open ## 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.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:44:19 +00:00
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-24 22:23 UTC · original

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.

**@⁠DesertGamer** on GitHub · 2026-11-24 22:23 UTC · [original](https://github.com/Marvisak/VIctory/pull/1776#issuecomment-7146178247) ### 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). :warning: 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.*
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 06:20 UTC · original · edited 2026-11-26 01:19 UTC

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

**@⁠Marvisak** on GitHub · 2026-11-25 06:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/1776#issuecomment-7154693952) · edited 2026-11-26 01:19 UTC <!-- victory-triage v1 head=afa366e7a25e0aca8ba0e8137f2bdec6b122e7db verdict=merge-candidate at=2026-11-26T01:19:26Z --> 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](https://claude.ai/code)_
Author
Owner

@⁠0xKaji on GitHub · 2026-11-25 13:20 UTC · original

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

  • Reconciled with #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** on GitHub · 2026-11-25 13:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/1776#issuecomment-7163633571) Updated and rebased onto `main` (`940d32f`) to address the triage and review feedback: - **Reconciled with #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).
Author
Owner

@⁠DenRakEiw on GitHub · 2026-11-24 22:27 UTC · original · approved these changes

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

**@⁠DenRakEiw** on GitHub · 2026-11-24 22:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/1776#pullrequestreview-6048388804) · **approved these changes** 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).
Author
Owner

@⁠catminou4 on GitHub · 2026-11-24 23:03 UTC · original · reviewed

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.

**@⁠catminou4** on GitHub · 2026-11-24 23:03 UTC · [original](https://github.com/Marvisak/VIctory/pull/1776#pullrequestreview-6048800376) · **reviewed** 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.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 16:12 UTC · original · approved these changes

Reviewed afa366e7a25e0aca8ba0e8137f2bdec6b122e7db (merged cleanly onto 63bcca43c6a00a758510398fa43096ce7e4f7df0) and verified on Windows 11 x64 with an NVIDIA GeForce RTX 5090, WARP, and D3D12 Debug Layer.

Audit

  • crates/victory-gpu/src/resource.rs:1080, :1088, :1089, :1100:
    • Checked element() (resource.rs:120-133): all other YUV/planar/4:2:2 formats (NV12 103, P010 104, P016 105, YUY2 107, Y210 108, Y216 109, NV11 110, etc.) already return None; formats 68 (DXGI_FORMAT_R8G8_B8G8_UNORM) and 69 (DXGI_FORMAT_G8R8_G8B8_UNORM) were the only 2x1 4:2:2 subsampled formats mapped to (2, 1) and leaking into the 16-bit 1x1 castable class.
    • Excluding SUBSAMPLED_422 = [68, 69] in both directions (returning an empty list for 68/69 and filtering them out of other (2, 1) castable lists) cleanly enforces the DirectX Format List Casting requirement that block size and texels-per-block match.

Verification

  • Clean merge onto 63bcca43c6a00a758510398fa43096ce7e4f7df0 + cargo run -p xtask -- policy (191 files ok)
  • cargo clippy -p victory-gpu --all-targets -- -D warnings (default & --all-features)
  • victory-gpu resource:: with VICTORY_D3D12_DEBUG=1: 18/18 passed on RTX 5090; 18/18 passed (--features diagnostics) on WARP (including castable_formats_share_the_element).
  • A/B CreateCommittedResource3 + ID3D12InfoQueue probe for DXGI_FORMAT_R16_FLOAT (54) on both RTX 5090 and WARP confirmed that host CheckFeatureSupport alone leaves 68/69 in the list on main (cast54_len=13, has_68_69=true, castable(68).len()==13), while with #1776 they are stripped in both directions (cast54_len=11, has_68_69=false, castable(68).len()==0, castable(69).len()==0, create_ok=true, 0 InfoQueue messages).
**@⁠fuzeofficlal** on GitHub · 2026-11-26 16:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/1776#pullrequestreview-6077339212) · **approved these changes** Reviewed `afa366e7a25e0aca8ba0e8137f2bdec6b122e7db` (merged cleanly onto `63bcca43c6a00a758510398fa43096ce7e4f7df0`) and verified on Windows 11 x64 with an NVIDIA GeForce RTX 5090, WARP, and D3D12 Debug Layer. ### Audit - `crates/victory-gpu/src/resource.rs:1080`, `:1088`, `:1089`, `:1100`: - Checked `element()` (`resource.rs:120-133`): all other YUV/planar/4:2:2 formats (`NV12` 103, `P010` 104, `P016` 105, `YUY2` 107, `Y210` 108, `Y216` 109, `NV11` 110, etc.) already return `None`; formats `68` (`DXGI_FORMAT_R8G8_B8G8_UNORM`) and `69` (`DXGI_FORMAT_G8R8_G8B8_UNORM`) were the only 2x1 4:2:2 subsampled formats mapped to `(2, 1)` and leaking into the 16-bit 1x1 castable class. - Excluding `SUBSAMPLED_422 = [68, 69]` in both directions (returning an empty list for `68`/`69` and filtering them out of other `(2, 1)` castable lists) cleanly enforces the DirectX Format List Casting requirement that block size and texels-per-block match. ### Verification - Clean merge onto `63bcca43c6a00a758510398fa43096ce7e4f7df0` + `cargo run -p xtask -- policy` (`191 files ok`) - `cargo clippy -p victory-gpu --all-targets -- -D warnings` (default & `--all-features`) - `victory-gpu` `resource::` with `VICTORY_D3D12_DEBUG=1`: **18/18 passed** on RTX 5090; **18/18 passed** (`--features diagnostics`) on WARP (including `castable_formats_share_the_element`). - A/B `CreateCommittedResource3` + `ID3D12InfoQueue` probe for `DXGI_FORMAT_R16_FLOAT` (`54`) on both RTX 5090 and WARP confirmed that host `CheckFeatureSupport` alone leaves `68`/`69` in the list on `main` (`cast54_len=13`, `has_68_69=true`, `castable(68).len()==13`), while with `#1776` they are stripped in both directions (`cast54_len=11`, `has_68_69=false`, `castable(68).len()==0`, `castable(69).len()==0`, `create_ok=true`, `0` InfoQueue messages).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1776/head:github-bot/gh-1776'
git switch 'github-bot/gh-1776'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1776'
git switch 'github-bot/gh-1776'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1776'
git switch 'github-bot/gh-1776'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1776'
git switch 'main'
git merge --squash 'github-bot/gh-1776'
git switch 'main'
git merge --ff-only 'github-bot/gh-1776'
git switch 'main'
git merge 'github-bot/gh-1776'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1776
No description provided.